summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-07 22:58:20 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-07 22:58:20 +0000
commit059255705b8e7e7eb787f74ad617cfbc190a2910 (patch)
tree4c9ab8e8c56109d4677119a81462e9aa867fb9ca
parent8b77ce2d61b5d4dd6a446498a2df295ce5b273c9 (diff)
downloadrockbox-059255705b8e7e7eb787f74ad617cfbc190a2910.tar.gz
rockbox-059255705b8e7e7eb787f74ad617cfbc190a2910.zip
Fix SCSI inquiry on W32.
W32 returns additional bytes containing garbage on pages returning the maximum amount (i.e. 255) of bytes. Ignoring those bytes makes the output being correct. Someone needs to find out why those additional bytes are indicated at all. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22199 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/ipodpatcher/ipodio-win32-scsi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rbutil/ipodpatcher/ipodio-win32-scsi.c b/rbutil/ipodpatcher/ipodio-win32-scsi.c
index 5843ce5d2f..81e2023f75 100644
--- a/rbutil/ipodpatcher/ipodio-win32-scsi.c
+++ b/rbutil/ipodpatcher/ipodio-win32-scsi.c
@@ -110,7 +110,10 @@ int ipod_scsi_inquiry(struct ipod_t* ipod, int page_code,
110 FALSE); 110 FALSE);
111 111
112 if (status) { 112 if (status) {
113 memcpy(buf, sptwb.DataBuf, returned); 113 /* W32 sometimes returns more bytes with additional garbage.
114 * Make sure to not copy that garbage. */
115 memcpy(buf, sptwb.DataBuf,
116 (DWORD)bufsize >= returned ? returned : (DWORD)bufsize);
114 return 0; 117 return 0;
115 } else { 118 } else {
116 return -1; 119 return -1;