Commit Graph

3 Commits (5c37c4a9db5e1eb9b13f9a081b7e435dcac71172)

Author SHA1 Message Date
nirenjan 3a81acf828 Fix build with newer version of libusb 2021-09-14 09:28:00 -07:00
nirenjan 627c1fb004 Use libusb hotplug API to automatically detect disconnection
Prior to this commit, the libx52_is_connected API was simply checking if
the device handle was non-NULL. However, this was insufficient, since
the device disconnection would not reset the handle, and was relying on
the daemon to manually disconnect.

The libusb hotplug API provides functionality to register a callback on
device insertion/removal. libx52 only registers for removal, and will
automatically disconnect the device on receiving the callback. This also
modifies libx52_is_connected to fallback to checking if the kernel
driver is active if the linked libusb does not support hotplug (unlikely).

Finally, this commit adds support for the new hotplug related functions
to the libusbx52 preload library. While the preload library doesn't
actually support hotplug, it is sufficient to pretend that it does.
2021-09-14 09:03:23 -07:00
nirenjan 3b2378a54b Move libusbx52 to top level 2021-07-29 21:57:19 -07:00