Closed maas78 closed 5 years ago
When you "read()" and ReadTimeout==Timeout.Infinite, you'll get zero when the device is unplugged and there is no more data in the buffer. The value of zero on read is defined as "end of file". If you read again, you'll get an exception (regardless also of the ReadTimeout parameter).
You will have to make the connection manually again, by closing the serial port first, then reopening it. Closing the serial port is required to release/free any resources.
If you need USB notifications of insertion/removal, you'll have to find out how to do this yourself, that is outside of the scope of this library, it handles reading/writing serial ports but not insertion/removal of devices. That would be for a USB specific library, which this one is not.
Hi, Is it possible to handle disconnect/reconnect on usb-to-com like usb scanner. If I unplug the device and replug I need to remake the connection manually. I didn't find any event to handle disconnection, the "errors event" doesn't trigger it.