On Mon, 25 Mar 2002, Martin Diehl wrote:

> Jean, this solves the host controller processing error - but irda-usb is
> still not happy with it, apparently a number of tx transfers are just
> hanging and the dongle doesn't work. Despite it is working with usb-uhci,

Well, this was due to my patch not really solving the second issue, where
zero-length packets were appended much too often.
With the corrected patch below, irda-usb works for me with uhci really
comparable to usb-uhci.

Johannes/Greg, if you would like to take this, the changelog should read:

making uhci sending requested additional zero-length packet:
        * only when transfer size is multiple of packet size
        * with the corresponding TD's maxlen field set right

Martin

--------------------

--- linux-2.5.7/drivers/usb/uhci.c      Sun Mar 10 03:45:21 2002
+++ v2.5.7-md/drivers/usb/uhci.c        Mon Mar 25 08:21:22 2002
@@ -1223,6 +1223,7 @@
        unsigned long destination, status;
        struct uhci *uhci = (struct uhci *)urb->dev->bus->hcpriv;
        int maxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));
+       int pktsze;
        int len = urb->transfer_buffer_length;
        struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
        dma_addr_t data = urbp->transfer_buffer_dma_handle;
@@ -1247,7 +1248,7 @@
         * Build the DATA TD's
         */
        do {    /* Allow zero length packets */
-               int pktsze = len;
+               pktsze = len;
 
                if (pktsze > maxsze)
                        pktsze = maxsze;
@@ -1270,14 +1271,20 @@
                        usb_pipeout(urb->pipe));
        } while (len > 0);
 
-       if (usb_pipeout(urb->pipe) && (urb->transfer_flags & USB_ZERO_PACKET) &&
-          urb->transfer_buffer_length) {
+       /* USB_ZERO_PACKET means adding a 0-length packet, if
+        * direction is OUT and the transfer_length was an
+        * exact multiple of maxsze, hence pktsze==maxsze for
+        * last non-zero packet - which also excludes the case
+        * where transfer_buffer_length==0 (already handled above)
+        */
+       if ((urb->transfer_flags&USB_ZERO_PACKET) && usb_pipeout(urb->pipe)
+           && pktsze==maxsze) {
                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 |
+               uhci_fill_td(td, status, destination | (UHCI_NULL_DATA_SIZE<<21) |
                        (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
                         usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE),
                        data);


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

Reply via email to