On a Linux system, I need to list all USB hosts and devices with various information like class, product id, etc. I figure both libusb and sysfs are up to the task (correct?). So which one is the better?

有帮助吗?

解决方案

You should prefer libusb because it is platform independent and provides better APIs to work with USB devices than sysfs.

If you do not need to integrate this functionality in some other program, consider using the standalone usb-devices or even lsusb programs (which are included with the usbutils package).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top