In Windows OS, when a USB device is attached or detached, WindowProc receives a WM_DEVICECHANGE message having parameters wParam and lParam in which I can find out which device is attached or detached.
How can I programmatically detect the connection of a portable USB device at any time when the program is already running on Linux in the same way? Preferably using libusb and without using udev and there should be no call to external utilities like lsusb.
I've looked thru similar questions in this forum and alas found no answer.
I found the way. libusb_hotplug_register_callback saves me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With