summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/test/fat/Makefile2
-rw-r--r--firmware/test/fat/main.c15
2 files changed, 11 insertions, 6 deletions
diff --git a/firmware/test/fat/Makefile b/firmware/test/fat/Makefile
index bd6869e8e9..1d69467892 100644
--- a/firmware/test/fat/Makefile
+++ b/firmware/test/fat/Makefile
@@ -21,7 +21,7 @@ file.o: $(FIRMWARE)/common/file.c
$(CC) $(CFLAGS) -c $< -o $@
debug.o: $(FIRMWARE)/debug.c
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) $(CFLAGS) -DSIMULATOR -c $< -o $@
ata-sim.o: ata-sim.c $(DRIVERS)/ata.h
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c
index 0cf06bdac3..5490fa9777 100644
--- a/firmware/test/fat/main.c
+++ b/firmware/test/fat/main.c
@@ -111,15 +111,19 @@ void dbg_type(char* name)
DEBUGF("Got file descriptor %d\n",fd);
for (i=0;i<5;i++) {
- rc = read(fd, buf, SECTOR_SIZE/3);
- if( rc >= 0 )
+ rc = read(fd, buf, SECTOR_SIZE*2/3);
+ if( rc > 0 )
{
- buf[SECTOR_SIZE]=0;
- DEBUGF("%d: %d\n", i, rc);
+ buf[rc]=0;
+ printf("%d: %s\n", i, buf);
+ }
+ else if ( rc == 0 ) {
+ DEBUGF("EOF\n");
+ break;
}
else
{
- DEBUGF("Failed reading file\n");
+ DEBUGF("Failed reading file: %d\n",rc);
}
}
close(fd);
@@ -218,6 +222,7 @@ int main(int argc, char *argv[])
}
dbg_console();
+
return 0;
}