more generalization of the dbg() diagnostic message prints
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -56,13 +56,13 @@
|
|||||||
extern int usb_stor_curr_dev;
|
extern int usb_stor_curr_dev;
|
||||||
extern uint32_t usb_1st_disk_drive;
|
extern uint32_t usb_1st_disk_drive;
|
||||||
|
|
||||||
//#define USB_DEBUG
|
#define DEBUG_USB
|
||||||
|
#ifdef DEBUG_USB
|
||||||
#ifdef USB_DEBUG
|
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
|
||||||
#define debug_printf(fmt, args...) xprintf(fmt , ##args)
|
|
||||||
#else
|
#else
|
||||||
#define debug_printf(fmt, args...)
|
#define dbg(format, arg...) do { ; } while (0)
|
||||||
#endif
|
#endif /* DEBUG_USB */
|
||||||
|
|
||||||
|
|
||||||
#define USB_BUFSIZ 512
|
#define USB_BUFSIZ 512
|
||||||
|
|
||||||
@@ -157,20 +157,20 @@ int usb_init(int32_t handle, const struct pci_device_id *ent)
|
|||||||
usb_hub_reset(bus_index);
|
usb_hub_reset(bus_index);
|
||||||
|
|
||||||
/* init low_level USB */
|
/* init low_level USB */
|
||||||
debug_printf("USB: ");
|
dbg("USB: ");
|
||||||
|
|
||||||
switch(ent->class)
|
switch(ent->class)
|
||||||
{
|
{
|
||||||
case PCI_CLASS_SERIAL_USB_UHCI:
|
case PCI_CLASS_SERIAL_USB_UHCI:
|
||||||
//res = uhci_usb_lowlevel_init(handle, ent, &priv);
|
//res = uhci_usb_lowlevel_init(handle, ent, &priv);
|
||||||
debug_printf("sorry, no uhci driver available\r\n");
|
dbg("sorry, no uhci driver available\r\n");
|
||||||
break;
|
break;
|
||||||
case PCI_CLASS_SERIAL_USB_OHCI:
|
case PCI_CLASS_SERIAL_USB_OHCI:
|
||||||
debug_printf("initialize ohci interface\r\n");
|
dbg("initialize ohci interface\r\n");
|
||||||
res = ohci_usb_lowlevel_init(handle, ent, &priv);
|
res = ohci_usb_lowlevel_init(handle, ent, &priv);
|
||||||
break;
|
break;
|
||||||
case PCI_CLASS_SERIAL_USB_EHCI:
|
case PCI_CLASS_SERIAL_USB_EHCI:
|
||||||
debug_printf("initialize ehci interface\r\n");
|
dbg("initialize ehci interface\r\n");
|
||||||
res = ehci_usb_lowlevel_init(handle, ent, &priv);
|
res = ehci_usb_lowlevel_init(handle, ent, &priv);
|
||||||
break;
|
break;
|
||||||
default: res = -1; break;
|
default: res = -1; break;
|
||||||
@@ -315,7 +315,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
|
|||||||
setup_packet->value = swpw(value);
|
setup_packet->value = swpw(value);
|
||||||
setup_packet->index = swpw(index);
|
setup_packet->index = swpw(index);
|
||||||
setup_packet->length = swpw(size);
|
setup_packet->length = swpw(size);
|
||||||
debug_printf("usb_control_msg: request: 0x%X, requesttype: 0x%X, value 0x%X index 0x%X length 0x%X\r\n", request, requesttype, value, index, size);
|
dbg("usb_control_msg: request: 0x%X, requesttype: 0x%X, value 0x%X index 0x%X length 0x%X\r\n", request, requesttype, value, index, size);
|
||||||
switch(priv->ent->class)
|
switch(priv->ent->class)
|
||||||
{
|
{
|
||||||
case PCI_CLASS_SERIAL_USB_OHCI:
|
case PCI_CLASS_SERIAL_USB_OHCI:
|
||||||
@@ -414,7 +414,7 @@ static void __attribute__((noinline))usb_set_maxpacket_ep(struct usb_device *dev
|
|||||||
/* Control => bidirectional */
|
/* Control => bidirectional */
|
||||||
dev->epmaxpacketout[b] = ep->wMaxPacketSize;
|
dev->epmaxpacketout[b] = ep->wMaxPacketSize;
|
||||||
dev->epmaxpacketin[b] = ep->wMaxPacketSize;
|
dev->epmaxpacketin[b] = ep->wMaxPacketSize;
|
||||||
debug_printf("##Control EP epmaxpacketout/in[%d] = %d\r\n", b, dev->epmaxpacketin[b]);
|
dbg("##Control EP epmaxpacketout/in[%d] = %d\r\n", b, dev->epmaxpacketin[b]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -424,7 +424,7 @@ static void __attribute__((noinline))usb_set_maxpacket_ep(struct usb_device *dev
|
|||||||
if (ep->wMaxPacketSize > dev->epmaxpacketout[b])
|
if (ep->wMaxPacketSize > dev->epmaxpacketout[b])
|
||||||
{
|
{
|
||||||
dev->epmaxpacketout[b] = ep->wMaxPacketSize;
|
dev->epmaxpacketout[b] = ep->wMaxPacketSize;
|
||||||
debug_printf("##EP epmaxpacketout[%d] = %d\r\n", b, dev->epmaxpacketout[b]);
|
dbg("##EP epmaxpacketout[%d] = %d\r\n", b, dev->epmaxpacketout[b]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -433,7 +433,7 @@ static void __attribute__((noinline))usb_set_maxpacket_ep(struct usb_device *dev
|
|||||||
if (ep->wMaxPacketSize > dev->epmaxpacketin[b])
|
if (ep->wMaxPacketSize > dev->epmaxpacketin[b])
|
||||||
{
|
{
|
||||||
dev->epmaxpacketin[b] = ep->wMaxPacketSize;
|
dev->epmaxpacketin[b] = ep->wMaxPacketSize;
|
||||||
debug_printf("##EP epmaxpacketin[%d] = %d\r\n", b, dev->epmaxpacketin[b]);
|
dbg("##EP epmaxpacketin[%d] = %d\r\n", b, dev->epmaxpacketin[b]);
|
||||||
}
|
}
|
||||||
} /* if out */
|
} /* if out */
|
||||||
} /* if control */
|
} /* if control */
|
||||||
@@ -467,7 +467,7 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|||||||
head = (struct usb_descriptor_header *)&buffer[0];
|
head = (struct usb_descriptor_header *)&buffer[0];
|
||||||
if (head->bDescriptorType != USB_DT_CONFIG)
|
if (head->bDescriptorType != USB_DT_CONFIG)
|
||||||
{
|
{
|
||||||
debug_printf(" ERROR: NOT USB_CONFIG_DESC %x\r\n", head->bDescriptorType);
|
dbg(" ERROR: NOT USB_CONFIG_DESC %x\r\n", head->bDescriptorType);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(&dev->config, buffer, buffer[0]);
|
memcpy(&dev->config, buffer, buffer[0]);
|
||||||
@@ -504,12 +504,12 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|||||||
dev->config.if_desc[ifno].no_of_ep++;
|
dev->config.if_desc[ifno].no_of_ep++;
|
||||||
memcpy(&dev->config.if_desc[ifno].ep_desc[epno], &buffer[index], buffer[index]);
|
memcpy(&dev->config.if_desc[ifno].ep_desc[epno], &buffer[index], buffer[index]);
|
||||||
dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize = swpw(dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize);
|
dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize = swpw(dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize);
|
||||||
debug_printf("if %d, ep %d\r\n", ifno, epno);
|
dbg("if %d, ep %d\r\n", ifno, epno);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (head->bLength == 0)
|
if (head->bLength == 0)
|
||||||
return 1;
|
return 1;
|
||||||
debug_printf("unknown Description Type : %x\r\n", head->bDescriptorType);
|
dbg("unknown Description Type : %x\r\n", head->bDescriptorType);
|
||||||
#ifdef USB_DEBUG
|
#ifdef USB_DEBUG
|
||||||
{
|
{
|
||||||
unsigned char *ch;
|
unsigned char *ch;
|
||||||
@@ -517,8 +517,8 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|||||||
|
|
||||||
ch = (unsigned char *)head;
|
ch = (unsigned char *)head;
|
||||||
for (i = 0; i < head->bLength; i++)
|
for (i = 0; i < head->bLength; i++)
|
||||||
debug_printf(" %02X", *ch++);
|
dbg(" %02X", *ch++);
|
||||||
debug_printf("\r\n");
|
dbg("\r\n");
|
||||||
}
|
}
|
||||||
#endif /* USB_DEBUG */
|
#endif /* USB_DEBUG */
|
||||||
break;
|
break;
|
||||||
@@ -577,19 +577,19 @@ int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer, int
|
|||||||
if (result < 9)
|
if (result < 9)
|
||||||
{
|
{
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
debug_printf("unable to get descriptor, error %lX\r\n", dev->status);
|
dbg("unable to get descriptor, error %lX\r\n", dev->status);
|
||||||
else
|
else
|
||||||
debug_printf("config descriptor too short (expected %i, got %i)\n", 9, result);
|
dbg("config descriptor too short (expected %i, got %i)\n", 9, result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tmp = swpw(config->wTotalLength);
|
tmp = swpw(config->wTotalLength);
|
||||||
if (tmp > USB_BUFSIZ)
|
if (tmp > USB_BUFSIZ)
|
||||||
{
|
{
|
||||||
debug_printf("usb_get_configuration_no: failed to get descriptor - too long: %d\r\n", tmp);
|
dbg("usb_get_configuration_no: failed to get descriptor - too long: %d\r\n", tmp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, tmp);
|
result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, tmp);
|
||||||
debug_printf("get_conf_no %d Result %d, wLength %d\r\n", cfgno, result, tmp);
|
dbg("get_conf_no %d Result %d, wLength %d\r\n", cfgno, result, tmp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +600,7 @@ int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer, int
|
|||||||
int usb_set_address(struct usb_device *dev)
|
int usb_set_address(struct usb_device *dev)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
debug_printf("set address %d\r\n", dev->devnum);
|
dbg("set address %d\r\n", dev->devnum);
|
||||||
res = usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS, 0, (dev->devnum), 0, NULL, 0, USB_CNTL_TIMEOUT);
|
res = usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS, 0, (dev->devnum), 0, NULL, 0, USB_CNTL_TIMEOUT);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -622,7 +622,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
|
|||||||
}
|
}
|
||||||
if (!if_face)
|
if (!if_face)
|
||||||
{
|
{
|
||||||
debug_printf("selecting invalid interface %d", interface);
|
dbg("selecting invalid interface %d", interface);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -647,7 +647,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
|
|||||||
int usb_set_configuration(struct usb_device *dev, int configuration)
|
int usb_set_configuration(struct usb_device *dev, int configuration)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
debug_printf("set configuration %d\r\n", configuration);
|
dbg("set configuration %d\r\n", configuration);
|
||||||
/* set setup command */
|
/* set setup command */
|
||||||
res = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
res = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
||||||
USB_REQ_SET_CONFIGURATION, 0, configuration, 0, NULL, 0, USB_CNTL_TIMEOUT);
|
USB_REQ_SET_CONFIGURATION, 0, configuration, 0, NULL, 0, USB_CNTL_TIMEOUT);
|
||||||
@@ -781,7 +781,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
|
|||||||
tbuf = (unsigned char *)driver_mem_alloc(USB_BUFSIZ);
|
tbuf = (unsigned char *)driver_mem_alloc(USB_BUFSIZ);
|
||||||
if (tbuf == NULL)
|
if (tbuf == NULL)
|
||||||
{
|
{
|
||||||
debug_printf("usb_string: malloc failure\r\n");
|
dbg("usb_string: malloc failure\r\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* get langid for strings if it's not yet known */
|
/* get langid for strings if it's not yet known */
|
||||||
@@ -790,13 +790,13 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
|
|||||||
err = usb_string_sub(dev, 0, 0, tbuf);
|
err = usb_string_sub(dev, 0, 0, tbuf);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
debug_printf("error getting string descriptor 0 (error=%lx)\r\n", dev->status);
|
dbg("error getting string descriptor 0 (error=%lx)\r\n", dev->status);
|
||||||
driver_mem_free(tbuf);
|
driver_mem_free(tbuf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (tbuf[0] < 4)
|
else if (tbuf[0] < 4)
|
||||||
{
|
{
|
||||||
debug_printf("string descriptor 0 too short\r\n");
|
dbg("string descriptor 0 too short\r\n");
|
||||||
driver_mem_free(tbuf);
|
driver_mem_free(tbuf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -805,7 +805,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
|
|||||||
dev->have_langid = -1;
|
dev->have_langid = -1;
|
||||||
dev->string_langid = tbuf[2] | (tbuf[3] << 8);
|
dev->string_langid = tbuf[2] | (tbuf[3] << 8);
|
||||||
/* always use the first langid listed */
|
/* always use the first langid listed */
|
||||||
debug_printf("USB device number %d default language ID 0x%x\r\n", dev->devnum, dev->string_langid);
|
dbg("USB device number %d default language ID 0x%x\r\n", dev->devnum, dev->string_langid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = usb_string_sub(dev, dev->string_langid, index, tbuf);
|
err = usb_string_sub(dev, dev->string_langid, index, tbuf);
|
||||||
@@ -844,8 +844,8 @@ void usb_disconnect(struct usb_device **pdev)
|
|||||||
if (dev != NULL)
|
if (dev != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
debug_printf("USB %d disconnect on device %d\r\n", dev->parent->usbnum, dev->parent->devnum);
|
dbg("USB %d disconnect on device %d\r\n", dev->parent->usbnum, dev->parent->devnum);
|
||||||
debug_printf("USB %d disconnected, device number %d\r\n", dev->usbnum, dev->devnum);
|
dbg("USB %d disconnected, device number %d\r\n", dev->usbnum, dev->devnum);
|
||||||
if (dev->deregister != NULL)
|
if (dev->deregister != NULL)
|
||||||
dev->deregister(dev);
|
dev->deregister(dev);
|
||||||
/* Free up all the children.. */
|
/* Free up all the children.. */
|
||||||
@@ -853,7 +853,7 @@ void usb_disconnect(struct usb_device **pdev)
|
|||||||
{
|
{
|
||||||
if (dev->children[i] != NULL)
|
if (dev->children[i] != NULL)
|
||||||
{
|
{
|
||||||
debug_printf("USB %d, disconnect children %d\r\n", dev->usbnum, dev->children[i]->devnum);
|
dbg("USB %d, disconnect children %d\r\n", dev->usbnum, dev->children[i]->devnum);
|
||||||
usb_disconnect(&dev->children[i]);
|
usb_disconnect(&dev->children[i]);
|
||||||
dev->children[i] = NULL;
|
dev->children[i] = NULL;
|
||||||
}
|
}
|
||||||
@@ -889,24 +889,28 @@ struct usb_device *usb_get_dev_index(int index, int index_bus)
|
|||||||
*/
|
*/
|
||||||
struct usb_device *usb_alloc_new_device(int bus_index, void *priv)
|
struct usb_device *usb_alloc_new_device(int bus_index, void *priv)
|
||||||
{
|
{
|
||||||
int i, index = dev_index[bus_index];
|
int i;
|
||||||
|
int index = dev_index[bus_index];
|
||||||
struct usb_device *dev;
|
struct usb_device *dev;
|
||||||
|
|
||||||
debug_printf("USB %d new device %d\r\n", bus_index, index);
|
dbg("USB %d new device %d\r\n", bus_index, index);
|
||||||
if (index >= USB_MAX_DEVICE)
|
if (index >= USB_MAX_DEVICE)
|
||||||
{
|
{
|
||||||
debug_printf("ERROR, too many USB Devices, max=%d\r\n", USB_MAX_DEVICE);
|
dbg("ERROR, too many USB Devices, max=%d\r\n", USB_MAX_DEVICE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* default Address is 0, real addresses start with 1 */
|
/* default Address is 0, real addresses start with 1 */
|
||||||
dev = &usb_dev[(bus_index * USB_MAX_DEVICE) + index];
|
dev = &usb_dev[(bus_index * USB_MAX_DEVICE) + index];
|
||||||
dev->devnum = index + 1;
|
dev->devnum = index + 1;
|
||||||
dev->maxchild = 0;
|
dev->maxchild = 0;
|
||||||
for (i = 0; i < USB_MAXCHILDREN; dev->children[i++] = NULL);
|
for (i = 0; i < USB_MAXCHILDREN; dev->children[i++] = NULL)
|
||||||
|
;
|
||||||
|
|
||||||
dev->parent = NULL;
|
dev->parent = NULL;
|
||||||
dev->priv_hcd = priv;
|
dev->priv_hcd = priv;
|
||||||
dev->usbnum = bus_index;
|
dev->usbnum = bus_index;
|
||||||
dev_index[bus_index]++;
|
dev_index[bus_index]++;
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -940,7 +944,7 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
tmpbuf = (unsigned char *) driver_mem_alloc(USB_BUFSIZ);
|
tmpbuf = (unsigned char *) driver_mem_alloc(USB_BUFSIZ);
|
||||||
if (tmpbuf == NULL)
|
if (tmpbuf == NULL)
|
||||||
{
|
{
|
||||||
debug_printf("usb_new_device: malloc failure\r\n");
|
dbg("usb_new_device: malloc failure\r\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -957,7 +961,7 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8);
|
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8);
|
||||||
if (err < 8)
|
if (err < 8)
|
||||||
{
|
{
|
||||||
debug_printf("\r\nUSB device not responding, giving up (status=%lX)\r\n", dev->status);
|
dbg("\r\nUSB device not responding, giving up (status=%lX)\r\n", dev->status);
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -982,7 +986,7 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64);
|
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
debug_printf("usb_new_device: usb_get_descriptor() failed\r\n");
|
dbg("usb_new_device: usb_get_descriptor() failed\r\n");
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1002,7 +1006,7 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
}
|
}
|
||||||
if (port < 0)
|
if (port < 0)
|
||||||
{
|
{
|
||||||
debug_printf("usb_new_device: cannot locate device's port.\r\n");
|
dbg("usb_new_device: cannot locate device's port.\r\n");
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1010,7 +1014,7 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
err = hub_port_reset(dev->parent, port, &portstatus);
|
err = hub_port_reset(dev->parent, port, &portstatus);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
debug_printf("\r\nCouldn't reset port %d\r\n", port);
|
dbg("\r\nCouldn't reset port %d\r\n", port);
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1029,7 +1033,7 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
err = usb_set_address(dev); /* set address */
|
err = usb_set_address(dev); /* set address */
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
debug_printf("\r\nUSB device not accepting new address (error=%lX)\r\n", dev->status);
|
dbg("\r\nUSB device not accepting new address (error=%lX)\r\n", dev->status);
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1039,9 +1043,9 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
if (err < tmp)
|
if (err < tmp)
|
||||||
{
|
{
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
debug_printf("unable to get device descriptor (error=%d)\r\n", err);
|
dbg("unable to get device descriptor (error=%d)\r\n", err);
|
||||||
else
|
else
|
||||||
debug_printf("USB device descriptor short read (expected %i, got %i)\r\n", tmp, err);
|
dbg("USB device descriptor short read (expected %i, got %i)\r\n", tmp, err);
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1057,11 +1061,11 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
/* we set the default configuration here */
|
/* we set the default configuration here */
|
||||||
if (usb_set_configuration(dev, dev->config.bConfigurationValue))
|
if (usb_set_configuration(dev, dev->config.bConfigurationValue))
|
||||||
{
|
{
|
||||||
debug_printf("failed to set default configuration len %d, status %lX\r\n", dev->act_len, dev->status);
|
dbg("failed to set default configuration len %d, status %lX\r\n", dev->act_len, dev->status);
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
debug_printf("new device strings: Mfr=%d, Product=%d, SerialNumber=%d\r\n",
|
dbg("new device strings: Mfr=%d, Product=%d, SerialNumber=%d\r\n",
|
||||||
dev->descriptor.iManufacturer, dev->descriptor.iProduct,
|
dev->descriptor.iManufacturer, dev->descriptor.iProduct,
|
||||||
dev->descriptor.iSerialNumber);
|
dev->descriptor.iSerialNumber);
|
||||||
memset(dev->mf, 0, sizeof(dev->mf));
|
memset(dev->mf, 0, sizeof(dev->mf));
|
||||||
@@ -1073,9 +1077,9 @@ int usb_new_device(struct usb_device *dev)
|
|||||||
usb_string(dev, dev->descriptor.iProduct, dev->prod, sizeof(dev->prod));
|
usb_string(dev, dev->descriptor.iProduct, dev->prod, sizeof(dev->prod));
|
||||||
if (dev->descriptor.iSerialNumber)
|
if (dev->descriptor.iSerialNumber)
|
||||||
usb_string(dev, dev->descriptor.iSerialNumber, dev->serial, sizeof(dev->serial));
|
usb_string(dev, dev->descriptor.iSerialNumber, dev->serial, sizeof(dev->serial));
|
||||||
debug_printf("Manufacturer %s\r\n", dev->mf);
|
dbg("Manufacturer %s\r\n", dev->mf);
|
||||||
debug_printf("Product %s\r\n", dev->prod);
|
dbg("Product %s\r\n", dev->prod);
|
||||||
debug_printf("SerialNumber %s\r\n", dev->serial);
|
dbg("SerialNumber %s\r\n", dev->serial);
|
||||||
/* now prode if the device is a hub */
|
/* now prode if the device is a hub */
|
||||||
usb_hub_probe(dev, 0);
|
usb_hub_probe(dev, 0);
|
||||||
driver_mem_free(tmpbuf);
|
driver_mem_free(tmpbuf);
|
||||||
@@ -1604,11 +1608,17 @@ int usb_hub_probe(struct usb_device *dev, int ifnum)
|
|||||||
struct usb_interface_descriptor *iface;
|
struct usb_interface_descriptor *iface;
|
||||||
struct usb_endpoint_descriptor *ep;
|
struct usb_endpoint_descriptor *ep;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
iface = &dev->config.if_desc[ifnum];
|
iface = &dev->config.if_desc[ifnum];
|
||||||
/* Is it a hub? */
|
|
||||||
|
/* Is it a hub? */
|
||||||
if (iface->bInterfaceClass != USB_CLASS_HUB)
|
if (iface->bInterfaceClass != USB_CLASS_HUB)
|
||||||
|
{
|
||||||
|
dbg("iface->bInterfaceClass != USB_CLASS_HUB (%d), %d instead\r\n", USB_CLASS_HUB, iface->bInterfaceClass);
|
||||||
return 0;
|
return 0;
|
||||||
/* Some hubs have a subclass of 1, which AFAICT according to the */
|
}
|
||||||
|
|
||||||
|
/* Some hubs have a subclass of 1, which AFAICT according to the */
|
||||||
/* specs is not defined, but it works */
|
/* specs is not defined, but it works */
|
||||||
if ((iface->bInterfaceSubClass != 0) && (iface->bInterfaceSubClass != 1))
|
if ((iface->bInterfaceSubClass != 0) && (iface->bInterfaceSubClass != 1))
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -222,24 +222,24 @@ static int usb_mouse_probe(struct usb_device *dev, unsigned int ifnum)
|
|||||||
|
|
||||||
iface = &dev->config.if_desc[ifnum];
|
iface = &dev->config.if_desc[ifnum];
|
||||||
|
|
||||||
if (iface->bInterfaceClass != 3)
|
if (iface->bInterfaceClass != USB_CLASS_HID)
|
||||||
{
|
{
|
||||||
dbg("iface->bInterfaceClass != 3 (%d instead)\r\n", iface->bInterfaceClass);
|
dbg("iface->bInterfaceClass != USB_CLASS_HID (%d instead)\r\n", iface->bInterfaceClass);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (iface->bInterfaceSubClass != 1)
|
if (iface->bInterfaceSubClass != USB_SUB_HID_BOOT)
|
||||||
{
|
{
|
||||||
dbg("iface->bInterfaceSubClass != 1 (%d instead)\r\n", iface->bInterfaceSubClass);
|
dbg("iface->bInterfaceSubClass != USB_SUB_HID_BOOT (%d instead)\r\n", iface->bInterfaceSubClass);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iface->bInterfaceProtocol != 2)
|
if (iface->bInterfaceProtocol != USB_PROT_HID_MOUSE)
|
||||||
{
|
{
|
||||||
dbg("iface->bInterfaceProtocol != 2 (%d)\r\n", iface->bInterfaceProtocol);
|
dbg("iface->bInterfaceProtocol != USB_PROT_HID_MOUSE (%d)\r\n", iface->bInterfaceProtocol);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user