Hi Dave and Jean,

did some investigation into the "irda-usb doesn't work with ohci-hcd"
issue. Symptoms are on one hand the outgoing irda-packets get transmitted
(but corrupted) by the OHCI-HC and on the other hand the urb's are staying
queued without ever getting unlinked (but callback called).

Finally, it turned out the decision when to append a length=0 usb-packet
is partly done just the wrong way.

The patch below does
        * append length=0 packet in the correct situation only,
          i.e. basically when (length%maxpacketsize)==0
        * make USB_ZERO_PACKET only effective on OUT transaction, because
          it's useless for IN and uhci is restricted to out as well.

Testing with 2.5.24 and irda-usb demonstrates things are working again.

Martin

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

diff -ur linux-2.5.24/drivers/usb/host/ohci-hcd.c 
v2.5.24-md/drivers/usb/host/ohci-hcd.c
--- linux-2.5.24/drivers/usb/host/ohci-hcd.c    Sun Jul  7 18:45:12 2002
+++ v2.5.24-md/drivers/usb/host/ohci-hcd.c      Tue Jul  9 16:18:11 2002
@@ -164,11 +164,13 @@
                        /* ... and maybe a zero length packet to wrap it up */
                        if (size == 0)
                                size++;
-                       else if ((urb->transfer_flags & USB_ZERO_PACKET) != 0
-                               && (urb->transfer_buffer_length
-                                       % usb_maxpacket (urb->dev, pipe,
-                                               usb_pipeout (pipe))) != 0)
-                               size++;
+                       else if ((urb->transfer_flags & USB_ZERO_PACKET) != 0) {
+                               size_t maxp;
+
+                               maxp = usb_maxpacket(urb->dev,pipe,usb_pipeout(pipe));
+                               if (usb_pipeout(pipe) && 
+(urb->transfer_buffer_length%maxp) == 0)
+                                       size++;
+                       }
                        break;
                case PIPE_ISOCHRONOUS: /* number of packets from URB */
                        size = urb->number_of_packets;
diff -ur linux-2.5.24/drivers/usb/host/ohci-q.c v2.5.24-md/drivers/usb/host/ohci-q.c
--- linux-2.5.24/drivers/usb/host/ohci-q.c      Fri Jun 21 23:17:21 2002
+++ v2.5.24-md/drivers/usb/host/ohci-q.c        Tue Jul  9 16:19:39 2002
@@ -640,7 +640,7 @@
                                data, data_len, urb, cnt);
                        cnt++;
                        if ((urb->transfer_flags & USB_ZERO_PACKET)
-                                       && cnt < urb_priv->length) {
+                               && usb_pipeout(urb->pipe) && cnt < urb_priv->length) {
                                td_fill (ohci, info | (cnt? TD_T_TOGGLE:toggle),
                                        0, 0, urb, cnt);
                                cnt++;




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to