summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/usbstack/usb_core.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index cc26e906e8..801325b692 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -58,6 +58,10 @@
58#include "ata.h" 58#include "ata.h"
59#endif 59#endif
60 60
61#if (CONFIG_CPU == IMX233)
62#include "ocotp-imx233.h"
63#endif
64
61#ifndef USB_MAX_CURRENT 65#ifndef USB_MAX_CURRENT
62#define USB_MAX_CURRENT 500 66#define USB_MAX_CURRENT 500
63#endif 67#endif
@@ -278,6 +282,16 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req);
278 282
279static unsigned char response_data[256] USB_DEVBSS_ATTR; 283static unsigned char response_data[256] USB_DEVBSS_ATTR;
280 284
285/** NOTE Serial Number
286 * The serial number string is split into two parts:
287 * - the first character indicates the set of interfaces enabled
288 * - the other characters form a (hopefully) unique device-specific number
289 * The implementation of set_serial_descriptor should left the first character
290 * of usb_string_iSerial unused, ie never write to
291 * usb_string_iSerial.wString[0] but should take it into account when
292 * computing the length of the descriptor
293 */
294
281static const short hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', 295static const short hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
282 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; 296 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
283#ifdef IPOD_ARCH 297#ifdef IPOD_ARCH
@@ -319,6 +333,19 @@ static void set_serial_descriptor(void)
319 } 333 }
320 usb_string_iSerial.bLength = 36 + (2 * AS3514_UID_LEN); 334 usb_string_iSerial.bLength = 36 + (2 * AS3514_UID_LEN);
321} 335}
336#elif (CONFIG_CPU == IMX233)
337static void set_serial_descriptor(void)
338{
339 short* p = &usb_string_iSerial.wString[1];
340 for(int i = 0; i < IMX233_NUM_OCOTP_OPS; i++) {
341 uint32_t ops = imx233_ocotp_read(&HW_OCOTP_OPSx(i));
342 for(int j = 0; j < 8; j++) {
343 *p++ = hex[(ops >> 28) & 0xF];
344 ops <<= 4;
345 }
346 }
347 usb_string_iSerial.bLength = 2 + 2 * (1 + IMX233_NUM_OCOTP_OPS * 8);
348}
322#elif (CONFIG_STORAGE & STORAGE_ATA) 349#elif (CONFIG_STORAGE & STORAGE_ATA)
323/* If we don't know the device serial number, use the one 350/* If we don't know the device serial number, use the one
324 * from the disk */ 351 * from the disk */