summaryrefslogtreecommitdiffstats
path: root/utils/AMS
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-24 10:06:52 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-24 10:06:52 +0000
commitff6b0425e438add8d12393f90fdbfe93e1fb4746 (patch)
treeb8ac1a3254a8e01051a5d7f2c5c94e61bacd5c02 /utils/AMS
parenteae2464e9a93dc3a8918abcc62348af6c8d9bc9b (diff)
downloadrockbox-ff6b0425e438add8d12393f90fdbfe93e1fb4746.tar.gz
rockbox-ff6b0425e438add8d12393f90fdbfe93e1fb4746.zip
mkamsboot/rbutil/amsinfo : do not try to detect the model of a given Sansa AMS OF
The field we thought was representative of the model is not, it has changed in the past for fuzev1 and fuzev2. For example the value 0x23 is found in 2 old fuzev1 OF versions, and in the c200v2 OF The only reliable way to detect the model of a given OF is by using the built-in list of md5sums. Modify mkamsboot and rbutilqt to load the rockbox bootloader first, and then check if the model in the bootloader corresponds to the model of the known md5sum of the given OF. That way we can continue to present the user with a list of known OF versions in case the OF is unknown to mkamsboot Also explicit the dependency of main.c on mkamsboot.h in case the prototypes change Correct the header's description not updated in r21648 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26248 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/AMS')
-rw-r--r--utils/AMS/hacking/amsinfo.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/utils/AMS/hacking/amsinfo.c b/utils/AMS/hacking/amsinfo.c
index ff92175e64..433333ecca 100644
--- a/utils/AMS/hacking/amsinfo.c
+++ b/utils/AMS/hacking/amsinfo.c
@@ -66,7 +66,7 @@ uint8_t *buf; /* file content */
/* 1st block description */
uint32_t idx,checksum,bs_multiplier,firmware_sz;
-uint32_t unknown_4_1; uint8_t unknown_1,id; uint16_t unknown_2;
+uint32_t unknown_4_1; uint16_t unknown_1, unknown_2;
uint32_t unknown_4_2,unknown_4_3;
static void *xmalloc(size_t s) /* malloc helper */
@@ -76,28 +76,6 @@ static void *xmalloc(size_t s) /* malloc helper */
return r;
}
-/* known models */
-static const char * model(uint8_t id)
-{
- switch(id)
- {
- case 0x1E: return "FUZE"; break;
- case 0x22: return "CLIP"; break;
- case 0x23: return "C200"; break;
- case 0x24: return "E200"; break;
- case 0x25: return "M200"; break;
- case 0x27: return "CLV2"; break;
- case 0x28: return "CLI+"; break;
- case 0x70:
- case 0x6d: return "FUZ2"; break;
- default:
- printf("Unknown ID 0x%x\n", id);
-
- assert(id == 0x1E || (id >= 0x22 && id <= 0x28));
- return "UNKNOWN!";
- }
-}
-
/* checksums the firmware (the firmware header contains the verification) */
static uint32_t do_checksum(void)
{
@@ -142,8 +120,7 @@ static void check(void)
assert(bs_multiplier << 9 == PAD_TO_BOUNDARY(firmware_sz)); /* 0x200 * bs_multiplier */
unknown_4_1 = get32le(0x10 + shift);
- unknown_1 = buf[0x14 + shift];
- id = buf[0x15 + shift];
+ unknown_1 = get16le(0x14 + shift);
unknown_2 = get16le(0x16 + shift);
unknown_4_2 = get32le(0x18 + shift);
unknown_4_3 = get32le(0x1c + shift);
@@ -171,9 +148,6 @@ static void check(void)
printf("1 Unknown %x\n",unknown_1);
color(GREEN);
- printf("1 Model ID %x (%s)\n",id,model(id));
-
- color(GREEN);
printf("2 Unknown (should be 0) %x\n",unknown_2);
assert(unknown_2 == 0);
@@ -185,13 +159,6 @@ static void check(void)
printf("4 Unknown (should be 1) %x\n",unknown_4_3);
assert(unknown_4_3 == 1);
- /* rest of the block is padded with 0xff */
- for(i=0x20 + shift;i<0x200 - shift;i++)
- assert(buf[i]==0xff /* normal case */ ||
- ((id==0x1e||id==0x24) && ( /* Fuze or E200 */
- (i>=0x3c && i<=0x3f && get32le(0x3c)==0x00005000)
- )));
-
/* the 2nd block is identical, except that the 1st byte has been incremented */
assert(buf[0x0]==0&&buf[0x200]==1);
assert(!memcmp(&buf[1],&buf[0x201],0x1FF - shift));