ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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).