This commit is contained in:
iceman1001 2021-05-06 22:08:18 +02:00
commit 5ef0061e31

View file

@ -82,7 +82,7 @@ static uint16_t get_page_len(uint16_t pageid) {
*/ */
static const char *get_page_name(uint16_t pageid) { static const char *get_page_name(uint16_t pageid) {
for (uint8_t i = 0; i < ARRAYLEN(cm_page_map ); ++i) { for (uint8_t i = 0; i < ARRAYLEN(cm_page_map); ++i) {
if (pageid == cm_page_map[i].pageid) { if (pageid == cm_page_map[i].pageid) {
return cm_page_map[i].name; return cm_page_map[i].name;
} }
@ -223,7 +223,7 @@ static const char *lto_print_size(uint8_t ti) {
static void lto_print_ci(uint8_t *d) { static void lto_print_ci(uint8_t *d) {
uint32_t sn = (bytes_to_num(d, 4) & 0x0FFFFFFF); uint32_t sn = (bytes_to_num(d, 4) & 0x0FFFFFFF);
PrintAndLogEx(INFO, "CM Serial number... " _YELLOW_("%u"), sn); PrintAndLogEx(INFO, "CM Serial number... " _YELLOW_("%u"), sn);
PrintAndLogEx(INFO, "Manufacture Id..... " _YELLOW_("%u"), (d[3] >> 4) ); PrintAndLogEx(INFO, "Manufacture Id..... " _YELLOW_("%u"), (d[3] >> 4));
PrintAndLogEx(INFO, "CM Size............ " _YELLOW_("%u") " ( 1024 x %u bytes )", d[5], d[5]); PrintAndLogEx(INFO, "CM Size............ " _YELLOW_("%u") " ( 1024 x %u bytes )", d[5], d[5]);
PrintAndLogEx(INFO, "Type............... " _YELLOW_("%s"), sprint_hex_inrow(d + 6, 2)); PrintAndLogEx(INFO, "Type............... " _YELLOW_("%s"), sprint_hex_inrow(d + 6, 2));
PrintAndLogEx(INFO, "Manufacture info... " _YELLOW_("%s"), sprint_hex_inrow(d + 8, 24)); PrintAndLogEx(INFO, "Manufacture info... " _YELLOW_("%s"), sprint_hex_inrow(d + 8, 24));
@ -273,14 +273,14 @@ static void lto_print_cmi(uint8_t *d) {
uint16_t page_len = (d[2] << 8) | d[3]; uint16_t page_len = (d[2] << 8) | d[3];
char man[8 + 1]; char man[8 + 1];
memcpy(man, (char*)d + 4, 8); memcpy(man, (char *)d + 4, 8);
char serial[10 + 1]; char serial[10 + 1];
memcpy(serial, (char*)d + 12, 10); memcpy(serial, (char *)d + 12, 10);
uint16_t cart_type = (d[22] << 8) | d[23]; uint16_t cart_type = (d[22] << 8) | d[23];
char dom[8 + 1]; char dom[8 + 1];
memcpy(dom, (char*)d + 24, 8); memcpy(dom, (char *)d + 24, 8);
uint16_t tape_len = (d[32] << 8) | d[33]; uint16_t tape_len = (d[32] << 8) | d[33];
uint16_t tape_thick = (d[34] << 8) | d[35]; uint16_t tape_thick = (d[34] << 8) | d[35];
@ -289,10 +289,10 @@ static void lto_print_cmi(uint8_t *d) {
uint16_t full_reel = (d[40] << 8) | d[41]; uint16_t full_reel = (d[40] << 8) | d[41];
uint16_t max_media_speed = (d[42] << 8) | d[43]; uint16_t max_media_speed = (d[42] << 8) | d[43];
char lic[4 + 1]; char lic[4 + 1];
memcpy(lic, (char*)d + 44, 4); memcpy(lic, (char *)d + 44, 4);
char cmuse[12 + 1]; char cmuse[12 + 1];
memcpy(cmuse, (char*)d + 48, 12); memcpy(cmuse, (char *)d + 48, 12);
// uint32_t crc = bytes_to_num(d+60, 4); // uint32_t crc = bytes_to_num(d+60, 4);
@ -303,7 +303,7 @@ static void lto_print_cmi(uint8_t *d) {
PrintAndLogEx(INFO, " " _YELLOW_("%s"), sprint_hex_inrow(d + 32, 32)); PrintAndLogEx(INFO, " " _YELLOW_("%s"), sprint_hex_inrow(d + 32, 32));
PrintAndLogEx(INFO, " ^^^^^^^^ CRC-32"); PrintAndLogEx(INFO, " ^^^^^^^^ CRC-32");
PrintAndLogEx(INFO, "Page id.................. ..." _YELLOW_("0x%04x"), page_id); PrintAndLogEx(INFO, "Page id.................. ..." _YELLOW_("0x%04x"), page_id);
PrintAndLogEx(INFO, "Page len.................... " _YELLOW_("%u"), page_len ); PrintAndLogEx(INFO, "Page len.................... " _YELLOW_("%u"), page_len);
PrintAndLogEx(INFO, "Cartridge Manufacturer...... " _YELLOW_("%s"), man); PrintAndLogEx(INFO, "Cartridge Manufacturer...... " _YELLOW_("%s"), man);
PrintAndLogEx(INFO, "Serial number............... " _YELLOW_("%s"), serial); PrintAndLogEx(INFO, "Serial number............... " _YELLOW_("%s"), serial);
PrintAndLogEx(INFO, "Cartridge type.............. " _YELLOW_("0x%02x"), cart_type); PrintAndLogEx(INFO, "Cartridge type.............. " _YELLOW_("0x%02x"), cart_type);
@ -331,9 +331,9 @@ static void lto_print_mmi(uint8_t *d) {
uint16_t page_len = (d[2] << 8) | d[3]; uint16_t page_len = (d[2] << 8) | d[3];
char man[48 + 1]; char man[48 + 1];
memcpy(man, (char*)d + 4, 48); memcpy(man, (char *)d + 4, 48);
PrintAndLogEx(INFO, "Page id.................... " _YELLOW_("0x%04x"), page_id); PrintAndLogEx(INFO, "Page id.................... " _YELLOW_("0x%04x"), page_id);
PrintAndLogEx(INFO, "Page len................... " _YELLOW_("%u"), page_len ); PrintAndLogEx(INFO, "Page len................... " _YELLOW_("%u"), page_len);
PrintAndLogEx(INFO, "Servowriter Manufacturer... " _YELLOW_("%s"), man); PrintAndLogEx(INFO, "Servowriter Manufacturer... " _YELLOW_("%s"), man);
} }