Scanning USB for device attachments and detachments

30 views
Skip to first unread message

Zac Harvey

unread,
May 23, 2019, 9:21:11 AM5/23/19
to usb4java
I have a requirement where my Java app needs to scan all the USB ports on the current machine and fire Attachment/Detachment Events if a USB device successfully attaches to the port or detaches from it.

This must work on any Linux PC or Mac and so the set of available USB ports will not be known at runtime.

So I need a way to:

1. Scan the hardware to obtain a list of all available USB ports
2. For each detected USB port, determine whether a USB device is there or not (I can handle the Attachment/Detachment logic)

I'm certain this library can help me with #2, but I'm not sure about the first part (that is, scanning the machine for a list of available USB ports). Is this something the library supports?
Reply all
Reply to author
Forward
0 new messages