Fix ESP32 dynamic USB interfaces.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
a08abaed0f
commit
5f79a8c8ed
2 changed files with 12 additions and 3 deletions
|
|
@ -42,6 +42,7 @@ static uint8_t card_locked_itf = 0; // no locked
|
|||
static void (*card_locked_func)(void) = NULL;
|
||||
#ifndef ENABLE_EMULATION
|
||||
static mutex_t mutex;
|
||||
extern void usb_desc_setup();
|
||||
#endif
|
||||
|
||||
#ifdef USB_ITF_HID
|
||||
|
|
@ -128,6 +129,9 @@ void usb_init() {
|
|||
ccid_init();
|
||||
}
|
||||
#endif
|
||||
#ifdef ESP_PLATFORM
|
||||
usb_desc_setup();
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t timeout = 0;
|
||||
|
|
|
|||
|
|
@ -140,9 +140,8 @@ uint8_t const *tud_hid_descriptor_report_cb(uint8_t itf) {
|
|||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#ifndef ESP_PLATFORM
|
||||
uint8_t const *tud_descriptor_configuration_cb(uint8_t index) {
|
||||
(void) index; // for multiple configurations
|
||||
|
||||
void usb_desc_setup() {
|
||||
desc_config[4] = ITF_TOTAL;
|
||||
TUSB_DESC_TOTAL_LEN = TUD_CONFIG_DESC_LEN;
|
||||
uint8_t *p = desc_config + TUD_CONFIG_DESC_LEN;
|
||||
|
|
@ -184,6 +183,12 @@ uint8_t const *tud_descriptor_configuration_cb(uint8_t index) {
|
|||
#endif
|
||||
desc_config[2] = TUSB_DESC_TOTAL_LEN & 0xFF;
|
||||
desc_config[3] = TUSB_DESC_TOTAL_LEN >> 8;
|
||||
}
|
||||
|
||||
#ifndef ESP_PLATFORM
|
||||
uint8_t const *tud_descriptor_configuration_cb(uint8_t index) {
|
||||
(void) index; // for multiple configurations
|
||||
usb_desc_setup();
|
||||
return desc_config;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue