LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 07-15-2005, 10:12 AM   #1
mic
Member
 
Registered: Jun 2005
Posts: 44

Rep: Reputation: 16
USB host to host communication


Hi,
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 usb.cs.tum.edu 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, 10:44 AM   #2
cuiq
Member
 
Registered: Aug 2004
Location: Philly
Distribution: Debian Lenny, FreeBSD
Posts: 577

Rep: Reputation: 30
These sites helped me.

http://www.linux-usb.org/usbnet/index.html
http://www.linux-usb.org/devices.html

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.
 
  


Reply


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 09:48 AM
How to setup a host.deny and host.allow for SSH? explorer1979 Linux - Security 2 01-31-2005 06:28 PM
i m getting the error unknown host while im pinging with the host name gunjan thakkar Linux - General 2 12-14-2004 02:19 PM
Unknown Host <Linuxmachinename> / Unable to ping by host name nishi_k_79 Linux - Networking 4 11-01-2003 02:24 PM
How to configure Host-to-Host IPSec (Free SWAN) gpagedar Linux - Security 2 10-18-2003 06:22 AM


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

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