diff options
Diffstat (limited to 'rbutil')
-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) | |||
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; |
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[]) | |||
348 | printf("[INFO] Ipod model: %s (\"%s\")\n",ipod.modelstr, | 348 | printf("[INFO] Ipod model: %s (\"%s\")\n",ipod.modelstr, |
349 | ipod.macpod ? "macpod" : "winpod"); | 349 | ipod.macpod ? "macpod" : "winpod"); |
350 | 350 | ||
351 | if (ipod.ipod_directory[0].vers == 0x10000) { | ||
352 | fprintf(stderr,"[ERR] *** ipodpatcher does not support the 2nd Generation Nano! ***\n"); | ||
353 | #ifdef WITH_BOOTOBJS | ||
354 | printf("Press ENTER to exit ipodpatcher :"); | ||
355 | fgets(yesno,4,stdin); | ||
356 | #endif | ||
357 | return 0; | ||
358 | } | ||
359 | |||
351 | if (ipod.macpod) { | 360 | if (ipod.macpod) { |
352 | print_macpod_warning(); | 361 | print_macpod_warning(); |
353 | } | 362 | } |