Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-15-2005, 09:12 AM   #1
Registered: Jun 2005
Posts: 44

Rep: Reputation: 16
USB host to host communication

here's my problem:

I have 2 linux boxes and they need to send and receive some messages to each other. I have usb host2host cable, but I don't know how to write the software for usb communication.

I tried libusb and wrote some code that can detect the cable, determine endpoint direction from bEndpointAddress, then call usb_bulk_read or usb_bulk_write. I get errors from usb_set_configuration, usb_claim_interface, and then usb_bulk_read (or usb_bulk_write, whatever I call).

I searched the forum, read libusb documentation and some programming guides, like the one on and O'Reilly's Linux Device Drivers, chapter 13.

As I understand, this can be programmed also without libusb and including linux/usb.h instead of usb.h. I haven't tried that yet and would like to avoid it, because:
1. my program would then not be portable, and
2. the linux distro I'm using for developing doesn't even have all the necessary functions (usb_bulk_msg, interface_to_usbdev ...) declared in headers /usr/include/linux/usb*.h, so with this approach I'd have to use another distro for developing. Besides, this shows my program would then not be portable even to all linux systems.

What I'm looking for is some small and simple example code that reads or writes something to usb. What I found so far is the example on libusb homepage that does just things I already understand and have successfully programmed (searches through all devices, interfaces, etc., but does not read nor write anything). Other code I found is way too big and has its own complex routines for read/write. Any help appreciated.
Old 07-15-2005, 09:44 AM   #2
Registered: Aug 2004
Location: Philly
Distribution: Debian Lenny, FreeBSD
Posts: 577

Rep: Reputation: 30
These sites helped me.

However, although both my linux boxes detect and automaticlly setup my Belkin usb DirectConnet. I can't determine what interface to use to transfer the files.
(for instance in XP a simple click on the DirectConnect icon would bring up a window for the local and host 'puters).


You may have already looked at those sites, so I'm sorry if this does not help you.


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
Resolving <www.some remote host>.... failed: Host not found. koodoo Linux - Newbie 2 06-27-2005 08:48 AM
How to setup a host.deny and host.allow for SSH? explorer1979 Linux - Security 2 01-31-2005 05:28 PM
i m getting the error unknown host while im pinging with the host name gunjan thakkar Linux - General 2 12-14-2004 01:19 PM
Unknown Host <Linuxmachinename> / Unable to ping by host name nishi_k_79 Linux - Networking 4 11-01-2003 01:24 PM
How to configure Host-to-Host IPSec (Free SWAN) gpagedar Linux - Security 2 10-18-2003 05:22 AM > Forums > Non-*NIX Forums > Programming

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

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