summaryrefslogtreecommitdiff
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-02-11 18:08:21 +0000
committerDave Chapman <dave@dchapman.com>2008-02-11 18:08:21 +0000
commitfe4ffbd94c80b764cea140294c23a18d239715c0 (patch)
treef5538d0cfffcc88cd5f3a95ff73ae96a164aa572 /firmware/usbstack
parent5f641ed3c2194b44b053bf963069a76d6f6c4b2c (diff)
downloadrockbox-fe4ffbd94c80b764cea140294c23a18d239715c0.zip
rockbox-fe4ffbd94c80b764cea140294c23a18d239715c0.tar.gz
rockbox-fe4ffbd94c80b764cea140294c23a18d239715c0.tar.bz2
rockbox-fe4ffbd94c80b764cea140294c23a18d239715c0.tar.xz
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
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/usb_storage.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index c32c9df..a1faf3d 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];