|
|
|
|
@@ -72,7 +72,8 @@ extern unsigned long usb_1st_disk_drive;
|
|
|
|
|
|
|
|
|
|
#define USB_BUFSIZ 512
|
|
|
|
|
|
|
|
|
|
struct hci {
|
|
|
|
|
struct hci
|
|
|
|
|
{
|
|
|
|
|
/* ------- common part -------- */
|
|
|
|
|
long handle; /* PCI BIOS */
|
|
|
|
|
const struct pci_device_id *ent;
|
|
|
|
|
@@ -101,7 +102,8 @@ void usb_scan_devices(void *priv);
|
|
|
|
|
|
|
|
|
|
int usb_hub_probe(struct usb_device *dev, int ifnum);
|
|
|
|
|
void usb_hub_reset(int index_bus);
|
|
|
|
|
static int hub_port_reset(struct usb_device *dev, int port, unsigned short *portstat);
|
|
|
|
|
static int hub_port_reset(struct usb_device *dev, int port,
|
|
|
|
|
unsigned short *portstat);
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* wait_ms
|
|
|
|
|
@@ -131,7 +133,8 @@ int usb_init(long handle, const struct pci_device_id *ent)
|
|
|
|
|
return -1; /* out of memoy */
|
|
|
|
|
}
|
|
|
|
|
if (usb_dev == NULL )
|
|
|
|
|
usb_dev = (struct usb_device *)usb_malloc(sizeof(struct usb_device) * USB_MAX_BUS * USB_MAX_DEVICE);
|
|
|
|
|
usb_dev = (struct usb_device *) usb_malloc(
|
|
|
|
|
sizeof(struct usb_device) * USB_MAX_BUS * USB_MAX_DEVICE);
|
|
|
|
|
if (usb_dev == NULL )
|
|
|
|
|
{
|
|
|
|
|
usb_started = 0;
|
|
|
|
|
@@ -155,7 +158,7 @@ int usb_init(long handle, const struct pci_device_id *ent)
|
|
|
|
|
}
|
|
|
|
|
usb_hub_reset(bus_index);
|
|
|
|
|
/* init low_level USB */
|
|
|
|
|
Cconws("USB: ");
|
|
|
|
|
xprintf("USB: ");
|
|
|
|
|
switch (ent->class)
|
|
|
|
|
{
|
|
|
|
|
#ifdef CONFIG_USB_UHCI
|
|
|
|
|
@@ -173,7 +176,9 @@ int usb_init(long handle, const struct pci_device_id *ent)
|
|
|
|
|
res = ehci_usb_lowlevel_init(handle, ent, &priv);
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
default: res = -1; break;
|
|
|
|
|
default:
|
|
|
|
|
res = -1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!res)
|
|
|
|
|
{
|
|
|
|
|
@@ -186,7 +191,7 @@ int usb_init(long handle, const struct pci_device_id *ent)
|
|
|
|
|
usb_started = 0;
|
|
|
|
|
return -1; /* out of memoy */
|
|
|
|
|
}
|
|
|
|
|
Cconws("Scanning bus for devices... ");
|
|
|
|
|
xprintf("Scanning bus for devices... ");
|
|
|
|
|
controller_priv[bus_index] = (struct hci *) priv;
|
|
|
|
|
controller_priv[bus_index]->usbnum = bus_index;
|
|
|
|
|
usb_scan_devices(priv);
|
|
|
|
|
@@ -196,7 +201,7 @@ int usb_init(long handle, const struct pci_device_id *ent)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Cconws("Error, couldn't init Lowlevel part\r\n");
|
|
|
|
|
xprintf("Error, couldn't init Lowlevel part\r\n");
|
|
|
|
|
usb_started = 0;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
@@ -279,7 +284,7 @@ void usb_enable_interrupt(int enable)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* disables the asynch behaviour of the control message. This is used for data
|
|
|
|
|
* transfers that uses the exclusiv access to the control and bulk messages.
|
|
|
|
|
* transfers that uses the exclusive access to the control and bulk messages.
|
|
|
|
|
*/
|
|
|
|
|
void usb_disable_asynch(int disable)
|
|
|
|
|
{
|
|
|
|
|
@@ -306,7 +311,8 @@ void usb_disable_asynch(int disable)
|
|
|
|
|
/*
|
|
|
|
|
* submits an Interrupt Message
|
|
|
|
|
*/
|
|
|
|
|
int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, int interval)
|
|
|
|
|
int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|
|
|
|
int transfer_len, int interval)
|
|
|
|
|
{
|
|
|
|
|
struct hci *priv = (struct hci *) dev->priv_hcd;
|
|
|
|
|
switch (priv->ent->class)
|
|
|
|
|
@@ -338,9 +344,8 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
|
|
|
|
* and the current status are stored in the dev->act_len and dev->status.
|
|
|
|
|
*/
|
|
|
|
|
int usb_control_msg(struct usb_device *dev, unsigned int pipe,
|
|
|
|
|
unsigned char request, unsigned char requesttype,
|
|
|
|
|
unsigned short value, unsigned short index,
|
|
|
|
|
void *data, unsigned short size, int timeout)
|
|
|
|
|
unsigned char request, unsigned char requesttype, unsigned short value,
|
|
|
|
|
unsigned short index, void *data, unsigned short size, int timeout)
|
|
|
|
|
{
|
|
|
|
|
struct hci *priv = (struct hci *) dev->priv_hcd;
|
|
|
|
|
if ((timeout == 0) && (!asynch_allowed))
|
|
|
|
|
@@ -397,7 +402,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
|
|
|
|
|
* -1 if Error.
|
|
|
|
|
* synchronous behavior
|
|
|
|
|
*/
|
|
|
|
|
int usb_bulk_msg(struct usb_device *dev, unsigned int pipe, void *data, int len, int *actual_length, int timeout)
|
|
|
|
|
int usb_bulk_msg(struct usb_device *dev, unsigned int pipe, void *data, int len,
|
|
|
|
|
int *actual_length, int timeout)
|
|
|
|
|
{
|
|
|
|
|
struct hci *priv = (struct hci *) dev->priv_hcd;
|
|
|
|
|
if (len < 0)
|
|
|
|
|
@@ -438,7 +444,6 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe, void *data, int len,
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------
|
|
|
|
|
* Max Packet stuff
|
|
|
|
|
*/
|
|
|
|
|
@@ -464,11 +469,13 @@ int usb_maxpacket(struct usb_device *dev, unsigned long pipe)
|
|
|
|
|
* to update the compiler (Occurs with at least several GCC 4.{1,2},x
|
|
|
|
|
* CodeSourcery compilers like e.g. 2007q3, 2008q1, 2008q3 lite editions on ARM)
|
|
|
|
|
*/
|
|
|
|
|
static void __attribute__((noinline))usb_set_maxpacket_ep(struct usb_device *dev, struct usb_endpoint_descriptor *ep)
|
|
|
|
|
static void __attribute__((noinline)) usb_set_maxpacket_ep(
|
|
|
|
|
struct usb_device *dev, struct usb_endpoint_descriptor *ep)
|
|
|
|
|
{
|
|
|
|
|
int b;
|
|
|
|
|
b = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
|
|
|
|
|
if((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_CONTROL)
|
|
|
|
|
if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
|
|
|
|
|
== USB_ENDPOINT_XFER_CONTROL)
|
|
|
|
|
{
|
|
|
|
|
/* Control => bidirectional */
|
|
|
|
|
dev->epmaxpacketout[b] = ep->wMaxPacketSize;
|
|
|
|
|
@@ -527,7 +534,8 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|
|
|
|
head = (struct usb_descriptor_header *) &buffer[0];
|
|
|
|
|
if (head->bDescriptorType != USB_DT_CONFIG)
|
|
|
|
|
{
|
|
|
|
|
board_printf(" ERROR: NOT USB_CONFIG_DESC %x\r\n", head->bDescriptorType);
|
|
|
|
|
board_printf(" ERROR: NOT USB_CONFIG_DESC %x\r\n",
|
|
|
|
|
head->bDescriptorType);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
memcpy(&dev->config, buffer, buffer[0]);
|
|
|
|
|
@@ -542,12 +550,14 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|
|
|
|
switch (head->bDescriptorType)
|
|
|
|
|
{
|
|
|
|
|
case USB_DT_INTERFACE:
|
|
|
|
|
if(((struct usb_interface_descriptor *)&buffer[index])->bInterfaceNumber != curr_if_num)
|
|
|
|
|
if (((struct usb_interface_descriptor *) &buffer[index])->bInterfaceNumber
|
|
|
|
|
!= curr_if_num)
|
|
|
|
|
{
|
|
|
|
|
/* this is a new interface, copy new desc */
|
|
|
|
|
ifno = dev->config.no_of_if;
|
|
|
|
|
dev->config.no_of_if++;
|
|
|
|
|
memcpy(&dev->config.if_desc[ifno], &buffer[index], buffer[index]);
|
|
|
|
|
memcpy(&dev->config.if_desc[ifno], &buffer[index],
|
|
|
|
|
buffer[index]);
|
|
|
|
|
dev->config.if_desc[ifno].no_of_ep = 0;
|
|
|
|
|
dev->config.if_desc[ifno].num_altsetting = 1;
|
|
|
|
|
curr_if_num = dev->config.if_desc[ifno].bInterfaceNumber;
|
|
|
|
|
@@ -562,8 +572,10 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|
|
|
|
epno = dev->config.if_desc[ifno].no_of_ep;
|
|
|
|
|
/* found an endpoint */
|
|
|
|
|
dev->config.if_desc[ifno].no_of_ep++;
|
|
|
|
|
memcpy(&dev->config.if_desc[ifno].ep_desc[epno], &buffer[index], buffer[index]);
|
|
|
|
|
le16_to_cpus(&(dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize));
|
|
|
|
|
memcpy(&dev->config.if_desc[ifno].ep_desc[epno], &buffer[index],
|
|
|
|
|
buffer[index]);
|
|
|
|
|
le16_to_cpus(
|
|
|
|
|
&(dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize));
|
|
|
|
|
USB_PRINTF("if %d, ep %d\r\n", ifno, epno);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
@@ -573,8 +585,7 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|
|
|
|
{
|
|
|
|
|
ch = (unsigned char *) head;
|
|
|
|
|
for (i = 0; i < head->bLength; i++)
|
|
|
|
|
USB_PRINTF(" %02X", *ch++);
|
|
|
|
|
USB_PRINTF("\r\n");
|
|
|
|
|
USB_PRINTF(" %02X", *ch++); USB_PRINTF("\r\n");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -594,7 +605,8 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
|
|
|
|
|
int result;
|
|
|
|
|
int endp = usb_pipeendpoint(pipe) | (usb_pipein(pipe) << 7);
|
|
|
|
|
result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0, endp, NULL, 0, USB_CNTL_TIMEOUT * 3);
|
|
|
|
|
USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0, endp, NULL, 0,
|
|
|
|
|
USB_CNTL_TIMEOUT * 3);
|
|
|
|
|
/* don't clear if failed */
|
|
|
|
|
if (result < 0)
|
|
|
|
|
return result;
|
|
|
|
|
@@ -611,18 +623,20 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* get_descriptor type
|
|
|
|
|
*/
|
|
|
|
|
int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size)
|
|
|
|
|
int usb_get_descriptor(struct usb_device *dev, unsigned char type,
|
|
|
|
|
unsigned char index, void *buf, int size)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, (type << 8) + index, 0, buf, size, USB_CNTL_TIMEOUT);
|
|
|
|
|
res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR,
|
|
|
|
|
USB_DIR_IN, (type << 8) + index, 0, buf, size, USB_CNTL_TIMEOUT);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* gets configuration cfgno and store it in the buffer
|
|
|
|
|
*/
|
|
|
|
|
int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer, int cfgno)
|
|
|
|
|
int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
|
|
|
|
|
int cfgno)
|
|
|
|
|
{
|
|
|
|
|
int result;
|
|
|
|
|
unsigned int tmp;
|
|
|
|
|
@@ -632,9 +646,11 @@ int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer, int
|
|
|
|
|
if (result < 9)
|
|
|
|
|
{
|
|
|
|
|
if (result < 0)
|
|
|
|
|
board_printf("unable to get descriptor, error %lX\r\n", dev->status);
|
|
|
|
|
board_printf("unable to get descriptor, error %lX\r\n",
|
|
|
|
|
dev->status);
|
|
|
|
|
else
|
|
|
|
|
board_printf("config descriptor too short (expected %i, got %i)\n", 9, result);
|
|
|
|
|
board_printf("config descriptor too short (expected %i, got %i)\n",
|
|
|
|
|
9, result);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
tmp = le16_to_cpu(config->wTotalLength);
|
|
|
|
|
@@ -656,7 +672,8 @@ int usb_set_address(struct usb_device *dev)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
USB_PRINTF("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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -689,8 +706,9 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
|
|
|
|
|
*/
|
|
|
|
|
if (if_face->num_altsetting == 1)
|
|
|
|
|
return 0;
|
|
|
|
|
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, alternate, interface, NULL, 0, USB_CNTL_TIMEOUT * 5);
|
|
|
|
|
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_INTERFACE,
|
|
|
|
|
USB_RECIP_INTERFACE, alternate, interface, NULL, 0,
|
|
|
|
|
USB_CNTL_TIMEOUT * 5);
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
return ret;
|
|
|
|
|
return 0;
|
|
|
|
|
@@ -705,7 +723,8 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
|
|
|
|
|
USB_PRINTF("set configuration %d\r\n", configuration);
|
|
|
|
|
/* set setup command */
|
|
|
|
|
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);
|
|
|
|
|
if (res == 0)
|
|
|
|
|
{
|
|
|
|
|
dev->toggle[0] = 0;
|
|
|
|
|
@@ -721,9 +740,9 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
|
|
|
|
|
*/
|
|
|
|
|
int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_SET_PROTOCOL, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
|
|
|
|
|
protocol, ifnum, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_PROTOCOL,
|
|
|
|
|
USB_TYPE_CLASS | USB_RECIP_INTERFACE, protocol, ifnum, NULL, 0,
|
|
|
|
|
USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
|
@@ -731,9 +750,9 @@ int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol)
|
|
|
|
|
*/
|
|
|
|
|
int usb_set_idle(struct usb_device *dev, int ifnum, int duration, int report_id)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
|
|
|
|
|
(duration << 8) | report_id, ifnum, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_IDLE,
|
|
|
|
|
USB_TYPE_CLASS | USB_RECIP_INTERFACE, (duration << 8) | report_id,
|
|
|
|
|
ifnum, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
|
@@ -742,9 +761,9 @@ int usb_set_idle(struct usb_device *dev, int ifnum, int duration, int report_id)
|
|
|
|
|
int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
|
|
|
|
|
unsigned char id, void *buf, int size)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_GET_REPORT, USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
|
|
|
|
|
(type << 8) + id, ifnum, buf, size, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_REPORT,
|
|
|
|
|
USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, (type << 8) + id,
|
|
|
|
|
ifnum, buf, size, USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
|
@@ -753,23 +772,26 @@ int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
|
|
|
|
|
int usb_get_class_descriptor(struct usb_device *dev, int ifnum,
|
|
|
|
|
unsigned char type, unsigned char id, void *buf, int size)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_GET_DESCRIPTOR, USB_RECIP_INTERFACE | USB_DIR_IN,
|
|
|
|
|
(type << 8) + id, ifnum, buf, size, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR,
|
|
|
|
|
USB_RECIP_INTERFACE | USB_DIR_IN, (type << 8) + id, ifnum, buf,
|
|
|
|
|
size, USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
|
* get string index in buffer
|
|
|
|
|
*/
|
|
|
|
|
int usb_get_string(struct usb_device *dev, unsigned short langid, unsigned char index, void *buf, int size)
|
|
|
|
|
int usb_get_string(struct usb_device *dev, unsigned short langid,
|
|
|
|
|
unsigned char index, void *buf, int size)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int result;
|
|
|
|
|
for (i = 0; i < 3; ++i)
|
|
|
|
|
{
|
|
|
|
|
/* some devices are flaky */
|
|
|
|
|
result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
|
|
|
|
|
(USB_DT_STRING << 8) + index, langid, buf, size, USB_CNTL_TIMEOUT);
|
|
|
|
|
result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
|
|
|
|
|
(USB_DT_STRING << 8) + index, langid, buf, size,
|
|
|
|
|
USB_CNTL_TIMEOUT);
|
|
|
|
|
if (result > 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -792,7 +814,8 @@ static void usb_try_string_workarounds(unsigned char *buf, int *length)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int usb_string_sub(struct usb_device *dev, unsigned int langid, unsigned int index, unsigned char *buf)
|
|
|
|
|
static int usb_string_sub(struct usb_device *dev, unsigned int langid,
|
|
|
|
|
unsigned int index, unsigned char *buf)
|
|
|
|
|
{
|
|
|
|
|
int rc;
|
|
|
|
|
/* Try to read the string descriptor by asking for the maximum
|
|
|
|
|
@@ -899,8 +922,7 @@ void usb_disconnect(struct usb_device **pdev)
|
|
|
|
|
if (dev != NULL )
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
USB_PRINTF("USB %d disconnect on device %d\r\n", dev->parent->usbnum, dev->parent->devnum);
|
|
|
|
|
USB_PRINTF("USB %d disconnected, device number %d\r\n", dev->usbnum, dev->devnum);
|
|
|
|
|
USB_PRINTF("USB %d disconnect on device %d\r\n", dev->parent->usbnum, dev->parent->devnum); USB_PRINTF("USB %d disconnected, device number %d\r\n", dev->usbnum, dev->devnum);
|
|
|
|
|
if (dev->deregister != NULL )
|
|
|
|
|
dev->deregister(dev);
|
|
|
|
|
/* Free up all the children.. */
|
|
|
|
|
@@ -934,8 +956,7 @@ struct usb_device *usb_get_dev_index(int index, int index_bus)
|
|
|
|
|
|| (index >= USB_MAX_DEVICE) || (index < 0))
|
|
|
|
|
return NULL ;
|
|
|
|
|
dev = &usb_dev[(index_bus * USB_MAX_DEVICE) + index];
|
|
|
|
|
if((controller_priv[index_bus] == NULL) || (dev->devnum == -1))
|
|
|
|
|
return NULL;
|
|
|
|
|
if ((controller_priv[index_bus] == NULL )|| (dev->devnum == -1))return NULL;
|
|
|
|
|
return dev;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -956,7 +977,8 @@ struct usb_device *usb_alloc_new_device(int bus_index, void *priv)
|
|
|
|
|
dev = &usb_dev[(bus_index * USB_MAX_DEVICE) + index];
|
|
|
|
|
dev->devnum = index + 1;
|
|
|
|
|
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->priv_hcd = priv;
|
|
|
|
|
dev->usbnum = bus_index;
|
|
|
|
|
@@ -1067,28 +1089,40 @@ int usb_new_device(struct usb_device *dev)
|
|
|
|
|
dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0;
|
|
|
|
|
switch (dev->descriptor.bMaxPacketSize0)
|
|
|
|
|
{
|
|
|
|
|
case 8: dev->maxpacketsize = PACKET_SIZE_8; break;
|
|
|
|
|
case 16: dev->maxpacketsize = PACKET_SIZE_16; break;
|
|
|
|
|
case 32: dev->maxpacketsize = PACKET_SIZE_32; break;
|
|
|
|
|
case 64: dev->maxpacketsize = PACKET_SIZE_64; break;
|
|
|
|
|
case 8:
|
|
|
|
|
dev->maxpacketsize = PACKET_SIZE_8;
|
|
|
|
|
break;
|
|
|
|
|
case 16:
|
|
|
|
|
dev->maxpacketsize = PACKET_SIZE_16;
|
|
|
|
|
break;
|
|
|
|
|
case 32:
|
|
|
|
|
dev->maxpacketsize = PACKET_SIZE_32;
|
|
|
|
|
break;
|
|
|
|
|
case 64:
|
|
|
|
|
dev->maxpacketsize = PACKET_SIZE_64;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
dev->devnum = addr;
|
|
|
|
|
err = usb_set_address(dev); /* set address */
|
|
|
|
|
if (err < 0)
|
|
|
|
|
{
|
|
|
|
|
board_printf("\r\nUSB device not accepting new address (error=%lX)\r\n", dev->status);
|
|
|
|
|
board_printf("\r\nUSB device not accepting new address (error=%lX)\r\n",
|
|
|
|
|
dev->status);
|
|
|
|
|
usb_free(tmpbuf);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
wait_ms(10); /* Let the SET_ADDRESS settle */
|
|
|
|
|
tmp = sizeof(dev->descriptor);
|
|
|
|
|
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, sizeof(dev->descriptor));
|
|
|
|
|
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor,
|
|
|
|
|
sizeof(dev->descriptor));
|
|
|
|
|
if (err < tmp)
|
|
|
|
|
{
|
|
|
|
|
if (err < 0)
|
|
|
|
|
board_printf("unable to get device descriptor (error=%d)\r\n", err);
|
|
|
|
|
else
|
|
|
|
|
board_printf("USB device descriptor short read (expected %i, got %i)\r\n", tmp, err);
|
|
|
|
|
board_printf(
|
|
|
|
|
"USB device descriptor short read (expected %i, got %i)\r\n",
|
|
|
|
|
tmp, err);
|
|
|
|
|
usb_free(tmpbuf);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
@@ -1104,25 +1138,26 @@ int usb_new_device(struct usb_device *dev)
|
|
|
|
|
/* we set the default configuration here */
|
|
|
|
|
if (usb_set_configuration(dev, dev->config.bConfigurationValue))
|
|
|
|
|
{
|
|
|
|
|
board_printf("failed to set default configuration len %d, status %lX\r\n", dev->act_len, dev->status);
|
|
|
|
|
board_printf(
|
|
|
|
|
"failed to set default configuration len %d, status %lX\r\n",
|
|
|
|
|
dev->act_len, dev->status);
|
|
|
|
|
usb_free(tmpbuf);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
USB_PRINTF("new device strings: Mfr=%d, Product=%d, SerialNumber=%d\r\n",
|
|
|
|
|
} USB_PRINTF("new device strings: Mfr=%d, Product=%d, SerialNumber=%d\r\n",
|
|
|
|
|
dev->descriptor.iManufacturer, dev->descriptor.iProduct,
|
|
|
|
|
dev->descriptor.iSerialNumber);
|
|
|
|
|
memset(dev->mf, 0, sizeof(dev->mf));
|
|
|
|
|
memset(dev->prod, 0, sizeof(dev->prod));
|
|
|
|
|
memset(dev->serial, 0, sizeof(dev->serial));
|
|
|
|
|
if (dev->descriptor.iManufacturer)
|
|
|
|
|
usb_string(dev, dev->descriptor.iManufacturer, dev->mf, sizeof(dev->mf));
|
|
|
|
|
usb_string(dev, dev->descriptor.iManufacturer, dev->mf,
|
|
|
|
|
sizeof(dev->mf));
|
|
|
|
|
if (dev->descriptor.iProduct)
|
|
|
|
|
usb_string(dev, dev->descriptor.iProduct, dev->prod, sizeof(dev->prod));
|
|
|
|
|
if (dev->descriptor.iSerialNumber)
|
|
|
|
|
usb_string(dev, dev->descriptor.iSerialNumber, dev->serial, sizeof(dev->serial));
|
|
|
|
|
USB_PRINTF("Manufacturer %s\r\n", dev->mf);
|
|
|
|
|
USB_PRINTF("Product %s\r\n", dev->prod);
|
|
|
|
|
USB_PRINTF("SerialNumber %s\r\n", dev->serial);
|
|
|
|
|
usb_string(dev, dev->descriptor.iSerialNumber, dev->serial,
|
|
|
|
|
sizeof(dev->serial));
|
|
|
|
|
USB_PRINTF("Manufacturer %s\r\n", dev->mf); USB_PRINTF("Product %s\r\n", dev->prod); USB_PRINTF("SerialNumber %s\r\n", dev->serial);
|
|
|
|
|
/* now prode if the device is a hub */
|
|
|
|
|
usb_hub_probe(dev, 0);
|
|
|
|
|
usb_free(tmpbuf);
|
|
|
|
|
@@ -1137,7 +1172,8 @@ void usb_scan_devices(void *priv)
|
|
|
|
|
/* first make all devices unknown */
|
|
|
|
|
for (i = 0; i < USB_MAX_DEVICE; i++)
|
|
|
|
|
{
|
|
|
|
|
memset(&usb_dev[(bus_index * USB_MAX_DEVICE) + i], 0, sizeof(struct usb_device));
|
|
|
|
|
memset(&usb_dev[(bus_index * USB_MAX_DEVICE) + i], 0,
|
|
|
|
|
sizeof(struct usb_device));
|
|
|
|
|
usb_dev[(bus_index * USB_MAX_DEVICE) + i].devnum = -1;
|
|
|
|
|
}
|
|
|
|
|
dev_index[bus_index] = 0;
|
|
|
|
|
@@ -1196,38 +1232,41 @@ char usb_error_str[256];
|
|
|
|
|
|
|
|
|
|
int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB, USB_DT_HUB << 8, 0, data, size, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR,
|
|
|
|
|
USB_DIR_IN | USB_RT_HUB, USB_DT_HUB << 8, 0, data, size,
|
|
|
|
|
USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int usb_clear_hub_feature(struct usb_device *dev, int feature)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_CLEAR_FEATURE, USB_RT_HUB, feature, 0, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_CLEAR_FEATURE,
|
|
|
|
|
USB_RT_HUB, feature, 0, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int usb_clear_port_feature(struct usb_device *dev, int port, int feature)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_CLEAR_FEATURE,
|
|
|
|
|
USB_RT_PORT, feature, port, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int usb_set_port_feature(struct usb_device *dev, int port, int feature)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_FEATURE,
|
|
|
|
|
USB_RT_PORT, feature, port, NULL, 0, USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int usb_get_hub_status(struct usb_device *dev, void *data)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0, data, sizeof(struct usb_hub_status), USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_STATUS,
|
|
|
|
|
USB_DIR_IN | USB_RT_HUB, 0, 0, data, sizeof(struct usb_hub_status),
|
|
|
|
|
USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int usb_get_port_status(struct usb_device *dev, int port, void *data)
|
|
|
|
|
{
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
|
USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port, data, sizeof(struct usb_hub_status), USB_CNTL_TIMEOUT);
|
|
|
|
|
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_STATUS,
|
|
|
|
|
USB_DIR_IN | USB_RT_PORT, 0, port, data,
|
|
|
|
|
sizeof(struct usb_hub_status), USB_CNTL_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void usb_hub_power_on(struct usb_hub_device *hub)
|
|
|
|
|
@@ -1270,7 +1309,8 @@ static inline char *portspeed(int portstatus)
|
|
|
|
|
return "12 Mb/s";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hub_port_reset(struct usb_device *dev, int port, unsigned short *portstat)
|
|
|
|
|
static int hub_port_reset(struct usb_device *dev, int port,
|
|
|
|
|
unsigned short *portstat)
|
|
|
|
|
{
|
|
|
|
|
int tries;
|
|
|
|
|
struct usb_port_status portsts;
|
|
|
|
|
@@ -1291,10 +1331,10 @@ static int hub_port_reset(struct usb_device *dev, int port, unsigned short *port
|
|
|
|
|
}
|
|
|
|
|
portstatus = le16_to_cpu(portsts.wPortStatus);
|
|
|
|
|
portchange = le16_to_cpu(portsts.wPortChange);
|
|
|
|
|
USB_HUB_PRINTF("USB %d portstatus %x, change %x, %s\r\n", dev->usbnum, portstatus, portchange, portspeed(portstatus));
|
|
|
|
|
USB_HUB_PRINTF("STAT_C_CONNECTION = %d STAT_CONNECTION = %d USB_PORT_STAT_ENABLE = %d\r\n",
|
|
|
|
|
USB_HUB_PRINTF("USB %d portstatus %x, change %x, %s\r\n", dev->usbnum, portstatus, portchange, portspeed(portstatus)); USB_HUB_PRINTF("STAT_C_CONNECTION = %d STAT_CONNECTION = %d USB_PORT_STAT_ENABLE = %d\r\n",
|
|
|
|
|
(portchange & USB_PORT_STAT_C_CONNECTION) ? 1 : 0, (portstatus & USB_PORT_STAT_CONNECTION) ? 1 : 0, (portstatus & USB_PORT_STAT_ENABLE) ? 1 : 0);
|
|
|
|
|
if((portchange & USB_PORT_STAT_C_CONNECTION) || !(portstatus & USB_PORT_STAT_CONNECTION))
|
|
|
|
|
if ((portchange & USB_PORT_STAT_C_CONNECTION)
|
|
|
|
|
|| !(portstatus & USB_PORT_STAT_CONNECTION))
|
|
|
|
|
return -1;
|
|
|
|
|
if (portstatus & USB_PORT_STAT_ENABLE)
|
|
|
|
|
break;
|
|
|
|
|
@@ -1306,8 +1346,7 @@ static int hub_port_reset(struct usb_device *dev, int port, unsigned short *port
|
|
|
|
|
}
|
|
|
|
|
if (tries == MAX_TRIES)
|
|
|
|
|
{
|
|
|
|
|
USB_HUB_PRINTF("USB %d, cannot enable port %i after %i retries, disabling port.\r\n", dev->usbnum, port + 1, MAX_TRIES);
|
|
|
|
|
USB_HUB_PRINTF("Maybe the USB cable is bad?\r\n");
|
|
|
|
|
USB_HUB_PRINTF("USB %d, cannot enable port %i after %i retries, disabling port.\r\n", dev->usbnum, port + 1, MAX_TRIES); USB_HUB_PRINTF("Maybe the USB cable is bad?\r\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_RESET);
|
|
|
|
|
@@ -1349,7 +1388,8 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
|
|
|
|
|
/* Reset the port */
|
|
|
|
|
if (hub_port_reset(dev, port, &portstatus) < 0)
|
|
|
|
|
{
|
|
|
|
|
board_printf("USB %d cannot reset port %i!?\r\n", dev->usbnum, port + 1);
|
|
|
|
|
board_printf("USB %d cannot reset port %i!?\r\n", dev->usbnum,
|
|
|
|
|
port + 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#ifdef USB_POLL_HUB
|
|
|
|
|
@@ -1420,7 +1460,9 @@ static void usb_hub_events(struct usb_device *dev)
|
|
|
|
|
/* EM interference sometimes causes bad shielded USB
|
|
|
|
|
* devices to be shutdown by the hub, this hack enables
|
|
|
|
|
* them again. Works at least with mouse driver */
|
|
|
|
|
if(!(portstatus & USB_PORT_STAT_ENABLE) && (portstatus & USB_PORT_STAT_CONNECTION) && ((dev->children[i])))
|
|
|
|
|
if (!(portstatus & USB_PORT_STAT_ENABLE)
|
|
|
|
|
&& (portstatus & USB_PORT_STAT_CONNECTION)
|
|
|
|
|
&& ((dev->children[i])))
|
|
|
|
|
{
|
|
|
|
|
USB_HUB_PRINTF("USB %d already running port %i disabled by hub (EMI?), re-enabling...\r\n", dev->usbnum, i + 1);
|
|
|
|
|
usb_hub_port_connect_change(dev, i);
|
|
|
|
|
@@ -1512,8 +1554,7 @@ int usb_hub_configure(struct usb_device *dev)
|
|
|
|
|
USB_HUB_PRINTF("usb_hub_configure: failed to get hub descriptor, giving up %lX\r\n", dev->status);
|
|
|
|
|
usb_free(buffer);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
USB_HUB_PRINTF("bLength:%02X bDescriptorType:%02X bNbrPorts:%02X\r\n", buffer[0], buffer[1], buffer[2]);
|
|
|
|
|
} USB_HUB_PRINTF("bLength:%02X bDescriptorType:%02X bNbrPorts:%02X\r\n", buffer[0], buffer[1], buffer[2]);
|
|
|
|
|
descriptor = (struct usb_hub_descriptor *) buffer;
|
|
|
|
|
/* silence compiler warning if USB_BUFSIZ is > 256 [= sizeof(char)] */
|
|
|
|
|
i = descriptor->bLength;
|
|
|
|
|
@@ -1531,7 +1572,8 @@ int usb_hub_configure(struct usb_device *dev)
|
|
|
|
|
}
|
|
|
|
|
memcpy((unsigned char *) &hub->desc, buffer, descriptor->bLength);
|
|
|
|
|
/* adjust 16bit values */
|
|
|
|
|
hub->desc.wHubCharacteristics = le16_to_cpu(descriptor->wHubCharacteristics);
|
|
|
|
|
hub->desc.wHubCharacteristics = le16_to_cpu(
|
|
|
|
|
descriptor->wHubCharacteristics);
|
|
|
|
|
/* set the bitmap */
|
|
|
|
|
bitmap = (unsigned char *) &hub->desc.DeviceRemovable[0];
|
|
|
|
|
/* devices not removable by default */
|
|
|
|
|
@@ -1548,10 +1590,16 @@ int usb_hub_configure(struct usb_device *dev)
|
|
|
|
|
dev->maxchild = 10;
|
|
|
|
|
switch (hub->desc.wHubCharacteristics & HUB_CHAR_LPSM)
|
|
|
|
|
{
|
|
|
|
|
case 0x00: USB_HUB_PRINTF("ganged power switching\r\n"); break;
|
|
|
|
|
case 0x01: USB_HUB_PRINTF("individual port power switching\r\n"); break;
|
|
|
|
|
case 0x00:
|
|
|
|
|
USB_HUB_PRINTF("ganged power switching\r\n");
|
|
|
|
|
break;
|
|
|
|
|
case 0x01:
|
|
|
|
|
USB_HUB_PRINTF("individual port power switching\r\n");
|
|
|
|
|
break;
|
|
|
|
|
case 0x02:
|
|
|
|
|
case 0x03: USB_HUB_PRINTF("unknown reserved power switching mode\r\n"); break;
|
|
|
|
|
case 0x03:
|
|
|
|
|
USB_HUB_PRINTF("unknown reserved power switching mode\r\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (hub->desc.wHubCharacteristics & HUB_CHAR_COMPOUND)
|
|
|
|
|
{
|
|
|
|
|
@@ -1563,13 +1611,17 @@ int usb_hub_configure(struct usb_device *dev)
|
|
|
|
|
}
|
|
|
|
|
switch (hub->desc.wHubCharacteristics & HUB_CHAR_OCPM)
|
|
|
|
|
{
|
|
|
|
|
case 0x00: USB_HUB_PRINTF("global over-current protection\r\n"); break;
|
|
|
|
|
case 0x08: USB_HUB_PRINTF("individual port over-current protection\r\n"); break;
|
|
|
|
|
case 0x00:
|
|
|
|
|
USB_HUB_PRINTF("global over-current protection\r\n");
|
|
|
|
|
break;
|
|
|
|
|
case 0x08:
|
|
|
|
|
USB_HUB_PRINTF("individual port over-current protection\r\n");
|
|
|
|
|
break;
|
|
|
|
|
case 0x10:
|
|
|
|
|
case 0x18: USB_HUB_PRINTF("no over-current protection\r\n"); break;
|
|
|
|
|
}
|
|
|
|
|
USB_HUB_PRINTF("power on to power good time: %dms\r\n", descriptor->bPwrOn2PwrGood * 2);
|
|
|
|
|
USB_HUB_PRINTF("hub controller current requirement: %dmA\r\n", descriptor->bHubContrCurrent);
|
|
|
|
|
case 0x18:
|
|
|
|
|
USB_HUB_PRINTF("no over-current protection\r\n");
|
|
|
|
|
break;
|
|
|
|
|
} USB_HUB_PRINTF("power on to power good time: %dms\r\n", descriptor->bPwrOn2PwrGood * 2); USB_HUB_PRINTF("hub controller current requirement: %dmA\r\n", descriptor->bHubContrCurrent);
|
|
|
|
|
for (i = 0; i < dev->maxchild; i++)
|
|
|
|
|
{
|
|
|
|
|
USB_HUB_PRINTF("USB %d port %d is%s removable\r\n", dev->usbnum, i + 1, hub->desc.DeviceRemovable[(i + 1) / 8] & (1 << ((i + 1) % 8)) ? " not" : "");
|
|
|
|
|
@@ -1587,9 +1639,7 @@ int usb_hub_configure(struct usb_device *dev)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
hubsts = (struct usb_hub_status *) buffer;
|
|
|
|
|
USB_HUB_PRINTF("get_hub_status returned status %X, change %X\r\n", le16_to_cpu(hubsts->wHubStatus), le16_to_cpu(hubsts->wHubChange));
|
|
|
|
|
USB_HUB_PRINTF("local power source is %s\r\n", (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_LOCAL_POWER) ? "lost (inactive)" : "good");
|
|
|
|
|
USB_HUB_PRINTF("%sover-current condition exists\r\n", (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? "" : "no ");
|
|
|
|
|
USB_HUB_PRINTF("get_hub_status returned status %X, change %X\r\n", le16_to_cpu(hubsts->wHubStatus), le16_to_cpu(hubsts->wHubChange)); USB_HUB_PRINTF("local power source is %s\r\n", (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_LOCAL_POWER) ? "lost (inactive)" : "good"); USB_HUB_PRINTF("%sover-current condition exists\r\n", (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? "" : "no ");
|
|
|
|
|
usb_hub_power_on(hub);
|
|
|
|
|
#ifdef USB_POLL_HUB
|
|
|
|
|
if(queue_poll_hub == NULL)
|
|
|
|
|
|