mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
add get device qualifier descriptor
This commit is contained in:
parent
b8783e10a9
commit
d6d29897f3
@ -867,9 +867,27 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
|
||||
case TUSB_DESC_DEVICE_QUALIFIER:
|
||||
TU_LOG2(" Device Qualifier\r\n");
|
||||
|
||||
// TODO If not highspeed capable stall this request otherwise
|
||||
// return the descriptor that could work in highspeed
|
||||
return false;
|
||||
// Host sends this request to ask why our device with USB BCD from 2.0
|
||||
// but is running at Full/Low Speed. If not highspeed capable stall this request,
|
||||
// otherwise return the descriptor that could work in highspeed mode
|
||||
if ( tud_descriptor_device_qualifier_cb )
|
||||
{
|
||||
uint8_t const* desc_qualifier = tud_descriptor_device_qualifier_cb();
|
||||
TU_ASSERT(desc_qualifier);
|
||||
|
||||
// first byte of descriptor is its size
|
||||
return tud_control_xfer(rhport, p_request, (void*) desc_qualifier, desc_qualifier[0]);
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case TUSB_DESC_OTHER_SPEED_CONFIG:
|
||||
TU_LOG2(" Other Speed Configuration\r\n");
|
||||
|
||||
// After Device Qualifier descriptor is received host will ask for this descriptor
|
||||
return false; // not supported
|
||||
break;
|
||||
|
||||
default: return false;
|
||||
|
@ -68,6 +68,8 @@ static inline bool tud_ready(void)
|
||||
// Remote wake up host, only if suspended and enabled by host
|
||||
bool tud_remote_wakeup(void);
|
||||
|
||||
// Enable pull-up resistor on D+ D-
|
||||
// Return false on unsupported MCUs
|
||||
static inline bool tud_disconnect(void)
|
||||
{
|
||||
TU_VERIFY(dcd_disconnect);
|
||||
@ -75,6 +77,8 @@ static inline bool tud_disconnect(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Disable pull-up resistor on D+ D-
|
||||
// Return false on unsupported MCUs
|
||||
static inline bool tud_connect(void)
|
||||
{
|
||||
TU_VERIFY(dcd_connect);
|
||||
@ -110,6 +114,10 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index);
|
||||
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
|
||||
uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid);
|
||||
|
||||
// Invoked when received GET DEVICE QUALIFIER DESCRIPTOR request
|
||||
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
|
||||
TU_ATTR_WEAK uint8_t const* tud_descriptor_device_qualifier_cb(void);
|
||||
|
||||
// Invoked when device is mounted (configured)
|
||||
TU_ATTR_WEAK void tud_mount_cb(void);
|
||||
|
||||
@ -125,6 +133,8 @@ TU_ATTR_WEAK void tud_resume_cb(void);
|
||||
|
||||
// Invoked when received control request with VENDOR TYPE
|
||||
TU_ATTR_WEAK bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const * request);
|
||||
|
||||
// Invoked when vendor control request is complete
|
||||
TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user