various changes, see difflog for details!
[ppcskel.git] / usb / core / core.c
index 1f7baf40dab1632a3907cdd6117caae3070c6e93..b1d04743e5c77078dfb3b6b6a68e5d303ae3ccc9 100644 (file)
@@ -100,17 +100,35 @@ usb_device *usb_add_device()
        dev->epTogl[2] = 0;
 
        char buf[64];
-       u8 devdescr_size;
-       u8 address = usb_next_address();
+       memset(buf, 0, sizeof(buf));
 
        /* ask first 8 bytes of device descriptor with this special 
         * GET Descriptor Request, when device address = 0
         */
-       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, 1, 0, 64, buf, 8, 0);
+
+       /*
+        * see page 253 in usb_20.pdf
+        * 
+        * bmRequestType = 0x80 = 10000000B
+        * bRequest = GET_DESCRIPTOR
+        * wValue = DEVICE (Descriptor Type)
+        * wIndex = 0
+        * wLength = 8 (in Bytes!?)
+        */
+       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE, 0, 8, buf, 8, 0);
+
+       /* 
+        * length (here =64) should be "number of byte to transfer", not 
+        * (as here) "number of bits to transfer.
+        * ?
+        */
+       //usb_control_msg(dev, 0x80, GET_DESCRIPTOR, 1, 0, 64, buf, 8, 0);
        printf("===========\nafter usb control msg:\n");
        hexdump(buf, sizeof(buf));
 
 #if 0
+       u8 devdescr_size;
+       u8 address = usb_next_address();
        dev->bMaxPacketSize0 = (u8) buf[7] ? (u8) buf[7] : 1; //dirty?  /* setup real ep0 fifo size */
        devdescr_size = (u8) buf[0];    /* save real length of device descriptor */