If user supplies full 32 digit cid (chksum included) use it as is without recalculating the checksum (unless they also want a new serial including in it). User request for a device that appears to always want a 00 checksum.

pull/8/head
Richard Antony Burton 8 years ago
parent cc80e62874
commit 4c1bf18990

2
.gitignore vendored

@ -0,0 +1,2 @@
obj

@ -12,7 +12,7 @@ device - sd card block device e.g. /dev/block/mmcblk1
cid - new cid, must be in hex (without 0x prefix)
it can be 32 chars with checksum or 30 chars without, it will
be updated with new serial number if supplied, the checksum is
always recalculated
(re)calculated if not supplied or new serial applied
serial - optional, can be hex (0x prefixed) or decimal
and will be applied to the supplied cid before writing
```

@ -124,7 +124,7 @@ void main(int argc, const char **argv) {
printf("cid - new cid, must be in hex (without 0x prefix)\n");
printf(" it can be 32 chars with checksum or 30 chars without, it will\n");
printf(" be updated with new serial number if supplied, the checksum is\n");
printf(" always recalculated\n");
printf(" (re)calculated if not supplied or new serial applied\n");
printf("serial - optional, can be hex (0x prefixed) or decimal\n");
printf(" and will be applied to the supplied cid before writing\n");
printf("\n");
@ -152,13 +152,15 @@ void main(int argc, const char **argv) {
*((int*)&cid[9]) = htonl(parse_serial(argv[3]));
}
// calculate checksum
cid[15] = crc7(cid, 15);
// calculate checksum if required
if (len != 32 || argc == 4) {
cid[15] = crc7(cid, 15);
}
// open device
fd = open(argv[1], O_RDWR);
if(fd < 0){
printf("[-] wtf\n");
printf("Unable to open device %s\n", argv[1]);
return;
}

4
libs/.gitignore vendored

@ -0,0 +1,4 @@
*
!.gitignore
!armeabi

Binary file not shown.
Loading…
Cancel
Save