summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2008-04-15 23:17:03 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2008-04-15 23:17:03 +0000
commit620e6b4d933532c48a8995ab495b02505791c347 (patch)
tree76b48ab2cba2a359954ea613a6c5b86a8e3ce241
parent1423e9c0bca5af31c00954585557e394304a5950 (diff)
downloadrockbox-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.c22
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)
141{ 141{
142 char buf[MAX_PATH]; 142 char buf[MAX_PATH];
143 char tarstring[6]; 143 char tarstring[6];
144 char model[5];
144 145
145 lcd_clear_display(); 146 lcd_clear_display();
146 printf("Hello world!"); 147 printf("Hello world!");
147 printf("Gigabeat S Rockbox Bootloader v.00000004"); 148 printf("Gigabeat S Rockbox Bootloader v.00000005");
148 system_init(); 149 system_init();
149 kernel_init(); 150 kernel_init();
150 printf("kernel init done"); 151 printf("kernel init done");
@@ -182,6 +183,25 @@ void main(void)
182 fd = open(buf, O_RDONLY); 183 fd = open(buf, O_RDONLY);
183 if (fd >= 0) 184 if (fd >= 0)
184 { 185 {
186 /* Check whether the file is a rockbox binary. */
187 lseek(fd, 4, SEEK_SET);
188 rc = read(fd, model, 4);
189 if (rc == 4)
190 {
191 model[4] = 0;
192 if (strcmp(model, "gigs") == 0)
193 {
194 printf("Found rockbox binary. Moving...");
195 close(fd);
196 remove("/.rockbox/rockbox.gigabeat");
197 int ret = rename(buf, "/.rockbox/rockbox.gigabeat");
198 printf("returned %d", ret);
199 sleep(100);
200 break;
201 }
202 }
203
204 /* Check whether the file is a tar file. */
185 lseek(fd, 257, SEEK_SET); 205 lseek(fd, 257, SEEK_SET);
186 rc = read(fd, tarstring, 5); 206 rc = read(fd, tarstring, 5);
187 if (rc == 5) 207 if (rc == 5)