@get_descriptor|String: disable control quirk *sigh* and keep in mind to do not reque...
[ppcskel.git] / usb / core / core.c
index f3924c418e3db77ff78502cda119f7786bd8d6f7..d54b515e868bfc5f4bdb4deedf5c0f374b1733fc 100644 (file)
@@ -127,6 +127,10 @@ usb_device *usb_add_device()
 
        /* setup real ep0 fifo size */
        dev->bMaxPacketSize0 = (u8) buf[7];
+       if(!(u8)buf[7]) {
+               printf("FU\n");
+               return (void*)1;
+       }
 
        /* save real length of device descriptor */
        devdescr_size = (u8) buf[0];
@@ -140,6 +144,7 @@ usb_device *usb_add_device()
 
 
        /* get complete device descriptor */
+       memset(buf, 0, 64);
        usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE<<8, 0, devdescr_size, buf, 8, 0);
 
        printf("=============\nbuf: 0x%08X\nafter usb control msg:\n", buf);
@@ -161,14 +166,25 @@ usb_device *usb_add_device()
                        "bcdDevice 0x%04X\n", dev->bDeviceClass, 
                        dev->bDeviceSubClass, dev->bDeviceProtocoll,
                        dev->idVendor, dev->idProduct, dev->bcdDevice);
-       /* for lewurms keyboard it should be:
-        * bDeviceClass                 0
-        * bDeviceSubClass              0
-        * bDeviceClass                 0
-        * idVendor                                             0x049f
-        * idProduct                                    0x000e
-        * bcdDevice                                            1.00
-        */
+
+#if 1
+       memset(buf, 0, 64);
+       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, (STRING<<8)|2, 0, 0x1a, buf, 8, 0);
+       hexdump(buf, sizeof(buf));
+       printf("String Descriptor [1]: ");
+       u8 i;
+       for (i=2; i<buf[0]; i+=2)
+               printf("%c", buf[i]);
+       printf("\n");
+#endif
+
+       /*
+       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, (STRING<<8) | 2, 0, 0x20, buf, 8, 0);
+       printf("String Descriptor [2]: ");
+       for (i=2; i<buf[0]; i+=2)
+               printf("%c", buf[i]);
+       printf("\n");
+       */
 
        // string descriptoren werden nicht im arbeitsspeicher gehalten -> on demand mit 
        // entprechenden funktionen
@@ -325,7 +341,8 @@ u16 usb_submit_irp(usb_irp *irp)
                /* check bit 7 of bmRequestType */
                if (bmRequestType & 0x80) { 
                        /* schleife die die tds generiert */
-                       while (runloop || (restlength < 1)) {
+                       while (runloop && (restlength > 0)) {
+                               printf("restlength: %d\t irp->epsize: %d\n", restlength, irp->epsize);
                                td = usb_create_transfer_descriptor(irp);
                                td->actlen = irp->epsize;
                                /* stop loop if all bytes are send */