Christopher Li wrote:
Here is the update version of the patch.
Looks better ... except that I remembered there's another case to worry about. For short reads, consider:
- host says "give me the whole descriptor, here's a 64KB-1 byte buffer" (16 data TDs). - device says "ok, here you go, 16 bytes" - host should then issue the status phase, not 15 more data stages, unless URB_SHORT_NOT_OK is set. The donelist handling would need to handle that; it's got code to skip the rest of a bulk/intr data stage, but not code to make sure the control status packet is still queued. - Dave
===== devio.c 1.9 vs edited =====
--- 1.9/drivers/usb/devio.c Thu Apr 18 05:34:31 2002
+++ edited/devio.c Wed Feb 5 07:15:23 2003
@@ -800,7 +800,7 @@
return -EINVAL;
}
/* min 8 byte setup packet, max arbitrary */
- if (uurb.buffer_length < 8 || uurb.buffer_length > PAGE_SIZE)
+ if (uurb.buffer_length < 8 || (uurb.buffer_length >> 16))
return -EINVAL;
if (!(dr = kmalloc(sizeof(devrequest), GFP_KERNEL)))
return -ENOMEM;
===== usb-ohci.c 1.23 vs edited =====
--- 1.23/drivers/usb/usb-ohci.c Tue Apr 30 22:58:55 2002
+++ edited/usb-ohci.c Thu Feb 6 13:32:23 2003
@@ -1419,12 +1419,14 @@
urb->setup_packet, 8,
PCI_DMA_TODEVICE),
8, urb, cnt++); - if (data_len > 0) { - info = usb_pipeout (urb->pipe)? - TD_CC | TD_R | TD_DP_OUT | TD_T_DATA1 : TD_CC | TD_R | TD_DP_IN | TD_T_DATA1;
- /* NOTE: mishandles transfers >8K, some >4K */
- td_fill (ohci, info, data, data_len, urb, cnt++); - } + info = usb_pipeout (urb->pipe)? (TD_CC | TD_R | TD_DP_OUT)
+ : (TD_CC | TD_R | TD_DP_IN);
+ while(data_len > 0) {
+ int td_size = min(4096, data_len);
+ td_fill (ohci, info|(cnt==1? TD_T_DATA1:TD_T_TOGGLE),
+ data, td_size, urb, cnt);
+ data += td_size; data_len -= td_size; cnt++;
+ }
info = usb_pipeout (urb->pipe)? TD_CC | TD_DP_IN | TD_T_DATA1: TD_CC | TD_DP_OUT | TD_T_DATA1;
td_fill (ohci, info, data, 0, urb, cnt++);
------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
