-
-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I'm using USB devices that contain a UART bridge, so they communicate over a serial port bridged via USB.
I've used pyudev previously but I want to make my app run on Windows too. The problem is that the notification from USBMonitor comes too early, before the serial port is initialized. In pyudev, you can specify subsystem=tty to receive notifications when the serial port becomes available.
Benchmarking USBMonitor, which is using subsystem=usb, against pyudev using subsystem=tty gives a fairly long delay (up to 200ms) between those two:
2024-01-23 10:47:39.930515 USBMonitor notification, subsystem=usb
2024-01-23 10:47:39.999694 pyudev notification, subsystem=tty
In order to integrate with USBMonitor I have to put in a hacky sleep for the serial port to be available. Or I can modify the source code in the following way: 
Would you be willing to add an option to listen to the tty subsystem notifications?
When I tested USBMonitor on Windows, it looked like this was not needed, as the COM port was part of the name of the device returned by USBMonitor, so I assume it was ready to use. I haven't tested it though, so maybe there needs to be some change in the Windows part too.