summaryrefslogtreecommitdiffstats
path: root/rbutil/ipodpatcher
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-11-22 16:35:35 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-11-22 16:35:35 +0000
commitbbfe57377c429e7d91d04353c916fd404623ed24 (patch)
treeb7d8b7bc9977c752202059fa73abc83945d05c20 /rbutil/ipodpatcher
parent82165b5cf7f63ed12daca5fb6361ccd24b729308 (diff)
downloadrockbox-bbfe57377c429e7d91d04353c916fd404623ed24.tar.gz
rockbox-bbfe57377c429e7d91d04353c916fd404623ed24.tar.bz2
rockbox-bbfe57377c429e7d91d04353c916fd404623ed24.zip
FS#9833: Fix Ipods being wrongly detected as MacPods on OS X
- when scanning for Ipods save the complete ipod_t structure on match. Only saving the disk name can result in the structure holding a disk name not matching the rest of the structure. This lead to wrong detection of macpod on OS X, as Mac drives might get detected later. - reopen the Ipod in RW mode on scanning on W32 only. On OS X reopening also unmounts the player, which in turn makes resolving the mount point fail. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23707 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/ipodpatcher')
-rw-r--r--rbutil/ipodpatcher/ipodpatcher.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/rbutil/ipodpatcher/ipodpatcher.c b/rbutil/ipodpatcher/ipodpatcher.c
index dc023f0a51..e7872c0978 100644
--- a/rbutil/ipodpatcher/ipodpatcher.c
+++ b/rbutil/ipodpatcher/ipodpatcher.c
@@ -1737,7 +1737,7 @@ int ipod_scan(struct ipod_t* ipod)
int i;
int n = 0;
int ipod_version;
- char last_ipod[4096];
+ struct ipod_t ipod_found;
int denied = 0;
int result;
@@ -1780,9 +1780,13 @@ int ipod_scan(struct ipod_t* ipod)
}
ipod_version=(ipod->ipod_directory[ipod->ososimage].vers>>8);
- /* Windows requires the ipod in R/W mode for SCSI Inquiry */
ipod->ramsize = 0;
+#ifdef __WIN32__
+ /* Windows requires the ipod in R/W mode for SCSI Inquiry.
+ * ipod_reopen_rw does unmount the player on OS X so do this on
+ * W32 only during scanning. */
ipod_reopen_rw(ipod);
+#endif
ipod_get_xmlinfo(ipod);
ipod_get_ramsize(ipod);
if (getmodel(ipod,ipod_version) < 0) {
@@ -1798,13 +1802,15 @@ int ipod_scan(struct ipod_t* ipod)
ipod->modelstr,ipod->macpod ? "macpod" : "winpod",ipod->diskname);
#endif
n++;
- strcpy(last_ipod,ipod->diskname);
+ /* save the complete ipod_t structure for match. The for loop might
+ * overwrite it, so we need to restore it later if only one found. */
+ memcpy(&ipod_found, ipod, sizeof(struct ipod_t));
ipod_close(ipod);
}
if (n==1) {
- /* Remember the disk name */
- strcpy(ipod->diskname,last_ipod);
+ /* restore the ipod_t structure, it might have been overwritten */
+ memcpy(ipod, &ipod_found, sizeof(struct ipod_t));
}
else if(n == 0 && denied) {
printf("[ERR] FATAL: Permission denied on %d device(s) and no ipod detected.\n", denied);