summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/ipodpatcher/ipodpatcher.c24
-rw-r--r--rbutil/ipodpatcher/main.c9
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();
}