summaryrefslogtreecommitdiffstats
path: root/rbutil/ipodpatcher/ipodpatcher.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-08-03 02:12:32 +0000
committerDave Chapman <dave@dchapman.com>2007-08-03 02:12:32 +0000
commit564d249e66f56e962903659e71d4b5be17112388 (patch)
tree2ee8aa0ffcd4ce5fca9b4e67c27ea8fcc57c01d8 /rbutil/ipodpatcher/ipodpatcher.c
parente4d0f0e6383bdf8f654177fd0036537de88cd021 (diff)
downloadrockbox-564d249e66f56e962903659e71d4b5be17112388.tar.gz
rockbox-564d249e66f56e962903659e71d4b5be17112388.tar.bz2
rockbox-564d249e66f56e962903659e71d4b5be17112388.zip
Detect and reject 2nd Gen Nanos when scanning for ipods, instead of failing quietly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14152 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/ipodpatcher/ipodpatcher.c')
-rw-r--r--rbutil/ipodpatcher/ipodpatcher.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/rbutil/ipodpatcher/ipodpatcher.c b/rbutil/ipodpatcher/ipodpatcher.c
index 7459b5da87..40285aaaa5 100644
--- a/rbutil/ipodpatcher/ipodpatcher.c
+++ b/rbutil/ipodpatcher/ipodpatcher.c
@@ -1038,9 +1038,20 @@ int read_directory(struct ipod_t* ipod)
}
p = sectorbuf + x;
-
+
+ /* A hack to detect 2nd gen Nanos - maybe there is a better way? */
+ if (p[0] == 0)
+ {
+ n=ipod_read(ipod, sectorbuf, ipod->sector_size);
+ if (n < 0) {
+ fprintf(stderr,"[ERR] Read of directory failed.\n");
+ return -1;
+ }
+ p = sectorbuf;
+ }
+
while ((ipod->nimages < MAX_IMAGES) && (p < (sectorbuf + x + 400)) &&
- (memcmp(p,"!ATA",4)==0)) {
+ ((memcmp(p,"!ATA",4)==0) || (memcmp(p,"DNAN",4)==0))) {
p+=4;
if (memcmp(p,"soso",4)==0) {
ipod->ipod_directory[ipod->nimages].ftype=FTYPE_OSOS;
@@ -1222,6 +1233,15 @@ int getmodel(struct ipod_t* ipod, int ipod_version)
ipod->bootloader_len = LEN_ipodvideo;
#endif
break;
+ case 0x100:
+ ipod->modelstr="2nd Generation Nano";
+ ipod->modelnum = 0;
+ ipod->targetname = NULL;
+#ifdef WITH_BOOTOBJS
+ ipod->bootloader = NULL;
+ ipod->bootloader_len = 0;
+#endif
+ break;
default:
ipod->modelname = NULL;
ipod->modelnum = 0;