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/ipodpatcher.c | |
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/ipodpatcher.c')
-rw-r--r-- | rbutil/ipodpatcher/ipodpatcher.c | 24 |
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) | |||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | p = sectorbuf + x; | 1040 | p = sectorbuf + x; |
1041 | 1041 | ||
1042 | /* A hack to detect 2nd gen Nanos - maybe there is a better way? */ | ||
1043 | if (p[0] == 0) | ||
1044 | { | ||
1045 | n=ipod_read(ipod, sectorbuf, ipod->sector_size); | ||
1046 | if (n < 0) { | ||
1047 | fprintf(stderr,"[ERR] Read of directory failed.\n"); | ||
1048 | return -1; | ||
1049 | } | ||
1050 | p = sectorbuf; | ||
1051 | } | ||
1052 | |||
1042 | while ((ipod->nimages < MAX_IMAGES) && (p < (sectorbuf + x + 400)) && | 1053 | while ((ipod->nimages < MAX_IMAGES) && (p < (sectorbuf + x + 400)) && |
1043 | (memcmp(p,"!ATA",4)==0)) { | 1054 | ((memcmp(p,"!ATA",4)==0) || (memcmp(p,"DNAN",4)==0))) { |
1044 | p+=4; | 1055 | p+=4; |
1045 | if (memcmp(p,"soso",4)==0) { | 1056 | if (memcmp(p,"soso",4)==0) { |
1046 | ipod->ipod_directory[ipod->nimages].ftype=FTYPE_OSOS; | 1057 | ipod->ipod_directory[ipod->nimages].ftype=FTYPE_OSOS; |
@@ -1222,6 +1233,15 @@ int getmodel(struct ipod_t* ipod, int ipod_version) | |||
1222 | ipod->bootloader_len = LEN_ipodvideo; | 1233 | ipod->bootloader_len = LEN_ipodvideo; |
1223 | #endif | 1234 | #endif |
1224 | break; | 1235 | break; |
1236 | case 0x100: | ||
1237 | ipod->modelstr="2nd Generation Nano"; | ||
1238 | ipod->modelnum = 0; | ||
1239 | ipod->targetname = NULL; | ||
1240 | #ifdef WITH_BOOTOBJS | ||
1241 | ipod->bootloader = NULL; | ||
1242 | ipod->bootloader_len = 0; | ||
1243 | #endif | ||
1244 | break; | ||
1225 | default: | 1245 | default: |
1226 | ipod->modelname = NULL; | 1246 | ipod->modelname = NULL; |
1227 | ipod->modelnum = 0; | 1247 | ipod->modelnum = 0; |