diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-11-24 11:46:04 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-11-24 11:46:04 +0000 |
commit | 3b99abb5fcc4e92142d02b1a115fed8d5028596b (patch) | |
tree | a5120a18de747ac36a92d78f4c5173418cdbfc95 /LUFA/Drivers/USB/Core/HostStandardReq.c | |
parent | e915d968a5bdb8619c465b94d21a3801446a6539 (diff) | |
download | lufa-3b99abb5fcc4e92142d02b1a115fed8d5028596b.tar.gz lufa-3b99abb5fcc4e92142d02b1a115fed8d5028596b.tar.bz2 lufa-3b99abb5fcc4e92142d02b1a115fed8d5028596b.zip |
Add new USB_Host_GetDescriptor() function. Alter the USB_Host_GetDeviceDescriptor() and USB_Host_GetDeviceStringDescriptor() convenience functions so that they wrap the new function.
Diffstat (limited to 'LUFA/Drivers/USB/Core/HostStandardReq.c')
-rw-r--r-- | LUFA/Drivers/USB/Core/HostStandardReq.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.c b/LUFA/Drivers/USB/Core/HostStandardReq.c index d7e7e3eba..bb8ade3a1 100644 --- a/LUFA/Drivers/USB/Core/HostStandardReq.c +++ b/LUFA/Drivers/USB/Core/HostStandardReq.c @@ -227,31 +227,16 @@ uint8_t USB_Host_GetDeviceConfiguration(uint8_t* const ConfigNumber) return USB_Host_SendControlRequest(ConfigNumber); } -uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr) +uint8_t USB_Host_GetDescriptor(const uint8_t Type, + const uint8_t Index, + void* const Buffer, + const uint8_t BufferLength) { USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), .bRequest = REQ_GetDescriptor, - .wValue = (DTYPE_Device << 8), - .wIndex = 0, - .wLength = sizeof(USB_Descriptor_Device_t), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(DeviceDescriptorPtr); -} - -uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, - void* const Buffer, - const uint8_t BufferLength) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_GetDescriptor, - .wValue = ((DTYPE_String << 8) | Index), + .wValue = (((uint16_t)Type << 8) | Index), .wIndex = 0, .wLength = BufferLength, }; |