On Fri, 14 Nov 2003, ron ta�eza wrote: > Hi, > > I'm using v2.4.18 (Slackware 8.1) and usb-uhci.
You should consider moving to a more recent kernel. > I have some questions about URBs. These are pretty basic, but I'm very new to > Linux and device drivers, and I can't find these info in urb.txt, or in this > list (does the list have a search function)? Yes, although it's not great. Look at http://sourceforge.net/mailarchive/forum.php?forum=linux-usb-devel > 1. I'd like to write some data to the bulk out endpoint. If wMaxPacketSize is > 64, and I'd like to write, say, 200 bytes, can I just set the urb's > buffer_length to 200? Does the USB core automatically segment the data to 64- > byte chunks? Yes. > 2. Is the same with interrupt out? Yes. > 3. I'd like to read some data from the bulk in endpoint. If I submit an URB > with a buffer size of 2000 bytes, how much data do I get every time my complete > function is called? I'm assuming it's every time the USB core receives a > bulk "packet" (max of 64 bytes = bulk in endpoint's wMaxPacketSize), and NOT > when the buffer has accumulated 2000 bytes.. Is this correct? Your guess is wrong. You will get 2000 bytes or the amount accumulated when a short packet (< wMaxPacketSize) is received, whichever comes first. > 4. Same question as 3, this time with interrupt in. If wMaxPacketSize for the > interrupt in endpoint is 8 bytes, does my interrupt complete function get > called every time an interrupt "packet" is received (even if I specify, say, a > 2000-byte buffer)? I believe that interrupt pipes work the same as bulk pipes in this regard. > I also have a question on the USB specs. What's the difference between data0 > and data1? I read something that data0 is even, and data1 is odd.. what does > this mean? It's a technique used for verifying that packets have been received correctly. Here's how it works for IN transfers. Normally the host will alternate sending DATA0 and DATA1 PIDs to the device. But if a packet is lost for some reason, the host will retry using the same PID as before. So when the device receives two DATA0 PIDs in a row, for example, it knows to resend the data from the previous packet because the first attempt wasn't received correctly. It's much the same for OUT transfers. The host normally alternates between DATA0 and DATA1 PIDs. But if it doesn't receive an ACK from the device, it will resend the previous packet using the same PID over again. So when the device receives two DATA1 PIDs in a row, for example, it knows to ignore the second packet because it's a repeat of the one received just before. Alan Stern ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
