From fe4ffbd94c80b764cea140294c23a18d239715c0 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Mon, 11 Feb 2008 18:08:21 +0000 Subject: [PATCH] Optimise (replace two loops with one) and bug-fix the ProductId string returned by SCSI Inquiry - the previous code was skipping 4 shorts (the first 8 chars) of the ProductId. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16285 a1c6a512-1295-4272-9138-f99709370657 --- firmware/usbstack/usb_storage.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index c32c9df7f7..a1faf3d1c4 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -486,15 +486,11 @@ static void identify2inquiry(int lun) inquiry->DeviceTypeModifier = DEVICE_REMOVABLE; /* ATA only has a 'model' field, so we copy the - first 8 bytes to 'vendor' and the rest to 'product' */ + first 8 bytes to 'vendor' and the rest to 'product' (they are + consecutive in the inquiry struct) */ src = (unsigned short*)&identify[27]; dest = (unsigned short*)&inquiry->VendorId; - for (i=0;i<4;i++) - dest[i] = htobe16(src[i]); - - src = (unsigned short*)&identify[27+8]; - dest = (unsigned short*)&inquiry->ProductId; - for (i=0;i<8;i++) + for (i=0;i<12;i++) dest[i] = htobe16(src[i]); src = (unsigned short*)&identify[23];