summaryrefslogtreecommitdiffstats
path: root/rbutil/sansapatcher/main.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-08-02 11:39:43 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-08-02 11:39:43 +0000
commit6a0ec8bfa86e7fcf02a9179dc8adbf2f0e25e6e7 (patch)
tree6a166b874002517a623556b5fc396ac6cb967a44 /rbutil/sansapatcher/main.c
parent744f07f55439bc4b5d99d4fe0082ab640aad476c (diff)
downloadrockbox-6a0ec8bfa86e7fcf02a9179dc8adbf2f0e25e6e7.tar.gz
rockbox-6a0ec8bfa86e7fcf02a9179dc8adbf2f0e25e6e7.zip
Add --update-original-firmware (or -of) option to sansapatcher. This allows for changing the original firmware version when the rockbox bootloader is also present.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14138 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/sansapatcher/main.c')
-rw-r--r--rbutil/sansapatcher/main.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/rbutil/sansapatcher/main.c b/rbutil/sansapatcher/main.c
index 4f2a5fe226..a675cd80b6 100644
--- a/rbutil/sansapatcher/main.c
+++ b/rbutil/sansapatcher/main.c
@@ -47,7 +47,8 @@ enum {
READ_FIRMWARE,
WRITE_FIRMWARE,
READ_PARTITION,
- WRITE_PARTITION
+ WRITE_PARTITION,
+ UPDATE_OF
};
void print_usage(void)
@@ -62,9 +63,10 @@ void print_usage(void)
fprintf(stderr,"Where [action] is one of the following options:\n");
fprintf(stderr," --install\n");
fprintf(stderr," -l, --list\n");
- fprintf(stderr," -rf, --read-firmware filename.mi4\n");
- fprintf(stderr," -a, --add-bootloader filename.mi4\n");
+ fprintf(stderr," -rf, --read-firmware filename.mi4\n");
+ fprintf(stderr," -a, --add-bootloader filename.mi4\n");
fprintf(stderr," -d, --delete-bootloader\n");
+ fprintf(stderr," -of --update-original-firmware filename.mi4\n");
fprintf(stderr,"\n");
#ifdef __WIN32__
@@ -216,6 +218,13 @@ int main(int argc, char* argv[])
if (i == argc) { print_usage(); return 1; }
filename=argv[i];
i++;
+ } else if ((strcmp(argv[i],"-of")==0) ||
+ (strcmp(argv[i],"--update-original-firmware")==0)) {
+ action = UPDATE_OF;
+ i++;
+ if (i == argc) { print_usage(); return 1; }
+ filename=argv[i];
+ i++;
} else if ((strcmp(argv[i],"-rf")==0) ||
(strcmp(argv[i],"--read-firmware")==0)) {
action = READ_FIRMWARE;
@@ -326,6 +335,16 @@ int main(int argc, char* argv[])
} else {
fprintf(stderr,"[ERR] --delete-bootloader failed.\n");
}
+ } else if (action==UPDATE_OF) {
+ if (sansa_reopen_rw(&sansa) < 0) {
+ return 5;
+ }
+
+ if (sansa_update_of(&sansa, filename)==0) {
+ fprintf(stderr,"[INFO] OF updated successfully.\n");
+ } else {
+ fprintf(stderr,"[ERR] --update-original-firmware failed.\n");
+ }
}
}