It's about time, but here's the ZERO_PACKET patch for uhci.c

It also fixes a bug if you sent a zero length bulk packet to simulate
ZERO_PACKET before support was added.

JE

diff -urNX dontdiff linux-2.4.10-pre10.orig/drivers/usb/uhci.c 
linux-2.4.10-pre10/drivers/usb/uhci.c
--- linux-2.4.10-pre10.orig/drivers/usb/uhci.c  Thu Oct  4 17:21:59 2001
+++ linux-2.4.10-pre10/drivers/usb/uhci.c       Sun Sep 30 16:26:30 2001
@@ -1258,21 +1258,38 @@
                        return -ENOMEM;
 
                uhci_add_td_to_urb(urb, td);
-               uhci_fill_td(td, status, destination | ((pktsze - 1) << 21) |
+               uhci_fill_td(td, status, destination |
+                       (((pktsze - 1) & UHCI_NULL_DATA_SIZE) << 21) |
                        (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
                         usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE),
                        data);
 
                data += pktsze;
-               len -= maxsze;
-
-               if (len <= 0)
-                       td->status |= TD_CTRL_IOC;
+               len -= pktsze;
 
                usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),
                        usb_pipeout(urb->pipe));
        } while (len > 0);
 
+       if (usb_pipeout(urb->pipe) && (urb->transfer_flags & USB_ZERO_PACKET) &&
+          urb->transfer_buffer_length) {
+               td = uhci_alloc_td(uhci, urb->dev);
+               if (!td)
+                       return -ENOMEM;
+
+               uhci_add_td_to_urb(urb, td);
+               uhci_fill_td(td, status, destination | UHCI_NULL_DATA_SIZE |
+                       (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+                        usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE),
+                       data);
+
+               usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+                       usb_pipeout(urb->pipe));
+       }
+
+       /* Set the flag on the last packet */
+       td->status |= TD_CTRL_IOC;
+
        qh = uhci_alloc_qh(uhci, urb->dev);
        if (!qh)
                return -ENOMEM;

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to