diff options
-rw-r--r-- | apps/debug_menu.c | 58 | ||||
-rw-r--r-- | apps/debug_menu.h | 1 | ||||
-rw-r--r-- | apps/main.c | 11 | ||||
-rw-r--r-- | firmware/common/disk.c | 6 | ||||
-rw-r--r-- | firmware/common/disk.h | 1 |
5 files changed, 75 insertions, 2 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 670f965eb2..dca95d6cf7 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "powermgmt.h" | 36 | #include "powermgmt.h" |
37 | #include "system.h" | 37 | #include "system.h" |
38 | #include "font.h" | 38 | #include "font.h" |
39 | #include "disk.h" | ||
39 | 40 | ||
40 | /*---------------------------------------------------*/ | 41 | /*---------------------------------------------------*/ |
41 | /* SPECIAL DEBUG STUFF */ | 42 | /* SPECIAL DEBUG STUFF */ |
@@ -261,6 +262,62 @@ bool dbg_hw_info(void) | |||
261 | } | 262 | } |
262 | #endif | 263 | #endif |
263 | 264 | ||
265 | bool dbg_partitions(void) | ||
266 | { | ||
267 | int partition=0; | ||
268 | |||
269 | lcd_clear_display(); | ||
270 | lcd_puts(0, 0, "Partition"); | ||
271 | lcd_puts(0, 1, "list"); | ||
272 | lcd_update(); | ||
273 | sleep(HZ); | ||
274 | |||
275 | while(1) | ||
276 | { | ||
277 | char buf[32]; | ||
278 | int button; | ||
279 | struct partinfo* p = disk_partinfo(partition); | ||
280 | |||
281 | lcd_clear_display(); | ||
282 | snprintf(buf, sizeof buf, "P%d: S:%x", partition, p->start); | ||
283 | lcd_puts(0, 0, buf); | ||
284 | snprintf(buf, sizeof buf, "T:%x %d MB", p->type, p->size / 2048); | ||
285 | lcd_puts(0, 1, buf); | ||
286 | lcd_update(); | ||
287 | |||
288 | button = button_get(true); | ||
289 | |||
290 | switch(button) | ||
291 | { | ||
292 | #ifdef HAVE_RECORDER_KEYPAD | ||
293 | case BUTTON_OFF: | ||
294 | #else | ||
295 | case BUTTON_STOP: | ||
296 | #endif | ||
297 | return false; | ||
298 | |||
299 | #ifdef HAVE_RECORDER_KEYPAD | ||
300 | case BUTTON_UP: | ||
301 | #endif | ||
302 | case BUTTON_LEFT: | ||
303 | partition--; | ||
304 | if (partition < 0) | ||
305 | partition = 3; | ||
306 | break; | ||
307 | |||
308 | #ifdef HAVE_RECORDER_KEYPAD | ||
309 | case BUTTON_DOWN: | ||
310 | #endif | ||
311 | case BUTTON_RIGHT: | ||
312 | partition++; | ||
313 | if (partition > 3) | ||
314 | partition = 0; | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | return false; | ||
319 | } | ||
320 | |||
264 | #ifdef HAVE_LCD_BITMAP | 321 | #ifdef HAVE_LCD_BITMAP |
265 | /* Test code!!! */ | 322 | /* Test code!!! */ |
266 | bool dbg_ports(void) | 323 | bool dbg_ports(void) |
@@ -910,6 +967,7 @@ bool debug_menu(void) | |||
910 | { "View battery", view_battery }, | 967 | { "View battery", view_battery }, |
911 | #endif | 968 | #endif |
912 | { "View HW info", dbg_hw_info }, | 969 | { "View HW info", dbg_hw_info }, |
970 | { "View partitions", dbg_partitions }, | ||
913 | }; | 971 | }; |
914 | 972 | ||
915 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | 973 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); |
diff --git a/apps/debug_menu.h b/apps/debug_menu.h index 9b4841f653..4b2c193662 100644 --- a/apps/debug_menu.h +++ b/apps/debug_menu.h | |||
@@ -27,5 +27,6 @@ extern bool dbg_ports(void); | |||
27 | extern bool dbg_rtc(void); | 27 | extern bool dbg_rtc(void); |
28 | #endif | 28 | #endif |
29 | #endif | 29 | #endif |
30 | extern bool dbg_partitions(void); | ||
30 | 31 | ||
31 | #endif | 32 | #endif |
diff --git a/apps/main.c b/apps/main.c index dedeea7a43..30d5f0878a 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -141,8 +141,15 @@ void init(void) | |||
141 | if ( i==4 ) { | 141 | if ( i==4 ) { |
142 | DEBUGF("No partition found, trying to mount sector 0.\n"); | 142 | DEBUGF("No partition found, trying to mount sector 0.\n"); |
143 | rc = fat_mount(0); | 143 | rc = fat_mount(0); |
144 | if(rc) | 144 | if(rc) { |
145 | panicf("No FAT32 partition!"); | 145 | lcd_clear_display(); |
146 | lcd_puts(0,0,"No FAT32"); | ||
147 | lcd_puts(0,1,"partition!"); | ||
148 | lcd_update(); | ||
149 | sleep(HZ); | ||
150 | while(1) | ||
151 | dbg_partitions(); | ||
152 | } | ||
146 | } | 153 | } |
147 | 154 | ||
148 | settings_load(); | 155 | settings_load(); |
diff --git a/firmware/common/disk.c b/firmware/common/disk.c index b662072d5f..b85f460a69 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c | |||
@@ -73,3 +73,9 @@ struct partinfo* disk_init(void) | |||
73 | 73 | ||
74 | return part; | 74 | return part; |
75 | } | 75 | } |
76 | |||
77 | struct partinfo* disk_partinfo(int partition) | ||
78 | { | ||
79 | return &part[partition]; | ||
80 | } | ||
81 | |||
diff --git a/firmware/common/disk.h b/firmware/common/disk.h index 2d97e43d09..865b7bb4b4 100644 --- a/firmware/common/disk.h +++ b/firmware/common/disk.h | |||
@@ -30,5 +30,6 @@ struct partinfo { | |||
30 | 30 | ||
31 | /* returns a pointer to an array of 8 partinfo structs */ | 31 | /* returns a pointer to an array of 8 partinfo structs */ |
32 | struct partinfo* disk_init(void); | 32 | struct partinfo* disk_init(void); |
33 | struct partinfo* disk_partinfo(int partition); | ||
33 | 34 | ||
34 | #endif | 35 | #endif |