diff options
Diffstat (limited to 'rbutil/ipodpatcher')
-rw-r--r-- | rbutil/ipodpatcher/ipodpatcher.c | 16 |
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); |