dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: [ rockbox-Bugs-569620 ] FAT start address

[ rockbox-Bugs-569620 ] FAT start address

From: <>
Date: Sun, 16 Jun 2002 06:12:08 -0700

Bugs item #569620, was opened at 2002-06-16 06:12
You can respond by visiting:

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: FAT start address

Initial Comment:

I have been snooping around your code to look at the
reusability it, and found one error in the FAT calulation.
The FAT start sector was not included in these
In my case, the FAT looked corrupt.
The first cluster could be read(since the fileentry
contains the location of the first sector), but as soon as
the next cluster had checked inside the FAT, it failed.
By making the below adjustment, I could get it running:


static int read_entry(int entry)
    unsigned long *sec;
    int fatoffset;
    int thisfatsecnum;
    int thisfatentoffset;
    int val = -1;

    fatoffset = entry * 4;

// OLD
 thisfatsecnum = fatoffset / fat_bpb.bpb_bytspersec +

// NEW
   thisfatsecnum = (fatoffset / fat_bpb.bpb_bytspersec) +
fat_bpb.bpb_rsvdseccnt + fat_bpb.startsector ;
 // END

    thisfatentoffset = fatoffset % fat_bpb.bpb_bytspersec;

    /* Load the sector if it is not cached */
    sec = cache_fat_sector(thisfatsecnum);
        DEBUGF( "read_entry() - Could not cache sector %
        return -1;

    val = sec[thisfatentoffset/sizeof(int)];

    val = SWAB32(val);
    return val;

I disabled the FAT caching for me to get all this running.

Well, thats my contribution. Great project you are doing!



You can respond by visiting:
Received on 2002-06-16

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy