1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-23 15:12:25 +02:00

Minor potential improvements of USB robustness.

- atrf/fw/atspi/atspi.c (main): add a delay to give the host more time to
- atrf/fw/atspi/descr.c: we don't use EP1, so simplify the descriptors we
  send. Keep the EP1 descriptors around (commented out) in case  we need
  them later, e.g., for interrupts.
This commit is contained in:
Werner Almesberger 2010-08-24 18:31:58 -03:00
parent c01a5e0b7a
commit 8f744bba63
2 changed files with 20 additions and 4 deletions

View File

@ -90,8 +90,16 @@ static void init_io(void)
void main(void) void main(void)
{ {
int i;
init_io(); init_io();
/*
* Make sure the host has enough time (2.5 us) to detect that we reset
* our USB stack.
*/
for (i = 0; i != 10; i++);
usb_init(); usb_init();
ep0_init(); ep0_init();

View File

@ -41,19 +41,22 @@ const uint8_t device_descriptor[18] = {
/* /*
* Our configuration * Our configuration
* *
* While in DFU mode, we're always bus-powered. * We're always bus-powered.
*/ */
const uint8_t config_descriptor[] = { const uint8_t config_descriptor[] = {
9, /* bLength */ 9, /* bLength */
USB_DT_CONFIG, /* bDescriptorType */ USB_DT_CONFIG, /* bDescriptorType */
#if 0
LE(9+9+7+7), /* wTotalLength */ LE(9+9+7+7), /* wTotalLength */
#else
LE(9+9), /* wTotalLength */
#endif
1, /* bNumInterfaces */ 1, /* bNumInterfaces */
1, /* bConfigurationValue (> 0 !) */ 1, /* bConfigurationValue (> 0 !) */
0, /* iConfiguration */ 0, /* iConfiguration */
// USB_ATTR_SELF_POWERED | USB_ATTR_BUS_POWERED,
USB_ATTR_BUS_POWERED, /* bmAttributes */ USB_ATTR_BUS_POWERED, /* bmAttributes */
15, /* bMaxPower */ 50/2, /* bMaxPower (50 mA) */
/* Interface #0 */ /* Interface #0 */
@ -61,12 +64,17 @@ const uint8_t config_descriptor[] = {
USB_DT_INTERFACE, /* bDescriptorType */ USB_DT_INTERFACE, /* bDescriptorType */
0, /* bInterfaceNumber */ 0, /* bInterfaceNumber */
0, /* bAlternateSetting */ 0, /* bAlternateSetting */
#if 0
2, /* bNumEndpoints */ 2, /* bNumEndpoints */
#else
0,
#endif
USB_CLASS_VENDOR_SPEC, /* bInterfaceClass */ USB_CLASS_VENDOR_SPEC, /* bInterfaceClass */
0, /* bInterfaceSubClass */ 0, /* bInterfaceSubClass */
0, /* bInterfaceProtocol */ 0, /* bInterfaceProtocol */
0, /* iInterface */ 0, /* iInterface */
#if 0
/* EP OUT */ /* EP OUT */
7, /* bLength */ 7, /* bLength */
@ -84,5 +92,5 @@ const uint8_t config_descriptor[] = {
0x02, /* bmAttributes (bulk) */ 0x02, /* bmAttributes (bulk) */
LE(EP1_SIZE), /* wMaxPacketSize */ LE(EP1_SIZE), /* wMaxPacketSize */
0, /* bInterval */ 0, /* bInterval */
#endif
}; };