discoverd weird endianness bug in sauter's usport. fixed
authorBernhard Urban <lewurm@gmx.net>
Sun, 20 Sep 2009 00:35:11 +0000 (02:35 +0200)
committerBernhard Urban <lewurm@gmx.net>
Sun, 20 Sep 2009 00:42:57 +0000 (02:42 +0200)
usb/core/core.c
usb/host/ohci.c

index 789e36e96b2f443bd7c89e7b90af4ec8ebc82b58..10f9e5d34dcb9e4d5d8c1c1114b92f5c60846c6d 100644 (file)
@@ -114,10 +114,9 @@ usb_device *usb_add_device()
         * bRequest = GET_DESCRIPTOR
         * wValue = DEVICE (Descriptor Type)
         * wIndex = 0
-        * wLength = 8 (in Bytes!?)
+        * wLength = 64 // in fact just 8 bytes
         */
-       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE << 8, 0, 8, buf, 8, 0);
-       //usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE, 0, 64, buf, 8, 0);
+       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE << 8, 0, 64, buf, 8, 0);
 
        printf("===========\nafter usb control msg:\n");
        hexdump(buf, sizeof(buf));
@@ -346,7 +345,7 @@ u16 usb_submit_irp(usb_irp *irp)
                                /* wenn device descriptor von adresse 0 angefragt wird werden nur
                                 * die ersten 8 byte abgefragt
                                 */
-                               if (setup->bRequest == GET_DESCRIPTOR && (setup->wValue >> 8) == 1
+                               if (setup->bRequest == GET_DESCRIPTOR && (setup->wValue & 0xff) == 1
                                                && td->devaddress == 0) {
                                        runloop = 0;                                    /* stop loop */
                                }
index 840a27e0b0fa844b0570e36a71aaa147ad40245a..77a21b97e8ff0217085d77a167891791d6482cb2 100644 (file)
@@ -221,16 +221,28 @@ u8 hcdi_enqueue(usb_transfer_descriptor *td) {
                        printf("pid_setup\n");
                        tmptd->flags |= ACCESS_LE(OHCI_TD_DIRECTION_PID_SETUP);
                        tmptd->flags |= ACCESS_LE(OHCI_TD_TOGGLE_0);
+                       tmptd->flags |= ACCESS_LE(OHCI_TD_BUFFER_ROUNDING);
                        break;
                case USB_PID_OUT:
                        printf("pid_out\n");
                        tmptd->flags |= ACCESS_LE(OHCI_TD_DIRECTION_PID_OUT);
+                       tmptd->flags |= ACCESS_LE(OHCI_TD_BUFFER_ROUNDING);
+
+                       /*
+                        * TODO: just temporary solution!
+                        * there can be also regular PID_OUT pakets
+                        */
                        tmptd->flags |= ACCESS_LE(OHCI_TD_TOGGLE_1);
                        break;
                case USB_PID_IN:
                        printf("pid_in\n");
                        tmptd->flags |= ACCESS_LE(OHCI_TD_DIRECTION_PID_IN);
-                       /* let the endpoint do the togglestuff! */
+                       tmptd->flags |= ACCESS_LE(OHCI_TD_BUFFER_ROUNDING);
+                       /*
+                        * let the endpoint do the togglestuff!
+                        * TODO: just temporary solution!
+                        * there can be also inregular PID_IN pakets (@Status Stage)
+                        */
                        tmptd->flags |= ACCESS_LE(OHCI_TD_TOGGLE_CARRY);
 #if 0
                        /* should be done by HC!
@@ -242,7 +254,7 @@ u8 hcdi_enqueue(usb_transfer_descriptor *td) {
 #endif
                        break;
        }
-       tmptd->flags |= ACCESS_LE(OHCI_TD_SET_DELAY_INTERRUPT(7) | OHCI_TD_BUFFER_ROUNDING);
+       tmptd->flags |= ACCESS_LE(OHCI_TD_SET_DELAY_INTERRUPT(7));
 
        printf("tmptd hexdump (before) 0x%08X:\n", tmptd);
        hexdump(tmptd, sizeof(struct general_td));