Simulating a hotplug event with libusb (test, debugging)

214 views Asked by At

How can I simulate a fake hotplug removal event with libusb?

I'm writing an application that uses libusb-1.0 on Linux and MacOS to detect and respond to USB Hotplug Events (eg the user ejects a USB drive and then I run some code).

I'm trying to do some manual testing (and eventually some automated unit tests) for making sure my application functions as desired when a USB drive is removed. For example, I'd like to be able to do this on a GitHub shared runner running on MacStadium's fleet of MacMinis in the cloud. Obviously, I can't physically stick a USB drive into the cloud machine and remove the USB drive during the CI pipeline.

How can I simulate a USB hotplug removal event in libusb for testing my application?

0

There are 0 answers