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

Phil Dibowitz <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Thomas Sailer wrote:
> On Sat, 2007-03-10 at 15:39 -0800, Phil Dibowitz wrote:
>>         while (bytes = read((int)fh, buf, SIZE)) {
>>                 printf("writing %d bytes (%d)\n",SIZE,++i);
>>                 if (usb_interrupt_write(udev, OUT_EP, buf, bytes, 2) < 0) {
> 
> read can return -1, at which point you stuff -1 into
> usb_interrupt_write, which likely interprets the length as an unsigned
> quantity, causing EFAULT.

Doh! That was exactly it. That'll teach me to not worry about error checking
"just because it's a test program" :) I was accidentally mixing fopen/read
instead of open and read. Thanks for catching that.

Sadly, I'm only slightly further. I have two files that generally get
transfered to the device:

  Connectivity.EZHex - this is a 'connectivity test' to transfer to the
     device
  Test.EZHex - this is a config blob for the remote.

The site always downloads the Connectivity one first, waits for confirmation
the windows/mac software was able to confirm communication, and then
downloads your config. The software uploads it, reboots the device, and done.

Anyway, Connectivity.EZHex is 3.5K and Test.EZHex is 716K.

But when I transfer 64 bytes at a time, on Connectivity.EZHex, I get 19
successful transfers (~1.2k) and the 20th gives me an error of -110, or "No
error" (the read was successful).

On Test.EZHex, I only get to the 12th transfer before I get -110, No error
(~7k).

So clearly something is going wrong... and I was rather determined to
troubleshoot awhile before asking... but "no error" really doesn't give me
much to go on. Amazingly, these interrupted transfers have not broken,
confused, or otherwise harmed my device!

-- 
Phil Dibowitz                             [email protected]
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming

-------------------------------------------------------------------------
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
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF8+rPN5XoxaHnMrsRAgUKAKCdiF5WSXNMZtQUD4MoQ+k9tnzy/wCfSvxM
2O+EIb6rmrWmSlxl4PJ/TNc=
=5eTz
-----END PGP SIGNATURE-----
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.