aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--libmpio/fat.c39
-rw-r--r--libmpio/mpio.c4
3 files changed, 37 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index d03dfb6..1b81f19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-26 Markus Germeier <mager@tzi.de>
+
+ * libmpio/mpio.c (mpio_file_put_real):
+ libmpio/fat.c (mpio_fatentry_new, mpio_fatentry_read):
+ Small fixes which try to support changes in internal FAT
+ structure (Not Tested!)
+
2003-03-22 Markus Germeier <mager@tzi.de>
* kernel/mpio.c (probe_mpio, write_mpio, read_mpio):
diff --git a/libmpio/fat.c b/libmpio/fat.c
index d83dfc5..4dce812 100644
--- a/libmpio/fat.c
+++ b/libmpio/fat.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: fat.c,v 1.22 2003/03/15 14:34:44 germeier Exp $
+ * $Id: fat.c,v 1.23 2003/03/25 23:56:52 germeier Exp $
*
* Library for USB MPIO-*
*
@@ -383,8 +383,13 @@ mpio_fatentry_new(mpio_t *m, mpio_mem_t mem, DWORD sector, BYTE ftype)
new->i_fat[0x0b] = 0x00;
new->i_fat[0x0c] = 0x00;
new->i_fat[0x0d] = 0x00;
- new->i_fat[0x0e] = 'P';
- new->i_fat[0x0f] = 'C';
+ if (m->model >= MPIO_MODEL_FD100) {
+ /* 0x0e is a copy of the file index number */
+ new->i_fat[0x0f] = 0x00;
+ } else {
+ new->i_fat[0x0e] = 'P';
+ new->i_fat[0x0f] = 'C';
+ }
}
if (mem == MPIO_INTERNAL_MEM)
@@ -496,15 +501,25 @@ mpio_fatentry_read(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f )
sm = &m->internal;
e = f->entry * 0x10;
/* check if this block became defective */
- if ((sm->fat[e+0x0e] != 'P') ||
- (sm->fat[e+0x0f] != 'C') ||
- ((sm->fat[e+0x00] != 0xaa) &&
- (sm->fat[e+0x00] != 0xee)))
- {
- debug("defective block encountered, abort reading!\n");
-/* return 0xaaaaaaaa; */
- return 0xffffffff;
- }
+ if (m->model >= MPIO_MODEL_FD100) {
+ /* newer models */
+ if ((sm->fat[e+0x0c] != 0) ||
+ (sm->fat[e+0x0f] != 0) ||
+ (sm->fat[e+0x01] != sm->fat[e+0x0e]))
+ {
+ debug("defective block encountered, abort reading! (newer models check)\n");
+ return 0xffffffff;
+ }
+ } else
+ if ((sm->fat[e+0x0e] != 'P') ||
+ (sm->fat[e+0x0f] != 'C') ||
+ ((sm->fat[e+0x00] != 0xaa) &&
+ (sm->fat[e+0x00] != 0xee)))
+ {
+ debug("defective block encountered, abort reading! (older models check)\n");
+ return 0xffffffff;
+ }
+
/* this is a special system file! */
if((sm->fat[e+6] != FTYPE_MUSIC) &&
(sm->fat[e+7] == 0xff) &&
diff --git a/libmpio/mpio.c b/libmpio/mpio.c
index 15b7e82..b112143 100644
--- a/libmpio/mpio.c
+++ b/libmpio/mpio.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: mpio.c,v 1.44 2003/03/24 19:19:18 germeier Exp $
+ * $Id: mpio.c,v 1.45 2003/03/25 23:56:52 germeier Exp $
*
* Library for USB MPIO-*
*
@@ -683,6 +683,8 @@ mpio_file_put_real(mpio_t *m, mpio_mem_t mem, mpio_filename_t i_filename,
f->i_index=mpio_fat_internal_find_fileindex(m);
debugn(2, "fileindex: %02x\n", f->i_index);
f->i_fat[0x01]= f->i_index;
+ if (m->model >= MPIO_MODEL_FD100)
+ f->i_fat[0x0e] = f->i_index;
start = f->i_index;
/* number of blocks needed for file */