Writing raw USB data

This is a discussion on Writing raw USB data within the Linux Programming forums, part of the Platform Specific Boards category; Hi. I have a few question about USB on linux. Firstly, how do I know which file descriptor in the ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    103

    Writing raw USB data

    Hi. I have a few question about USB on linux. Firstly, how do I know which file descriptor in the /dev/ section is USB? Secondly, how can I write raw code to it? Would I have to write a kernel level driver?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Poincare View Post
    Hi. I have a few question about USB on linux. Firstly, how do I know which file descriptor in the /dev/ section is USB?
    USB devices begin with "s", eg storage devices are sd. Stuff like this is listed here:

    http://www.kernel.org/pub/linux/docs...vices-2.6+.txt

    Pretty sure there is a copy in with the kernel source.

    Secondly, how can I write raw code to it? Would I have to write a kernel level driver?
    Yep.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    examples of writing a USB driver?

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Heh-heh.

    Linux Device Drivers, Third Edition [LWN.net]

    Major issue will be the nature of the device itself. You communicate via "endpoints" that functional aspects of the hardware, so you almost certainly need the specifications for it. You can get the standards for such here:

    USB.org - Documents

    but the actual specific ones you need to get from the manufacturer. The above link will help you to understand them, once you have read up enough about (usb) drivers. So this is a fairly serious undertaking.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Actually there is something known as "scsi pass through", that uses ioctl calls to send scsi control messages to usb devices available on Linux. It gives you kernel space control over a usb device from user space.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. program terminates abruptly
    By roaan in forum C Programming
    Replies: 3
    Last Post: 08-28-2009, 04:53 PM
  2. parent in a binary search tree
    By roaan in forum C Programming
    Replies: 4
    Last Post: 08-26-2009, 08:08 PM
  3. data structure design for data aggregation
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 05-20-2008, 07:43 AM
  4. Writing data to serial port
    By HAssan in forum C Programming
    Replies: 4
    Last Post: 10-16-2006, 01:07 PM
  5. reading and writing data
    By chrismiceli in forum C Programming
    Replies: 1
    Last Post: 09-14-2003, 12:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21