mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Fix interface strings when are not all enabled.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -74,7 +74,9 @@ queue_t card_to_usb_q = {0};
|
||||
#ifndef ENABLE_EMULATION
|
||||
extern tusb_desc_device_t desc_device;
|
||||
#endif
|
||||
void usb_init() {
|
||||
extern char *string_desc_itf[4], *string_desc_arr[];
|
||||
void usb_init()
|
||||
{
|
||||
#ifndef ENABLE_EMULATION
|
||||
if (phy_data.vidpid_present) {
|
||||
desc_device.idVendor = phy_data.vid;
|
||||
@@ -108,20 +110,24 @@ void usb_init() {
|
||||
if (enabled_usb_itf & PHY_USB_ITF_HID) {
|
||||
ITF_HID_CTAP = ITF_HID_TOTAL++;
|
||||
ITF_HID = ITF_TOTAL++;
|
||||
string_desc_itf[ITF_TOTAL - 1] = string_desc_arr[5];
|
||||
}
|
||||
if (enabled_usb_itf & PHY_USB_ITF_KB) {
|
||||
ITF_HID_KB = ITF_HID_TOTAL++;
|
||||
ITF_KEYBOARD = ITF_TOTAL++;
|
||||
string_desc_itf[ITF_TOTAL - 1] = string_desc_arr[6];
|
||||
}
|
||||
#endif
|
||||
#ifdef USB_ITF_CCID
|
||||
if (enabled_usb_itf & PHY_USB_ITF_CCID) {
|
||||
ITF_SC_CCID = ITF_SC_TOTAL++;
|
||||
ITF_CCID = ITF_TOTAL++;
|
||||
string_desc_itf[ITF_TOTAL - 1] = string_desc_arr[7];
|
||||
}
|
||||
if (enabled_usb_itf & PHY_USB_ITF_WCID) {
|
||||
ITF_SC_WCID = ITF_SC_TOTAL++;
|
||||
ITF_WCID = ITF_TOTAL++;
|
||||
string_desc_itf[ITF_TOTAL - 1] = string_desc_arr[8];
|
||||
}
|
||||
#endif
|
||||
card_locked_itf = ITF_TOTAL;
|
||||
|
||||
@@ -316,6 +316,7 @@ uint8_t const *tud_descriptor_bos_cb(void) {
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// array of pointer to string descriptors
|
||||
char *string_desc_itf[4] = {0};
|
||||
char const *string_desc_arr [] = {
|
||||
(const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409)
|
||||
"Pol Henarejos", // 1: Manufacturer
|
||||
@@ -369,6 +370,9 @@ uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
|
||||
str = phy_data.usb_product;
|
||||
}
|
||||
}
|
||||
else if (index >= 5 && string_desc_itf[index - 5] != NULL) {
|
||||
str = string_desc_itf[index - 5];
|
||||
}
|
||||
|
||||
uint8_t buff_avail = sizeof(_desc_str) / sizeof(_desc_str[0]) - 1;
|
||||
if (index >= 4) {
|
||||
|
||||
Reference in New Issue
Block a user