Are you sure that the device supports only reading one byte back?  Many
devices are broken and will bus-babble or otherwise do bad things under
these conditions.  In general, you have to be careful when reading less
than a full packet of data.

Matt

On Sun, Sep 23, 2001 at 01:03:48PM +0200, Gilad Bornstein wrote:
> When ever I'm trying to read from a bulk end-point fewer bytes then the 
> ones which are available I get a broken-pipe signal.
> My program is something like:
> 
> fd = open("/proc/bus/usb/001/007",O_RDWR);
> int interface = 0;
> ret = ioctl(fd, USBDEVFS_CLAIMINTERFACE, &interface);
> 
> // Write something to the write end-point
> // .
> // .
> // .
> 
> // Read the response
> struct usbdevfs_bulktransfer bulk;
> char buf[255];
> bulk.ep = 0x8a;
> bulk.len = 1;
> bulk.timeout = 500;
> bulk.data= (void*)&buf;
> int ret = ioctl(fd,USBDEVFS_BULK,&bulk);
> 
> Since there are 10 bytes waiting for me in the buffer, I get a broken-pipe 
> error message. If I change the bulk.len line to be >=10 then it works fine. 
> What should I do in-order to support "short" reads?
> 
> Thanks,
>       
> -- Gilad
> 
> 
> _______________________________________________
> [EMAIL PROTECTED]
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

It was a new hope.
                                        -- Dust Puppy
User Friendly, 12/25/1998

PGP signature

Reply via email to