public bool DisconnectDevice(UsbDevice usbDevice) { UsbSerialDevice optionalDevice = serialDevices.First(p => usbDevice.DeviceId == p.GetDeviceId()); if (optionalDevice != null) { UsbSerialDevice disconnectedDevice = optionalDevice; disconnectedDevice.SyncClose(); serialDevices.Remove(optionalDevice); serialPortBuilder.serialPortCallback.OnSerialPortsDetected(serialPortBuilder.serialDevices); return(true); } return(false); }
public bool DisconnectDevice(UsbSerialDevice usbSerialDevice) { usbSerialDevice.SyncClose(); serialDevices.Remove(usbSerialDevice); return(true); }