void usbDevices_DeviceRemoved(object sender, EventArgs e) { Console.WriteLine("USB Remove"); SystemLogBox.AppendText("USB Remove" + "\r\n"); //when device is removed, rd/rw thread will be shutdown. tXfers_Read.Abort(); tXfers_Read.Join(); tXfers_Read = null; outEndpoint.Reset(); tXfers_Write.Abort(); tXfers_Write.Join(); tXfers_Write = null; inEndpoint.Reset(); setDevice(); }