summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/main.c34
-rw-r--r--apps/main_menu.c2
-rw-r--r--apps/settings.c5
-rw-r--r--apps/tree.c7
-rw-r--r--apps/tree.h2
5 files changed, 40 insertions, 10 deletions
diff --git a/apps/main.c b/apps/main.c
index ac84027362..572e0a3114 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -101,6 +101,9 @@ int main(void)
101#ifdef CONFIG_TUNER 101#ifdef CONFIG_TUNER
102#include "radio.h" 102#include "radio.h"
103#endif 103#endif
104#ifdef HAVE_MMC
105#include "ata_mmc.h"
106#endif
104 107
105/*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ 108/*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
106 109
@@ -236,7 +239,8 @@ void init(void)
236 239
237 usb_start_monitoring(); 240 usb_start_monitoring();
238 241
239 pinfo = disk_init(); 242 /* FixMe: the same kind of mounting happens in usb.c, share the code. */
243 pinfo = disk_init(IF_MV(0));
240 if (!pinfo) 244 if (!pinfo)
241 { 245 {
242 lcd_clear_display(); 246 lcd_clear_display();
@@ -252,14 +256,15 @@ void init(void)
252 system_reboot(); 256 system_reboot();
253 } 257 }
254 258
259 fat_init();
255 for ( i=0; i<4; i++ ) { 260 for ( i=0; i<4; i++ ) {
256 if (!fat_mount(pinfo[i].start)) 261 if (!fat_mount(IF_MV2(0,) IF_MV2(0,) pinfo[i].start))
257 break; 262 break; /* only one partition gets mounted as of now */
258 } 263 }
259 264
260 if ( i==4 ) { 265 if ( i==4 ) {
261 DEBUGF("No partition found, trying to mount sector 0.\n"); 266 DEBUGF("No partition found, trying to mount sector 0.\n");
262 rc = fat_mount(0); 267 rc = fat_mount(IF_MV2(0,) IF_MV2(0,) 0);
263 if(rc) { 268 if(rc) {
264 lcd_clear_display(); 269 lcd_clear_display();
265 lcd_puts(0,0,"No FAT32"); 270 lcd_puts(0,0,"No FAT32");
@@ -272,7 +277,26 @@ void init(void)
272 /* The USB thread will panic if the drive still can't be mounted */ 277 /* The USB thread will panic if the drive still can't be mounted */
273 } 278 }
274 } 279 }
275 280#ifdef HAVE_MULTIVOLUME
281 /* mount partition on the optional volume */
282#ifdef HAVE_MMC
283 if (mmc_detect()) /* for Ondio, only if card detected */
284#endif
285 {
286 pinfo = disk_init(1);
287 if (pinfo)
288 {
289 for ( i=0; i<4; i++ ) {
290 if (!fat_mount(1, 1, pinfo[i].start))
291 break; /* only one partition gets mounted as of now */
292 }
293
294 if ( i==4 ) {
295 rc = fat_mount(1, 1, 0);
296 }
297 }
298 }
299#endif /* #ifdef HAVE_MULTIVOLUME */
276 settings_calc_config_sector(); 300 settings_calc_config_sector();
277 settings_load(SETTINGS_ALL); 301 settings_load(SETTINGS_ALL);
278 settings_apply(); 302 settings_apply();
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 1c27f752ce..68e2a03048 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -146,7 +146,7 @@ bool show_info(void)
146 int state = 1; 146 int state = 1;
147 unsigned int size, free; 147 unsigned int size, free;
148 148
149 fat_size( &size, &free ); 149 fat_size( IF_MV2(0,) &size, &free );
150 size /= 1024; 150 size /= 1024;
151 free /= 1024; 151 free /= 1024;
152 152
diff --git a/apps/settings.c b/apps/settings.c
index ff9c57d136..d4945d4431 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -513,8 +513,7 @@ static int load_config_buffer(int which)
513 if (which & SETTINGS_HD) 513 if (which & SETTINGS_HD)
514 { 514 {
515 if (config_sector != 0) { 515 if (config_sector != 0) {
516 ata_read_sectors( config_sector, 1, config_block); 516 ata_read_sectors(IF_MV2(0,) config_sector, 1, config_block);
517
518 /* calculate the checksum, check it and the header */ 517 /* calculate the checksum, check it and the header */
519 chksum = calculate_config_checksum(config_block); 518 chksum = calculate_config_checksum(config_block);
520 519
@@ -623,7 +622,7 @@ void settings_calc_config_sector(void)
623 int i, partition_start; 622 int i, partition_start;
624 int sector = 0; 623 int sector = 0;
625 624
626 if (fat_startsector() != 0) /* There is a partition table */ 625 if (fat_startsector(IF_MV(0)) != 0) /* There is a partition table */
627 { 626 {
628 sector = 61; 627 sector = 61;
629 for (i = 0; i < 4; i++) 628 for (i = 0; i < 4; i++)
diff --git a/apps/tree.c b/apps/tree.c
index 87a039223e..71af90f017 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -302,6 +302,13 @@ static int compare(const void* p1, const void* p2)
302 if (e1->attr & ATTR_DIRECTORY && e2->attr & ATTR_DIRECTORY) 302 if (e1->attr & ATTR_DIRECTORY && e2->attr & ATTR_DIRECTORY)
303 { /* two directories */ 303 { /* two directories */
304 criteria = global_settings.sort_dir; 304 criteria = global_settings.sort_dir;
305 if (e1->attr & ATTR_VOLUME || e2->attr & ATTR_VOLUME)
306 { /* a volume identifier is involved */
307 if (e1->attr & ATTR_VOLUME && e2->attr & ATTR_VOLUME)
308 criteria = 0; /* two volumes: sort alphabetically */
309 else /* only one is a volume: volume first */
310 return (e2->attr & ATTR_VOLUME) - (e1->attr & ATTR_VOLUME);
311 }
305 } 312 }
306 else if (!(e1->attr & ATTR_DIRECTORY) && !(e2->attr & ATTR_DIRECTORY)) 313 else if (!(e1->attr & ATTR_DIRECTORY) && !(e2->attr & ATTR_DIRECTORY))
307 { /* two files */ 314 { /* two files */
diff --git a/apps/tree.h b/apps/tree.h
index c2606e1fe3..f22163ae25 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -108,7 +108,7 @@ struct filetype {
108}; 108};
109 109
110 110
111/* using attribute bits not used by FAT (FAT uses lower 6) */ 111/* using attribute bits not used by FAT (FAT uses lower 7) */
112 112
113#define TREE_ATTR_THUMBNAIL 0x0080 /* corresponding .talk file exists */ 113#define TREE_ATTR_THUMBNAIL 0x0080 /* corresponding .talk file exists */
114 114