-
-
Notifications
You must be signed in to change notification settings - Fork 116
Yes you can! Under Linux, the standard solution for this problem is to use udev rules. Here are some links to udev related websites.
- udev homepage
- Debian's udev overview
- Writing udev rules
- Proper place to ask questions about udev rules
No, libusb provides an API for writing software on the host. Of course, if the device also acts as a USB host then libusb could still be useful, but only for the host part of the device.
Yes, libusb can be used for low-level communication with USB Mass Storage Class devices. But in order to access a file on such a device you must first implement Mass Storage Class, SCSI and the particular filesystem used on the device, most commonly FAT32.
No, we can not do this for you, but you can find a limited example of how to read a data block through Mass Storage using libusb in the mass_storage test from the xusb.c sample of the the libusbx distribution.
Unlike what is the case with libusb, libusbx supports USB HID device as we understand that there are many generic USB HID devices out there that you would like to have easy access to.
On Linux, you must detach the kernel HID driver in order to use libusb to communicate with the device, which libusb/libusbx has an API for. If you have a relevant udev rule, then this API does not require root privilege to run.
On Mac OS X you must install a codeless kext kernel driver and then reboot before you can communicate with the device. This may change once a native HID backend is written for Mac OS X.
On Windows, the native HID driver is supported by libusbx. There is a restriction when trying to access HID keyboards and mice, as only the OS is entitled to access them.
If you want, you can also use the library HIDAPI by Signal 11 Software, which is also cross-platform. It uses native HID API under Windows and Mac OS X. It can use libusbx/libusb or hidraw as the backend under Linux.