summaryrefslogtreecommitdiff
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.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)
1737 int i; 1737 int i;
1738 int n = 0; 1738 int n = 0;
1739 int ipod_version; 1739 int ipod_version;
1740 char last_ipod[4096]; 1740 struct ipod_t ipod_found;
1741 int denied = 0; 1741 int denied = 0;
1742 int result; 1742 int result;
1743 1743
@@ -1780,9 +1780,13 @@ int ipod_scan(struct ipod_t* ipod)
1780 } 1780 }
1781 1781
1782 ipod_version=(ipod->ipod_directory[ipod->ososimage].vers>>8); 1782 ipod_version=(ipod->ipod_directory[ipod->ososimage].vers>>8);
1783 /* Windows requires the ipod in R/W mode for SCSI Inquiry */
1784 ipod->ramsize = 0; 1783 ipod->ramsize = 0;
1784#ifdef __WIN32__
1785 /* Windows requires the ipod in R/W mode for SCSI Inquiry.
1786 * ipod_reopen_rw does unmount the player on OS X so do this on
1787 * W32 only during scanning. */
1785 ipod_reopen_rw(ipod); 1788 ipod_reopen_rw(ipod);
1789#endif
1786 ipod_get_xmlinfo(ipod); 1790 ipod_get_xmlinfo(ipod);
1787 ipod_get_ramsize(ipod); 1791 ipod_get_ramsize(ipod);
1788 if (getmodel(ipod,ipod_version) < 0) { 1792 if (getmodel(ipod,ipod_version) < 0) {
@@ -1798,13 +1802,15 @@ int ipod_scan(struct ipod_t* ipod)
1798 ipod->modelstr,ipod->macpod ? "macpod" : "winpod",ipod->diskname); 1802 ipod->modelstr,ipod->macpod ? "macpod" : "winpod",ipod->diskname);
1799#endif 1803#endif
1800 n++; 1804 n++;
1801 strcpy(last_ipod,ipod->diskname); 1805 /* save the complete ipod_t structure for match. The for loop might
1806 * overwrite it, so we need to restore it later if only one found. */
1807 memcpy(&ipod_found, ipod, sizeof(struct ipod_t));
1802 ipod_close(ipod); 1808 ipod_close(ipod);
1803 } 1809 }
1804 1810
1805 if (n==1) { 1811 if (n==1) {
1806 /* Remember the disk name */ 1812 /* restore the ipod_t structure, it might have been overwritten */
1807 strcpy(ipod->diskname,last_ipod); 1813 memcpy(ipod, &ipod_found, sizeof(struct ipod_t));
1808 } 1814 }
1809 else if(n == 0 && denied) { 1815 else if(n == 0 && denied) {
1810 printf("[ERR] FATAL: Permission denied on %d device(s) and no ipod detected.\n", denied); 1816 printf("[ERR] FATAL: Permission denied on %d device(s) and no ipod detected.\n", denied);