Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 02-02-2010, 04:50 AM   #1
LQ Newbie
Registered: Feb 2010
Posts: 3

Rep: Reputation: 0
Question 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.
Old 02-04-2010, 06:54 AM   #2
LQ Newbie
Registered: Feb 2010
Posts: 3

Original Poster
Rep: Reputation: 0
So the answer is, that the device must be found in /dev/bus/usb sub-tree and opened here.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Device attribute in sysfs sticktrick Linux - Kernel 0 07-11-2009 10:04 AM
how to create a device node in sysfs? hash123 Linux - Kernel 0 08-11-2008 01:41 AM
Failed to open device /dev/usb/ttyUSB0: No such device efm Linux - Newbie 2 04-04-2005 08:46 PM
how to open /proc file in RW mode in user mode? cranium2004 Programming 3 03-06-2005 03:03 AM
HP Deskjet (USB) & CUPS & Slackware 9.1: Unable to open USB device "usb:/dev/usb/lp0&qu arnostienen Slackware 2 01-29-2004 03:22 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration