LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   How to open USB device in user mode via sysfs. (https://www.linuxquestions.org/questions/linux-kernel-70/how-to-open-usb-device-in-user-mode-via-sysfs-786388/)

mpoupe 02-02-2010 04:50 AM

How to open USB device in user mode via sysfs.
 
I would like to something like:
int fd = open("/sys/bus/usb/devices/5-1/<something>", O_RDWR);
and then use fd for ioctl() calls (submit urbs, etc.)
I was able to do the same on usbfs:
int fd = open("/proc/bus/usb/005/007", O_RDWR);

Now I need to access the USB via sysfs, because not all Linux platforms have usbfs available. I cannot open("/sys/bus/usb/devices/5-1", O_RDWR) because this is a directory :-( What file in this directory should be opened for ioctl() ?
Please help.
Thank you.

mpoupe 02-04-2010 06:54 AM

So the answer is, that the device must be found in /dev/bus/usb sub-tree and opened here.


All times are GMT -5. The time now is 10:23 PM.