hey,
OK, so the other e200 I have here does actually have a different OF
from he 2 we know the locations of the byte to change.
I've done the two dumps and used got the diff, but I cant remember
what the previous diffs looked like so cant actually add it to the
BL... did they all have 3 bytes changed?

So, first the diff of the relevant part of the dumps...
--- rbdump.txt  2007-05-20 00:37:17.000000000 +1000
+++ usbconnection.txt   2007-05-20 00:35:38.000000000 +1000
@@ -317010,11 +316990,8 @@
007839c0  14 00 00 00 ec 37 00 00  05 00 00 00 00 00 00 00  |.....7..........|
007839d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
007839e0  00 00 00 00 00 00 00 00  00 00 00 00 13 00 00 00  |................|
-007839f0  14 00 00 00 1c 38 00 00  05 00 00 00 00 00 00 00  |.....8..........|
+007839f0  14 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00783a00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
-00783a10  00 00 00 00 00 00 00 00  00 00 00 00 13 00 00 00  |................|
-00783a20  14 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
-00783a30  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00800000  19 37 46 93 d1 a9 c3 2d  c3 87 d0 a6 2d 99 0e ac  |.7F....-....-...|
00800010  ab a1 55 0f e8 86 09 9e  b7 95 e1 c0 c2 32 68 68  |..U..........2hh|

The OF version string: PP5022AF-05.51-S301-00.12-S301.00.12A-D

and attached is the updated bootloader to handle adding new OF's more
easily. (also a change to e200-buttons.c to get buttons working in the
BL again, although, enabling the interupts would be better probbaly?)

I'm going to bed, have fun at devcon :)
Index: bootloader/main-pp.c
===================================================================
--- bootloader/main-pp.c	(revision 13403)
+++ bootloader/main-pp.c	(working copy)
@@ -406,6 +406,16 @@
 }
 
 #ifdef SANSA_E200
+struct OFDB_info {
+    char *version;
+    int version_length;
+    int sector;
+    int offset;
+} OFDatabaseOffsets[] = {
+    { "PP5022AF-05.51-S301-01.11-S301.01.11A-D", 39, 0x3c08, 0xe1 },
+    { "PP5022AF-05.51-S301-00.12-S301.00.12E-D", 39, 0x3c5c, 0x2 },
+};
+
 /* Load mi4 firmware from a hidden disk partition */
 int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
                   unsigned int buffer_size, bool disable_rebuild)
@@ -464,27 +474,26 @@
     {
         char block[512];
         int  sector = 0, offset = 0;
-    
+        unsigned int i;
         /* check which known version we have */
         /* These are taken from the PPPS section, 0x00780240 */
         ata_read_sectors(pinfo->start + 0x3C01, 1, block);
-        if (!memcmp(&block[0x40], 
-            "PP5022AF-05.51-S301-01.11-S301.01.11A-D", 39))
-        {   /* American e200, OF version 1.01.11A */
-            sector = pinfo->start + 0x3c08;
-            offset  = 0xe1;
+        for (i=0; i<sizeof(OFDatabaseOffsets)/sizeof(*OFDatabaseOffsets); i++)
+        {
+            if (!memcmp(&block[0x40], OFDatabaseOffsets[i].version,
+                                      OFDatabaseOffsets[i].version_length))
+            {
+                sector = pinfo->start + OFDatabaseOffsets[i].sector;
+                offset  = OFDatabaseOffsets[i].offset;
+                break;
+            }
         }
-        else if (!memcmp(&block[0x40], 
-                "PP5022AF-05.51-S301-00.12-S301.00.12E-D", 39))
-        {   /* European e200, OF version 1.00.12 */
-            sector = pinfo->start + 0x3c5c;
-            offset  = 0x2;
+        if (sector && offset)
+        {
+            ata_read_sectors(sector, 1, block);
+            block[offset] = 0;
+            ata_write_sectors(sector, 1, block);
         }
-        else 
-            return EOK;
-        ata_read_sectors(sector, 1, block);
-        block[offset] = 0;
-        ata_write_sectors(sector, 1, block);
     }
     return EOK;
 }
@@ -620,7 +629,7 @@
         error(0, 0);
 
     } else {
-#if 0 /* e200: enable to be able to dump the hidden partition */
+#if 1 /* e200: enable to be able to dump the hidden partition */
         if(btn & BUTTON_UP)
         {
             int fd;
@@ -628,8 +637,11 @@
             fd = open("/part.bin", O_CREAT|O_RDWR);
             char sector[512];
             for(i=0; i<40960; i++){
-                printf("dumping sector %d", i);
-                lcd_update();
+                if (!(i%50))
+                {
+                    printf("dumping sector %d", i);
+                    lcd_update();
+                }
                 ata_read_sectors(pinfo->start + i,1 , sector);
                 write(fd,sector,512);
             }
Index: firmware/target/arm/sandisk/sansa-e200/button-e200.c
===================================================================
--- firmware/target/arm/sandisk/sansa-e200/button-e200.c	(revision 13403)
+++ firmware/target/arm/sandisk/sansa-e200/button-e200.c	(working copy)
@@ -189,9 +189,9 @@
 void button_int(void)
 {
     unsigned char state;
-
+#ifndef BOOTLOADER
     GPIOF_INT_CLR = GPIOF_INT_STAT;
-
+#endif
     state = GPIOF_INPUT_VAL & 0xff;
 
     GPIOF_INT_LEV = (GPIOF_INT_LEV & ~0xff) | (state ^ 0xff);
@@ -227,6 +227,8 @@
         hold_button_old = hold_button;
         backlight_hold_changed(hold_button);
     }
+#else
+    button_int();
 #endif
 
     /* The int_btn variable is set in the button interrupt handler */

Reply via email to