Fix interface strings when are not all enabled.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-01-26 01:19:56 +01:00
parent 50488cc890
commit 20f2b3b74b
2 changed files with 11 additions and 1 deletions

View File

@@ -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) {