diff options
author | Dave Chapman <dave@dchapman.com> | 2007-08-03 02:12:32 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2007-08-03 02:12:32 +0000 |
commit | 564d249e66f56e962903659e71d4b5be17112388 (patch) | |
tree | 2ee8aa0ffcd4ce5fca9b4e67c27ea8fcc57c01d8 /rbutil/ipodpatcher | |
parent | e4d0f0e6383bdf8f654177fd0036537de88cd021 (diff) | |
download | rockbox-564d249e66f56e962903659e71d4b5be17112388.tar.gz 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')
-rw-r--r-- | rbutil/ipodpatcher/ipodpatcher.c | 24 | ||||
-rw-r--r-- | rbutil/ipodpatcher/main.c | 9 |
2 files changed, 31 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; diff --git a/rbutil/ipodpatcher/main.c b/rbutil/ipodpatcher/main.c index 24938931d6..c47063cba8 100644 --- a/rbutil/ipodpatcher/main.c +++ b/rbutil/ipodpatcher/main.c @@ -348,6 +348,15 @@ int main(int argc, char* argv[]) printf("[INFO] Ipod model: %s (\"%s\")\n",ipod.modelstr, ipod.macpod ? "macpod" : "winpod"); + if (ipod.ipod_directory[0].vers == 0x10000) { + fprintf(stderr,"[ERR] *** ipodpatcher does not support the 2nd Generation Nano! ***\n"); +#ifdef WITH_BOOTOBJS + printf("Press ENTER to exit ipodpatcher :"); + fgets(yesno,4,stdin); +#endif + return 0; + } + if (ipod.macpod) { print_macpod_warning(); } |