1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Tomasz Moń 2021-07-10 08:56:32 +02:00
parent 663539619c
commit b4ecd612f7
No known key found for this signature in database
GPG key ID: 92BA8820D4D517C8
8 changed files with 183 additions and 0 deletions

View file

@ -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 */