mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-13 05:19:50 +04:00
IC parsing function cleanup
This commit is contained in:
@@ -40,9 +40,11 @@ void nfc_render_felica_info(
|
||||
}
|
||||
|
||||
FuriString* ic_type_str = furi_string_alloc();
|
||||
felica_get_ic_name(data, ic_type_str);
|
||||
FelicaData* data_copy = (FelicaData*)data; // Cast to non-const for function call
|
||||
felica_get_ic_type(data_copy, ic_type_str);
|
||||
furi_string_cat_printf(str, "IC Type:\n%s\n", furi_string_get_cstr(ic_type_str));
|
||||
furi_string_free(ic_type_str);
|
||||
felica_free(data_copy);
|
||||
|
||||
nfc_render_felica_idm(data, format_type, str);
|
||||
|
||||
|
||||
@@ -583,78 +583,7 @@ void felica_write_directory_tree(const FelicaData* data, FuriString* str) {
|
||||
}
|
||||
}
|
||||
|
||||
void felica_get_ic_type(FelicaData* data) {
|
||||
// Reference: Proxmark3 repo
|
||||
uint8_t rom_type = data->pmm.data[0];
|
||||
uint8_t ic_type = data->pmm.data[1];
|
||||
switch(ic_type) {
|
||||
case 0x00:
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0B:
|
||||
case 0x0C:
|
||||
case 0x0D:
|
||||
case 0x20:
|
||||
case 0x31:
|
||||
case 0x32:
|
||||
case 0x35:
|
||||
case 0x44:
|
||||
case 0x45:
|
||||
case 0x46:
|
||||
data->ic_type = FelicaStandard;
|
||||
break;
|
||||
|
||||
case 0xF0:
|
||||
data->ic_type = FelicaLite;
|
||||
break;
|
||||
case 0xF1:
|
||||
data->ic_type = FelicaLiteS;
|
||||
break;
|
||||
|
||||
case 0xE1:
|
||||
case 0xF2:
|
||||
data->ic_type = FelicaLink;
|
||||
break;
|
||||
case 0xFF:
|
||||
if(rom_type == 0xFF) {
|
||||
data->ic_type = FelicaLink;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xE0:
|
||||
data->ic_type = FelicaPlug;
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
case 0x07:
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x12:
|
||||
case 0x13:
|
||||
case 0x14:
|
||||
case 0x15:
|
||||
case 0x16:
|
||||
case 0x17:
|
||||
case 0x18:
|
||||
case 0x19:
|
||||
case 0x1A:
|
||||
case 0x1B:
|
||||
case 0x1C:
|
||||
case 0x1D:
|
||||
case 0x1E:
|
||||
case 0x1F:
|
||||
data->ic_type = FelicaMobile;
|
||||
break;
|
||||
|
||||
default:
|
||||
data->ic_type = FelicaUnknown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void felica_get_ic_name(const FelicaData* data, FuriString* ic_name) {
|
||||
void felica_get_ic_type(FelicaData* data, FuriString* ic_name) {
|
||||
// Reference: Proxmark3 repo
|
||||
uint8_t rom_type = data->pmm.data[0];
|
||||
uint8_t ic_type = data->pmm.data[1];
|
||||
@@ -662,59 +591,76 @@ void felica_get_ic_name(const FelicaData* data, FuriString* ic_name) {
|
||||
switch(ic_type) {
|
||||
// FeliCa Standard Products:
|
||||
case 0x46:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-SA21/2");
|
||||
break;
|
||||
case 0x45:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-SA20/2");
|
||||
break;
|
||||
case 0x44:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-SA20/1");
|
||||
break;
|
||||
case 0x35:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-SA01/2");
|
||||
break;
|
||||
case 0x32:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-SA00/1");
|
||||
break;
|
||||
case 0x20:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-S962");
|
||||
break;
|
||||
case 0x0D:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-S960");
|
||||
break;
|
||||
case 0x0C:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-S954");
|
||||
break;
|
||||
case 0x09:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-S953");
|
||||
break;
|
||||
case 0x08:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-S952");
|
||||
break;
|
||||
case 0x01:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-S915");
|
||||
break;
|
||||
// FeliCa Lite Products:
|
||||
case 0xF1:
|
||||
data->ic_type = FelicaLiteS;
|
||||
furi_string_set_str(ic_name, "FeliCa Lite-S RC-S966");
|
||||
break;
|
||||
case 0xF0:
|
||||
data->ic_type = FelicaLite;
|
||||
furi_string_set_str(ic_name, "FeliCa Lite RC-S965");
|
||||
break;
|
||||
// FeliCa Link Products:
|
||||
case 0xF2:
|
||||
data->ic_type = FelicaLink;
|
||||
furi_string_set_str(ic_name, "FeliCa Link RC-S967,\nLite-S Mode or Lite-S HT Mode");
|
||||
break;
|
||||
case 0xE1:
|
||||
data->ic_type = FelicaLink;
|
||||
furi_string_set_str(ic_name, "FeliCa Link RC-S967,\nPlug Mode");
|
||||
break;
|
||||
case 0xFF:
|
||||
if(rom_type == 0xFF) { // from FeliCa Link User's Manual
|
||||
data->ic_type = FelicaLink;
|
||||
furi_string_set_str(ic_name, "FeliCa Link RC-S967,\nNFC-DEP Mode");
|
||||
}
|
||||
break;
|
||||
// NFC Dynamic Tag (FeliCa Plug) Products:
|
||||
case 0xE0:
|
||||
data->ic_type = FelicaPlug;
|
||||
furi_string_set_str(ic_name, "FeliCa Plug RC-S926,\nNFC Dynamic Tag");
|
||||
break;
|
||||
|
||||
@@ -731,31 +677,38 @@ void felica_get_ic_name(const FelicaData* data, FuriString* ic_name) {
|
||||
case 0x1D:
|
||||
case 0x1E:
|
||||
case 0x1F:
|
||||
data->ic_type = FelicaMobile;
|
||||
furi_string_set_str(ic_name, "FeliCa Mobile IC,\nChip V3.0");
|
||||
break;
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x12:
|
||||
case 0x13:
|
||||
data->ic_type = FelicaMobile;
|
||||
furi_string_set_str(ic_name, "Mobile FeliCa IC,\nChip V2.0");
|
||||
break;
|
||||
case 0x06:
|
||||
case 0x07:
|
||||
data->ic_type = FelicaMobile;
|
||||
furi_string_set_str(ic_name, "Mobile FeliCa IC,\nChip V1.0");
|
||||
break;
|
||||
|
||||
// odd findings
|
||||
case 0x00:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard,\nRC-S830");
|
||||
break;
|
||||
case 0x02:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard,\nRC-S919");
|
||||
break;
|
||||
case 0x0B:
|
||||
case 0x31:
|
||||
data->ic_type = FelicaStandard;
|
||||
furi_string_set_str(ic_name, "FeliCa Standard RC-S,\nJapan Transit IC");
|
||||
break;
|
||||
default:
|
||||
data->ic_type = FelicaUnknown;
|
||||
furi_string_set_str(ic_name, "Unknown IC Type");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -313,9 +313,7 @@ void felica_calculate_mac_write(
|
||||
|
||||
void felica_write_directory_tree(const FelicaData* data, FuriString* str);
|
||||
|
||||
void felica_get_ic_type(FelicaData* data);
|
||||
|
||||
void felica_get_ic_name(const FelicaData* data, FuriString* ic_name);
|
||||
void felica_get_ic_type(FelicaData* data, FuriString* ic_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -80,7 +80,9 @@ NfcCommand felica_poller_state_handler_activate(FelicaPoller* instance) {
|
||||
FelicaError error = felica_poller_activate(instance, instance->data);
|
||||
if(error == FelicaErrorNone) {
|
||||
furi_hal_random_fill_buf(instance->data->data.fs.rc.data, FELICA_DATA_BLOCK_SIZE);
|
||||
felica_get_ic_type(instance->data);
|
||||
FuriString* _unused = furi_string_alloc();
|
||||
felica_get_ic_type(instance->data, _unused);
|
||||
furi_string_free(_unused);
|
||||
|
||||
instance->felica_event.type = FelicaPollerEventTypeRequestAuthContext;
|
||||
instance->felica_event_data.auth_context = &instance->auth.context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,86.3,,
|
||||
Version,+,86.2,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||
@@ -1060,8 +1060,7 @@ Function,+,felica_copy,void,"FelicaData*, const FelicaData*"
|
||||
Function,+,felica_free,void,FelicaData*
|
||||
Function,+,felica_get_base_data,FelicaData*,const FelicaData*
|
||||
Function,+,felica_get_device_name,const char*,"const FelicaData*, NfcDeviceNameType"
|
||||
Function,+,felica_get_ic_name,void,"const FelicaData*, FuriString*"
|
||||
Function,+,felica_get_ic_type,void,FelicaData*
|
||||
Function,+,felica_get_ic_type,void,"FelicaData*, FuriString*"
|
||||
Function,+,felica_get_uid,const uint8_t*,"const FelicaData*, size_t*"
|
||||
Function,+,felica_is_equal,_Bool,"const FelicaData*, const FelicaData*"
|
||||
Function,+,felica_load,_Bool,"FelicaData*, FlipperFormat*, uint32_t"
|
||||
|
||||
|
Reference in New Issue
Block a user