USB Connect

This is a discussion on USB Connect within the Networking/Device Communication forums, part of the General Programming Boards category; This might be in the wrong section but the title of this section is "Network/ Device Communication" and I figured ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Question USB Connect

    This might be in the wrong section but the title of this section is "Network/Device Communication" and I figured a USB device is a device.... I have only seen network posts in this section.

    So my question is how could I connect to a USB device (i.e mouse) and send it raw data in c/c++(I am using unix)?

    Thanks,
    CorX

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by CorX View Post
    So my question is how could I connect to a USB device (i.e mouse) and send it raw data in c/c++(I am using unix)?
    I've never used real unix but I am pretty sure the filesystem, etc, is almost identical to linux, which means devices generally have a device node (a special file type) in the /dev directory. You can try writing and reading from these as if they were normal files, however, the kernel is in charge and knows what is and is not an appropriate action -- eg, if you try and write something to the mouse, that will probably fail.

    USB devices are controlled with bytecode/text, but it is not in a computer programming language, and the devices do not have the capacity to interpret C or C++. Unless they were made to do that, which would be very unusual; what is it specifically you are trying to do?
    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
    Mar 2009
    Posts
    8
    Sweet, thanks that makes perfect sense.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,488
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [Hardware + Software][C++ or C#] USB Fan
    By Mywk in forum C++ Programming
    Replies: 16
    Last Post: 07-04-2009, 03:12 PM
  2. Replies: 1
    Last Post: 10-13-2004, 12:15 PM
  3. Client timed-out once on connect(), can never connect() again
    By registering in forum Networking/Device Communication
    Replies: 6
    Last Post: 10-28-2003, 02:46 PM
  4. Usb 2.0
    By ober in forum Tech Board
    Replies: 6
    Last Post: 09-06-2003, 10:14 AM
  5. Printers On USB
    By (TNT) in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-10-2002, 10:48 AM

Tags for this Thread


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