On Tue, 1 Feb 2005, Marco Schramel wrote: > Hi all, > > my device has 2 bulk and 2 isochron endpoints. > > T: Bus=04 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 3 Spd=12 MxCh= 0 > D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 > P: Vendor=0471 ProdID=0168 Rev= 1.00 > C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA > I: If#= 0 Alt= 0 #EPs= 0 Cls=00(>ifc ) Sub=00 Prot=00 Driver=(none) > I: If#= 0 Alt= 1 #EPs= 4 Cls=00(>ifc ) Sub=00 Prot=00 Driver=(none) > E: Ad=03(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms > E: Ad=84(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms > E: Ad=05(O) Atr=01(Isoc) MxPS= 512 Ivl=1ms > E: Ad=86(I) Atr=01(Isoc) MxPS= 512 Ivl=1ms > > > I try to send data in bulk out endpoint. The write is always successfull. But > i cant read out. I always get a timeout message. > How i can setup a read of a enpoint which address is 84 on interface 0 > altsetting 1 ? > > /retval = usb_bulk_msg (dev->udev, > usb_rcvbulkpipe (dev->udev, > dev->bulk_in_endpointAddr), > dev->bulk_in_buffer, dev->bulk_in_size, > &count, 10000); > > This code fails.
Using 10000 as a timeout isn't a good idea; you should use some multiple of HZ (like 10*HZ) instead. Otherwise the length of the timeout will be different on systems where HZ isn't what you assumed it was. However that alone wouldn't case your problem, and everything else above looks right. Assuming all the fields in your dev structure are set correctly, the most likely explanation is that the code _doesn't_ fail. It succeeds -- but it only succeeds in giving you -ETIMEDOUT, because the device hasn't sent any data! In other words, the device probably doesn't have any data to send. On Tue, 1 Feb 2005 [EMAIL PROTECTED] wrote: > Hi, > > Try to use FILL_BULK to initialize read bulk I've never heard of FILL_BULK, but whatever it is, it isn't necessary. > and give size as exactly as the size of bulk in endpoint packet size. The size does _not_ need to be exactly the same as the endpoint packet size. It can be smaller or larger; it doesn't matter. However, it should not be smaller than the amount of data you expect the device to send. > Make sure that your read call back function is recursive it should > always keep reading from the device. usb_bulk_msg doesn't take a "call back" function, recursive or otherwise. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
