summaryrefslogtreecommitdiff
path: root/firmware/usbstack
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
parent663539619c05d9b429dfbea1e5d38d8bb043ee03 (diff)
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')
-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 @@
#include "ocotp-imx233.h"
#endif
+#ifdef SANSA_CONNECT
+#include "cryptomem-sansaconnect.h"
+#endif
+
#ifndef USB_MAX_CURRENT
#define USB_MAX_CURRENT 500
#endif
@@ -327,6 +331,22 @@ static void set_serial_descriptor(void)
}
usb_string_iSerial.bLength = 2 + 2 * (1 + IMX233_NUM_OCOTP_OPS * 8);
}
+#elif defined(SANSA_CONNECT)
+static void set_serial_descriptor(void)
+{
+ char deviceid[32];
+ short* p = &usb_string_iSerial.wString[1];
+ int i;
+
+ if(!cryptomem_read_deviceid(deviceid)) {
+ for(i = 0; i < 32; i++) {
+ *p++ = deviceid[i];
+ }
+ usb_string_iSerial.bLength = 2 + 2 * (1 + 32);
+ } else {
+ device_descriptor.iSerialNumber = 0;
+ }
+}
#elif (CONFIG_STORAGE & STORAGE_ATA)
/* If we don't know the device serial number, use the one
* from the disk */