From 9fda39d1ad2302a17349c01b5104900468baac31 Mon Sep 17 00:00:00 2001 From: Vencislav Atanasov Date: Sun, 23 Jun 2024 05:24:04 +0300 Subject: Prevent using PP-based iPods' set_serial_descriptor on S5L87xx-based ones On PortalPlayer iPods, it looks like the serial number is available in a specific memory location. When adding support for Samsung S5L87xx-based iPods, this algorithm has not been limited to PP-only, so it sets the serial number USB descriptor to random memory data. With this change, it will use the ATA HDD serial number on iPod 6G. On Nano 2G it won't provide a serial number at all. Change-Id: I53d48915d629dbd87b2dbbcba5f228ca5949fa9b --- firmware/usbstack/usb_core.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 9fe8b3e603..d37604f492 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c @@ -50,21 +50,17 @@ /* TODO: Move target-specific stuff somewhere else (serial number reading) */ -#ifdef HAVE_AS3514 +#if defined(IPOD_ARCH) && defined(CPU_PP) +// no need to include anything +#elif defined(HAVE_AS3514) #include "ascodec.h" #include "as3514.h" -#endif - -#if !defined(HAVE_AS3514) && !defined(IPOD_ARCH) && (CONFIG_STORAGE & STORAGE_ATA) -#include "ata.h" -#endif - -#if (CONFIG_CPU == IMX233) +#elif (CONFIG_CPU == IMX233) && IMX233_SUBTARGET >= 3700 #include "ocotp-imx233.h" -#endif - -#ifdef SANSA_CONNECT +#elif defined(SANSA_CONNECT) #include "cryptomem-sansaconnect.h" +#elif (CONFIG_STORAGE & STORAGE_ATA) +#include "ata.h" #endif #ifndef USB_MAX_CURRENT @@ -287,7 +283,7 @@ static unsigned char response_data[256] USB_DEVBSS_ATTR; static const short hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; -#ifdef IPOD_ARCH +#if defined(IPOD_ARCH) && defined(CPU_PP) static void set_serial_descriptor(void) { #ifdef IPOD_VIDEO -- cgit v1.2.3