@@ -244,26 +244,25 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup)
244
244
}
245
245
else if (setup.wValueL == ISERIAL) {
246
246
#ifdef PLUGGABLE_USB_ENABLED
247
- #if defined(__SAMD51__)
248
- char name[ISERIAL_MAX_LEN];
249
- PluggableUSB ().getShortName (name);
250
- return sendStringDescriptor ((uint8_t *)name, setup.wLength );
251
- #else
247
+ #ifdef __SAMD51__
248
+ #define SERIAL_NUMBER_WORD_0 *(volatile uint32_t *)(0x008061FC )
249
+ #define SERIAL_NUMBER_WORD_1 *(volatile uint32_t *)(0x00806010 )
250
+ #define SERIAL_NUMBER_WORD_2 *(volatile uint32_t *)(0x00806014 )
251
+ #define SERIAL_NUMBER_WORD_3 *(volatile uint32_t *)(0x00806018 )
252
+ #else // samd21
252
253
// from section 9.3.3 of the datasheet
253
254
#define SERIAL_NUMBER_WORD_0 *(volatile uint32_t *)(0x0080A00C )
254
255
#define SERIAL_NUMBER_WORD_1 *(volatile uint32_t *)(0x0080A040 )
255
256
#define SERIAL_NUMBER_WORD_2 *(volatile uint32_t *)(0x0080A044 )
256
257
#define SERIAL_NUMBER_WORD_3 *(volatile uint32_t *)(0x0080A048 )
257
-
258
+ # endif
258
259
char name[ISERIAL_MAX_LEN];
259
260
utox8 (SERIAL_NUMBER_WORD_0, &name[0 ]);
260
261
utox8 (SERIAL_NUMBER_WORD_1, &name[8 ]);
261
262
utox8 (SERIAL_NUMBER_WORD_2, &name[16 ]);
262
263
utox8 (SERIAL_NUMBER_WORD_3, &name[24 ]);
263
-
264
- PluggableUSB ().getShortName (&name[32 ]);
264
+ name[32 ] = ' \0 ' ;
265
265
return sendStringDescriptor ((uint8_t *)name, setup.wLength );
266
- #endif
267
266
#endif
268
267
}
269
268
else {
0 commit comments