diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2008-04-15 23:17:03 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2008-04-15 23:17:03 +0000 |
commit | 620e6b4d933532c48a8995ab495b02505791c347 (patch) | |
tree | 76b48ab2cba2a359954ea613a6c5b86a8e3ce241 | |
parent | 1423e9c0bca5af31c00954585557e394304a5950 (diff) | |
download | rockbox-620e6b4d933532c48a8995ab495b02505791c347.tar.gz rockbox-620e6b4d933532c48a8995ab495b02505791c347.zip |
Gigabeat S bootloader: make it move a rockbox binary back to /.rockbox/ when it finds one in the MTP directory.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17133 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/gigabeat-s.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c index bb0d70e04a..e884e06219 100644 --- a/bootloader/gigabeat-s.c +++ b/bootloader/gigabeat-s.c @@ -141,10 +141,11 @@ void main(void) { char buf[MAX_PATH]; char tarstring[6]; + char model[5]; lcd_clear_display(); printf("Hello world!"); - printf("Gigabeat S Rockbox Bootloader v.00000004"); + printf("Gigabeat S Rockbox Bootloader v.00000005"); system_init(); kernel_init(); printf("kernel init done"); @@ -182,6 +183,25 @@ void main(void) fd = open(buf, O_RDONLY); if (fd >= 0) { + /* Check whether the file is a rockbox binary. */ + lseek(fd, 4, SEEK_SET); + rc = read(fd, model, 4); + if (rc == 4) + { + model[4] = 0; + if (strcmp(model, "gigs") == 0) + { + printf("Found rockbox binary. Moving..."); + close(fd); + remove("/.rockbox/rockbox.gigabeat"); + int ret = rename(buf, "/.rockbox/rockbox.gigabeat"); + printf("returned %d", ret); + sleep(100); + break; + } + } + + /* Check whether the file is a tar file. */ lseek(fd, 257, SEEK_SET); rc = read(fd, tarstring, 5); if (rc == 5) |