- memset(buf, 0, sizeof(buf));
- ret = usb_get_dev_desc(dev, buf, sizeof(buf), dev_desc_size);
- printf("=============\nbuf: 0x%08X\nafter usb control msg(ret: %d):\n", buf, ret);
- hexdump(buf, sizeof(buf));
-
- dev->bDeviceClass = (u8) buf[4];
- dev->bDeviceSubClass = (u8) buf[5];
- dev->bDeviceProtocoll = (u8) buf[6];
- dev->idVendor = (u16) (buf[9] << 8) | (buf[8]);
- dev->idProduct = (u16) (buf[11] << 8) | (buf[10]);
- dev->bcdDevice = (u16) (buf[13] << 8) | (buf[12]);
-
- printf( "bDeviceClass 0x%02X\n"
- "bDeviceSubClass 0x%02X\n"
- "bDeviceProtocoll 0x%02X\n"
- "idVendor 0x%04X\n"
- "idProduct 0x%04X\n"
- "bcdDevice 0x%04X\n", dev->bDeviceClass,
- dev->bDeviceSubClass, dev->bDeviceProtocoll,
- dev->idVendor, dev->idProduct, dev->bcdDevice);
-
- /*
- usb_get_descriptor(dev, DEVICE, 0, buf, 8);
- memset(buf, 0, 8);
- usb_get_descriptor(dev, DEVICE, 0, buf, size >= buf[0] ? buf[0] : size);
- */
-#if 0
- memset(buf, 0, sizeof(buf));
- usb_control_msg(dev, 0x80, GET_DESCRIPTOR, (DEVICE << 8) | 0, 0, 8, buf, 0);
- printf("=============\nbuf: 0x%08X\nafter usb control msg:\n", buf);
- hexdump(buf, sizeof(buf));
-
- memset(buf, 0, sizeof(buf));
- usb_control_msg(dev, 0x80, GET_DESCRIPTOR, (DEVICE << 8) | 0, 0, buf[0], buf, 0);
- printf("=============\nbuf: 0x%08X\nafter usb control msg:\n", buf);
- hexdump(buf, sizeof(buf));
-
- memset(buf, 0, sizeof(buf));
- usb_get_string_simple(dev, 1, buf);
- printf("=============\nbuf: 0x%08X\nafter usb control msg:\n", buf);
- hexdump(buf, sizeof(buf));
-#endif
-
-#if 0
- u8 devdescr_size;
-
- /* 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];
-
- /* define new adress */
- memset(buf, 0, sizeof(buf));
- usb_control_msg(dev, 0x00, SET_ADDRESS, address, 0, 0, buf, 8, 0);
- dev->address = address;
- printf("=============\nbuf: 0x%08X\nafter usb control msg:\n", buf);
- hexdump(buf, sizeof(buf));
- printf("address: %d\n", address);
-
-
- /* get complete device descriptor */
- memset(buf, 0, sizeof(buf));
- 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);
- hexdump(buf, sizeof(buf));
-
- /* save only really neccessary values for this small usbstack */
-#endif
-
-#if 0
- memset(buf, 0, sizeof(buf));
- 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");
- */