Re: libusb driver question: can't write to endpoint

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Sat, 10 Mar 2007, Phil Dibowitz wrote:

> So I sat down to start seeing if I could write the aforementioned driver for
> the Logitech Harmony remote using libusb. After reading the docs, I whipped
> out the following test code (ok, its mostly a copy and paste of the docs,
> but that's OK) which binds to the interface and attempts to do an interrupt
> transfer to the endpoint.
> 
> But I get: "error submitting URB: Bad address". I've attached the (very
> ugly) code below, but I don't think it's a coding error as much as a not
> understanding error.

Does that error string come from usb_strerror()?  My copy of libusb is
rather old and doesn't seem to include that routine.  It would help to see
the actual error code returned by usb_interrupt_write().

> Looking at lsusb, the device has one Configuration with bConfigurationValue
> 1, and one Interface with bInterfaceNumber 0.

Then why does your program try to claim interface 1?

> Under this interface, it has two endpoints, 0x81, "EP 1 IN", and 0x02, "EP 1
> OUT",

Actually that's EP 2 OUT, not that it matters.

> which I believe, from looking at USB Snoopy dumps, are IN ==>
> device-to-host, and OUT ==> host-to-device. But I've tried my code using
> both endpoints, and get the same error each time.
> 
> The USBSnoopy log shows from windows shows a very simple setup:
> SELECT_CONFIGURATION, CLASS_INTERFACE, GET_DESCRIPTOR_FROM_INTERFACE, and
> then a ton of BULK_OR_INTERRUPT_TRANSFERs. lsusb shows that the devices or
> of transfer type Interrupt.
> 
> Since all the software does is write a blob to the remote (which, after
> looking, turns out to just be XML), this all seems straight forward. It
> doesn't seem like I have to do any special setup...
> 
> The USBSnoopy logs show it writing 64 bytes at a time, so that's what I
> write in my code.

Your timeout value of 2 ms seems rather low.  You might want to increase 
it.

Have you tried setting the usbfs_snoop=1 module parameter for usbcore?  It 
will dump your program's I/O activity to the system log.

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.