From a14db4165ee76dac3d04b815ba258f3f6a3f7f40 Mon Sep 17 00:00:00 2001 From: germeier Date: Sun, 8 Sep 2002 23:22:48 +0000 Subject: fixed some issues for MPIOs with more than one internal chip --- libmpio/mpio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libmpio/mpio.c') diff --git a/libmpio/mpio.c b/libmpio/mpio.c index 5b69c06..8c8152d 100644 --- a/libmpio/mpio.c +++ b/libmpio/mpio.c @@ -1,6 +1,6 @@ /* * - * $Id: mpio.c,v 1.3 2002/09/03 21:20:53 germeier Exp $ + * $Id: mpio.c,v 1.4 2002/09/08 23:22:48 germeier Exp $ * * Library for USB MPIO-* * @@ -54,7 +54,6 @@ mpio_init_internal(mpio_t *m) sm->manufacturer = m->version[i_offset]; sm->id = m->version[i_offset+1]; sm->size = mpio_id2mem(sm->id); - sm->max_cluster = sm->size/16*1024; sm->chips = 1; /* look for a second installed memory chip */ @@ -74,9 +73,12 @@ mpio_init_internal(mpio_t *m) /* used for size calculations (see mpio_memory_free) */ mpio_id2geo(sm->id, &sm->geo); - /* read FAT information from spare area */ - sm->fat_size=sm->size*2; /* the *2 is need here! */ - sm->fat=malloc(sm->fat_size*SECTOR_SIZE); + /* read FAT information from spare area */ + sm->max_cluster = sm->size/16*1024; /* 1 cluster == 16 KB */ + debugn(2,"max_cluster: %d\n", sm->max_cluster); + /* 16 bytes per cluster */ + sm->fat_size = sm->max_cluster*16/SECTOR_SIZE; + sm->fat = malloc(sm->fat_size*SECTOR_SIZE); mpio_fat_read(m, MPIO_INTERNAL_MEM); /* Read directory from internal memory */ -- cgit v1.2.3