USB Communication

This is a discussion on USB Communication within the Windows Programming forums, part of the Platform Specific Boards category; This is probably considered an advanced question. And I most likely need to BE an advanced programmer as well; But ...

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Question USB Communication

    This is probably considered an advanced question. And I most likely need to BE an advanced programmer as well; But I'll take a shot...

    How can I programmaticly send/recv data through the USB cable/port?
    My goal is to get two programs on different computers to communicate through the USB hookup. My biggest problem is that I have no idea on even how to get a program to get a handle on a USB.

    Any idea? Thanks in advance.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    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.

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    I don't reckon that would work as the computers are both hosts; the bus would need at least one connected device to talk to. This is why if you get a USB network cable from a shop (and pay well over the odds for it ) you'll find a little board in between that is the device that both hosts connect to.

  4. #4
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    Although USB is widely implemented nowadays, implementing USB communication on your own is much more difficult then it seems at the first sight.

    In your case you will need a microcontroller with at least 2 endpoints ( although I think it can also be done with 1 endpoint but it'll be easier with multiple endpoints , and since every common USB µcontroller has more then 2 endpoints this is not really an issue ), each pc will then send data to these endpoints, the µcontroller will then forward the data ( unless it's initializing data for the µcontroller ).


    You will have to write some assembler for this µcontroller, if you don't want to do that , get a PIC demo board, you can write in C, convert to asm and load it onto the µcontroller.

    I myself find it a pity that developer tools for USB communication is somewhat expensive. The µcontrollers themselves are relatively cheap but its the software/ developer tools, demo board etc that cost too much imo.

    This is why if you get a USB network cable from a shop (and pay well over the odds for it ) you'll find a little board in between that is the device that both hosts connect to.
    You are right, the cost of the cable and the µcontroller will probably be something like 1/20 of the cost of the whole USB network cable in shops.... Its the designing, writing the assembly etc etc that they take into account and charge you for.

    :edit:

    Just look for any µcontroller with 2 usb interfaces to interconnect them.

    Although I think there will be a possibility to do this without any µcontroller between, you would just need to know how windows sets up USB communication. Intercept every communication before it gets to windows itself, and let your program take care of the data that you need, the rest you just forward as if nothing happened.

    But it'll be more portable and faster in developing terms to just use a µcontroller between the 2 PC's.
    Last edited by GanglyLamb; 08-07-2006 at 08:13 AM.

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> looks easier at first sight
    You got that right!
    Okay... ... ... ... nevermind...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. usb communication
    By sgh in forum Networking/Device Communication
    Replies: 6
    Last Post: 01-15-2009, 09:43 AM
  2. USB communication
    By programer345 in forum Networking/Device Communication
    Replies: 0
    Last Post: 06-27-2008, 01:51 PM
  3. Xbee module USB board communication
    By ghost1 in forum C Programming
    Replies: 1
    Last Post: 11-27-2006, 04:19 PM
  4. Programming a usb communication
    By axr0284 in forum C++ Programming
    Replies: 9
    Last Post: 12-28-2004, 05:26 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

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