0

I'm working on an application which uses a serial connection to a USB device (Shows up as a COM port). On the previous HW, a silabs chip was used and silabs drivers was installed on the PC. The new HW uses a internal USB block and now has a custom driver.

When I use/used the old HW, I would get a exception in my reader thread in the read() call, when the USB device was disconnected, but with the new setup this is not the case. I have been looking at the drivers and where silabs depends on its own .sys files, the new driver uses usbser.sys. I have been reading alot about the different sections in a INF files, assuming that this was related to a driver problem but can not seem to find any thing which pops in my eyes.

The application is written in Java and uses the jComport component. Sadly I'm not allowed to post any driver code, but hope you guys can help me anyway.

Anyone which can pass on some information to help me ?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
René Josefsen
  • 143
  • 2
  • 11

1 Answers1

0

The difference in behavior here probably has to do with the difference in implementation of surprise removal between the devices/drivers. When a device is removed while using the Silabs driver then requests sent to the driver from that point on will fail, because the device is not longer available. It's possible that your new device, which operates as a CDC devices, does not implement the same policy on removal and doesn't fail certain functions, or in the same way as the Silabs driver will.

The proper way to deal with this in either case is to implement surprise removal detection for your USB-to-serial converter. Unfortunately there is not a straightforward approach to this in Java, but here is some sample C++ code that demonstrates the events you can wait on.

Preston
  • 2,543
  • 1
  • 17
  • 26