summaryrefslogtreecommitdiff
path: root/firmware/usbstack/usb_core.c
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2021-07-10 08:56:32 +0200
committerTomasz Moń <desowin@gmail.com>2021-07-10 08:56:32 +0200
commitb4ecd612f7184cbf23d83ef78b0ccb5ed2c318e3 (patch)
treed0c25f174efbfa49612b5bdb7d6f6adf3e146ed6 /firmware/usbstack/usb_core.c
parent663539619c05d9b429dfbea1e5d38d8bb043ee03 (diff)
downloadrockbox-b4ecd612f7184cbf23d83ef78b0ccb5ed2c318e3.tar.gz
rockbox-b4ecd612f7184cbf23d83ef78b0ccb5ed2c318e3.zip
Sansa Connect: Use deviceid in USB Serial Number
Atmel AT88SC6416C CryptoMemory is almost I2C compatible. The device is connected to bitbanged I2C bus shared with compliant I2C devices. Change-Id: Iec54702db1bdfb93c01291eef18ec60391c63b16
Diffstat (limited to 'firmware/usbstack/usb_core.c')
-rw-r--r--firmware/usbstack/usb_core.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index 3d187c8cab..b291dc7655 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -62,6 +62,10 @@
62#include "ocotp-imx233.h" 62#include "ocotp-imx233.h"
63#endif 63#endif
64 64
65#ifdef SANSA_CONNECT
66#include "cryptomem-sansaconnect.h"
67#endif
68
65#ifndef USB_MAX_CURRENT 69#ifndef USB_MAX_CURRENT
66#define USB_MAX_CURRENT 500 70#define USB_MAX_CURRENT 500
67#endif 71#endif
@@ -327,6 +331,22 @@ static void set_serial_descriptor(void)
327 } 331 }
328 usb_string_iSerial.bLength = 2 + 2 * (1 + IMX233_NUM_OCOTP_OPS * 8); 332 usb_string_iSerial.bLength = 2 + 2 * (1 + IMX233_NUM_OCOTP_OPS * 8);
329} 333}
334#elif defined(SANSA_CONNECT)
335static void set_serial_descriptor(void)
336{
337 char deviceid[32];
338 short* p = &usb_string_iSerial.wString[1];
339 int i;
340
341 if(!cryptomem_read_deviceid(deviceid)) {
342 for(i = 0; i < 32; i++) {
343 *p++ = deviceid[i];
344 }
345 usb_string_iSerial.bLength = 2 + 2 * (1 + 32);
346 } else {
347 device_descriptor.iSerialNumber = 0;
348 }
349}
330#elif (CONFIG_STORAGE & STORAGE_ATA) 350#elif (CONFIG_STORAGE & STORAGE_ATA)
331/* If we don't know the device serial number, use the one 351/* If we don't know the device serial number, use the one
332 * from the disk */ 352 * from the disk */