Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the tty subsystem notifications #3

Open
lukipuki opened this issue Jan 23, 2024 · 0 comments
Open

Support for the tty subsystem notifications #3

lukipuki opened this issue Jan 23, 2024 · 0 comments

Comments

@lukipuki
Copy link

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 nofitifaction, 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: image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant