summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/test/fat/ata-sim.c2
-rw-r--r--firmware/test/fat/main.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c
index aac7fba0f4..cc3eb15209 100644
--- a/firmware/test/fat/ata-sim.c
+++ b/firmware/test/fat/ata-sim.c
@@ -56,7 +56,7 @@ int ata_init(char* filename)
56 if (!filename) 56 if (!filename)
57 filename = "disk.img"; 57 filename = "disk.img";
58 /* check disk size */ 58 /* check disk size */
59 file=fopen(filename,"r+"); 59 file=fopen(filename,"rb+");
60 if(!file) { 60 if(!file) {
61 fprintf(stderr, "read_disk() - Could not find \"%s\"\n",filename); 61 fprintf(stderr, "read_disk() - Could not find \"%s\"\n",filename);
62 return -1; 62 return -1;
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c
index fd43558c38..5607414bcb 100644
--- a/firmware/test/fat/main.c
+++ b/firmware/test/fat/main.c
@@ -3,7 +3,6 @@
3#include <string.h> 3#include <string.h>
4#include <stdarg.h> 4#include <stdarg.h>
5#include <time.h> 5#include <time.h>
6#include <sys/time.h>
7#include "fat.h" 6#include "fat.h"
8#include "debug.h" 7#include "debug.h"
9#include "disk.h" 8#include "disk.h"
@@ -266,7 +265,7 @@ int dbg_wrtest(char* name)
266void dbg_type(char* name) 265void dbg_type(char* name)
267{ 266{
268 const int size = SECTOR_SIZE*5; 267 const int size = SECTOR_SIZE*5;
269 unsigned char buf[size+1]; 268 unsigned char buf[SECTOR_SIZE*5+1];
270 int fd,rc; 269 int fd,rc;
271 270
272 fd = open(name,O_RDONLY); 271 fd = open(name,O_RDONLY);
@@ -658,10 +657,8 @@ int main(int argc, char *argv[])
658{ 657{
659 int rc,i; 658 int rc,i;
660 struct partinfo* pinfo; 659 struct partinfo* pinfo;
661 struct timeval tv;
662 660
663 gettimeofday(&tv, NULL); 661 srand(clock());
664 srand(tv.tv_usec);
665 662
666 if(ata_init("disk.img")) { 663 if(ata_init("disk.img")) {
667 DEBUGF("*** Warning! The disk is uninitialized\n"); 664 DEBUGF("*** Warning! The disk is uninitialized\n");
@@ -674,7 +671,11 @@ int main(int argc, char *argv[])
674 } 671 }
675 672
676 for ( i=0; i<4; i++ ) { 673 for ( i=0; i<4; i++ ) {
677 if ( pinfo[i].type == PARTITION_TYPE_FAT32 ) { 674 if ( pinfo[i].type == PARTITION_TYPE_FAT32
675#ifdef HAVE_FAT16SUPPORT
676 || pinfo[i].type == PARTITION_TYPE_FAT16
677#endif
678 ) {
678 DEBUGF("*** Mounting at block %ld\n",pinfo[i].start); 679 DEBUGF("*** Mounting at block %ld\n",pinfo[i].start);
679 rc = fat_mount(pinfo[i].start); 680 rc = fat_mount(pinfo[i].start);
680 if(rc) { 681 if(rc) {