diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-07-12 04:52:21 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-07-12 04:52:21 +0000 |
commit | 065ed4da207173495d0a569b0f2973daebb841f0 (patch) | |
tree | 40967b9fc0fc3f7e0004737077138e9df0748502 /LUFA/Drivers | |
parent | f152ff26c7902a848c798c56adb981861beaf2bf (diff) | |
download | lufa-065ed4da207173495d0a569b0f2973daebb841f0.tar.gz lufa-065ed4da207173495d0a569b0f2973daebb841f0.tar.bz2 lufa-065ed4da207173495d0a569b0f2973daebb841f0.zip |
Added new USB_Host_GetDeviceStatus() function for USB Host mode.
Diffstat (limited to 'LUFA/Drivers')
-rw-r--r-- | LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/HostStandardReq.c | 16 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/HostStandardReq.h | 31 |
3 files changed, 38 insertions, 11 deletions
diff --git a/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h index 2caacaa00..fd42c5022 100644 --- a/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h @@ -183,7 +183,7 @@ /* Switch /SS to input mode after configuration to allow for forced mode changes */ DDRB &= ~(1 << 0); - SPCR = ((1 << SPE) | SPIOptions); + SPCR = ((1 << SPE) | SPIOptions); } /** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */ diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.c b/LUFA/Drivers/USB/Core/HostStandardReq.c index 8304c2c28..12ccd91e3 100644 --- a/LUFA/Drivers/USB/Core/HostStandardReq.c +++ b/LUFA/Drivers/USB/Core/HostStandardReq.c @@ -238,6 +238,22 @@ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, return USB_Host_SendControlRequest(Buffer); } +uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_GetFeature, + .wValue = 0, + .wIndex = 0, + .wLength = 0, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(FeatureStatus); +} + uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointAddress) { USB_ControlRequest = (USB_Request_Header_t) diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.h b/LUFA/Drivers/USB/Core/HostStandardReq.h index 3358d2774..caa42e322 100644 --- a/LUFA/Drivers/USB/Core/HostStandardReq.h +++ b/LUFA/Drivers/USB/Core/HostStandardReq.h @@ -104,9 +104,7 @@ */ uint8_t USB_Host_SendControlRequest(void* const BufferPtr); - /** Convenience function. This routine sends a SET CONFIGURATION standard request to the attached - * device, with the given configuration index. This can be used to easily set the device - * configuration without creating and sending the request manually. + /** Sends a SET CONFIGURATION standard request to the attached device, with the given configuration index. * * This routine will automatically update the \ref USB_HostState and \ref USB_Host_ConfigurationNumber * state variables according to the given function parameters and the result of the request. @@ -121,9 +119,9 @@ */ uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber); - /** Convenience function. This routine sends a GET DESCRIPTOR standard request to the attached - * device, requesting the device descriptor. This can be used to easily retrieve information - * about the device such as its VID, PID and power requirements. + /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the device descriptor. + * This can be used to easily retrieve information about the device such as its VID, PID and power + * requirements. * * \note After this routine returns, the control pipe will be selected. * @@ -136,10 +134,9 @@ */ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr); - /** Convenience function. This routine sends a GET DESCRIPTOR standard request to the attached - * device, requesting the string descriptor of the specified index. This can be used to easily - * retrieve string descriptors from the device by index, after the index is obtained from the - * Device or Configuration descriptors. + /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the string descriptor + * of the specified index. This can be used to easily retrieve string descriptors from the device by + * index, after the index is obtained from the Device or Configuration descriptors. * * \note After this routine returns, the control pipe will be selected. * @@ -156,6 +153,20 @@ void* const Buffer, const uint8_t BufferLength); + /** Retrieves the current feature status of the attached device, via a GET STATUS standard request. The + * retrieved feature status can then be examined by masking the retrieved value with the various + * FEATURE_* masks for bus/self power information and remote wakeup support. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[out] FeatureStatus Location where the retrieved feature status should be stored. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus); + /** Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device. * * \note After this routine returns, the control pipe will be selected. |