diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-01-02 20:16:16 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-01-02 20:16:16 +0000 |
commit | 23b9abccb76fba1095baef05e6016328a2bd3f3b (patch) | |
tree | af015df3383d559d8240ff4e1c4063a863b2a421 | |
parent | 1790044dc64c1edd78db07c19c910fa9fd794f9c (diff) | |
download | nuttx-23b9abccb76fba1095baef05e6016328a2bd3f3b.tar.gz nuttx-23b9abccb76fba1095baef05e6016328a2bd3f3b.tar.bz2 nuttx-23b9abccb76fba1095baef05e6016328a2bd3f3b.zip |
Missed part of last change
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3232 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-x | nuttx/drivers/usbhost/usbhost_enumerate.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_enumerate.c b/nuttx/drivers/usbhost/usbhost_enumerate.c index 035f8a3c1..c830efc5c 100755 --- a/nuttx/drivers/usbhost/usbhost_enumerate.c +++ b/nuttx/drivers/usbhost/usbhost_enumerate.c @@ -395,11 +395,11 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, */ } - /* Set the device address to 1 */ + /* Set the USB device address to the value in the 'funcaddr' input */ ctrlreq->type = USB_REQ_DIR_OUT|USB_REQ_RECIPIENT_DEVICE; ctrlreq->req = USB_REQ_SETADDRESS; - usbhost_putle16(ctrlreq->value, 1); + usbhost_putle16(ctrlreq->value, (uint16_t)funcaddr); usbhost_putle16(ctrlreq->index, 0); usbhost_putle16(ctrlreq->len, 0); @@ -411,12 +411,13 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, } up_mdelay(2); - /* Modify control pipe with function address 1 */ + /* Modify control pipe with the provided USB device address */ - DRVR_EP0CONFIGURE(drvr, 1, maxpacketsize); + DRVR_EP0CONFIGURE(drvr, funcaddr, maxpacketsize); - /* Get the configuration descriptor (only), index == 0. More logic is - * needed in order to handle devices with multiple configurations. + /* Get the configuration descriptor (only), index == 0. Should not be + * hard-coded! More logic is needed in order to handle devices with + * multiple configurations. */ ctrlreq->type = USB_REQ_DIR_IN|USB_REQ_RECIPIENT_DEVICE; @@ -437,7 +438,9 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, cfglen = (unsigned int)usbhost_getle16(((struct usb_cfgdesc_s *)buffer)->totallen); uvdbg("sizeof config data: %d\n", cfglen); - /* Get all of the configuration descriptor data, index == 0 */ + /* Get all of the configuration descriptor data, index == 0 (Should not be + * hard-coded!) + */ ctrlreq->type = USB_REQ_DIR_IN|USB_REQ_RECIPIENT_DEVICE; ctrlreq->req = USB_REQ_GETDESCRIPTOR; @@ -452,7 +455,7 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, goto errout; } - /* Select device configuration 1 */ + /* Select device configuration 1 (Should not be hard-coded!) */ ctrlreq->type = USB_REQ_DIR_OUT|USB_REQ_RECIPIENT_DEVICE; ctrlreq->req = USB_REQ_SETCONFIGURATION; |