mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +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;
|
static void (*card_locked_func)(void) = NULL;
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
static mutex_t mutex;
|
static mutex_t mutex;
|
||||||
|
extern void usb_desc_setup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USB_ITF_HID
|
#ifdef USB_ITF_HID
|
||||||
@@ -128,6 +129,9 @@ void usb_init() {
|
|||||||
ccid_init();
|
ccid_init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
|
usb_desc_setup();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|||||||
@@ -140,9 +140,8 @@ uint8_t const *tud_hid_descriptor_report_cb(uint8_t itf) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef ESP_PLATFORM
|
|
||||||
uint8_t const *tud_descriptor_configuration_cb(uint8_t index) {
|
void usb_desc_setup() {
|
||||||
(void) index; // for multiple configurations
|
|
||||||
desc_config[4] = ITF_TOTAL;
|
desc_config[4] = ITF_TOTAL;
|
||||||
TUSB_DESC_TOTAL_LEN = TUD_CONFIG_DESC_LEN;
|
TUSB_DESC_TOTAL_LEN = TUD_CONFIG_DESC_LEN;
|
||||||
uint8_t *p = desc_config + 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
|
#endif
|
||||||
desc_config[2] = TUSB_DESC_TOTAL_LEN & 0xFF;
|
desc_config[2] = TUSB_DESC_TOTAL_LEN & 0xFF;
|
||||||
desc_config[3] = TUSB_DESC_TOTAL_LEN >> 8;
|
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;
|
return desc_config;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user