File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
cores/arduino/Adafruit_TinyUSB_Core Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ static void usb_hardware_init(void)
84
84
85
85
uint8_t load_serial_number (uint16_t * serial_str)
86
86
{
87
+ enum { SERIAL_BYTE_LEN = 16 };
88
+
87
89
#ifdef __SAMD51__
88
90
uint32_t * id_addresses[4 ] = {(uint32_t *) 0x008061FC , (uint32_t *) 0x00806010 ,
89
91
(uint32_t *) 0x00806014 , (uint32_t *) 0x00806018 };
@@ -93,7 +95,7 @@ uint8_t load_serial_number(uint16_t* serial_str)
93
95
94
96
#endif
95
97
96
- uint8_t raw_id[16 ];
98
+ uint8_t raw_id[SERIAL_BYTE_LEN ];
97
99
98
100
for (int i=0 ; i<4 ; i++) {
99
101
for (int k=0 ; k<4 ; k++) {
@@ -111,7 +113,7 @@ uint8_t load_serial_number(uint16_t* serial_str)
111
113
}
112
114
}
113
115
114
- return 16 ;
116
+ return sizeof (raw_id)* 2 ;
115
117
}
116
118
117
119
void Adafruit_TinyUSB_Core_init (void )
Original file line number Diff line number Diff line change @@ -164,7 +164,8 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
164
164
return USBDevice._desc_cfg ;
165
165
}
166
166
167
- static uint16_t _desc_str[32 ];
167
+ // up to 32 unicode characters (header make it 33)
168
+ static uint16_t _desc_str[33 ];
168
169
169
170
// Invoked when received GET STRING DESCRIPTOR request
170
171
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
@@ -187,7 +188,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index)
187
188
188
189
// cap at max char
189
190
chr_count = strlen (str);
190
- if ( chr_count > 31 ) chr_count = 31 ;
191
+ if ( chr_count > 32 ) chr_count = 32 ;
191
192
192
193
for (uint8_t i=0 ; i<chr_count; i++)
193
194
{
You can’t perform that action at this time.
0 commit comments