mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-27 00:25:11 +02:00
Fix ESP32 dynamic USB interfaces.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user