Show Mfg date for eMMC (#3)

* show manufacture date

* fix format string for mfg date

* mask out some bits for mfg date
This commit is contained in:
jan-hofmeier 2023-03-29 20:40:29 +02:00 committed by GitHub
parent 629bd7ca4c
commit f7f71222b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

12
main.c
View File

@ -3,6 +3,8 @@
#include <whb/log_udp.h>
#include <whb/log_console.h>
#include <string.h>
#include <mocha/mocha.h>
#include "idsdb.h"
@ -93,6 +95,16 @@ int main(int argc, char const *argv[])
}
WHBLogPrintf("CID: %08x%08x%08x%08x", cid[0], cid[1], cid[2], cid[3]);
if(!strcmp(db->type,"mmc")){
uint8_t month = (uint8_t)(cid[3] >> 12) & 0xf;
uint16_t year = (uint8_t)(cid[3] >> 8) & 0xf;
year += 1997;
if(year < 2005)
year += 0x10;
WHBLogPrintf("Mfg Date: %02u/%u", month, year);
}
uint32_t csd[4];
if (iosuKernRead32(deviceAddress + 0x68, csd, 4) != MOCHA_RESULT_SUCCESS) {