Is it possible to write a python script such that a function is called whenever a USB device is added or removed on Windows?
libusb (and corresponding python modules such as libusb1) appears to be the most popular solution, but it lacks hotplugging callback registration support in Windows. A feature request has been open for this since 2015, and it's still not implemented.
I've seen some hacks query Windows' usb devices at some interval, do a diff of the current list of devices from the previous list of devices, and use this as an alternative. Due to the nature of my application, this hack would be a huge security risk and is not a valid solution. I need actual callback registration on usb hotplug events.
Though less ideal, I'm open to writing something in C or C++ and then writing a python binding to that code, if necessary.
Is it possible to hav