mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 06:50:21 +00:00
NFC: Add Skylanders support (#1553)
* nfc: add skylanders support * nfc: format sources Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
f3d7d7dba0
commit
173c94156d
4 changed files with 10 additions and 19 deletions
|
@ -39,7 +39,8 @@ bool troyka_parser_read(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* tx_rx) {
|
||||||
|
|
||||||
MfClassicReader reader = {};
|
MfClassicReader reader = {};
|
||||||
FuriHalNfcDevData* nfc_data = &nfc_worker->dev_data->nfc_data;
|
FuriHalNfcDevData* nfc_data = &nfc_worker->dev_data->nfc_data;
|
||||||
mf_classic_get_type(nfc_data->atqa[0], nfc_data->atqa[1], nfc_data->sak, &reader);
|
reader.type = mf_classic_get_classic_type(nfc_data->atqa[0], nfc_data->atqa[1], nfc_data->sak);
|
||||||
|
|
||||||
for(size_t i = 0; i < COUNT_OF(troyka_keys); i++) {
|
for(size_t i = 0; i < COUNT_OF(troyka_keys); i++) {
|
||||||
mf_classic_reader_add_sector(
|
mf_classic_reader_add_sector(
|
||||||
&reader, troyka_keys[i].sector, troyka_keys[i].key_a, troyka_keys[i].key_b);
|
&reader, troyka_keys[i].sector, troyka_keys[i].key_a, troyka_keys[i].key_b);
|
||||||
|
|
|
@ -324,6 +324,9 @@ bool mf_classic_check_card_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) {
|
||||||
UNUSED(ATQA1);
|
UNUSED(ATQA1);
|
||||||
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
|
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if((ATQA0 == 0x01) && (ATQA1 == 0x0F) && (SAK == 0x01)) {
|
||||||
|
//skylanders support
|
||||||
|
return true;
|
||||||
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
|
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -335,27 +338,15 @@ MfClassicType mf_classic_get_classic_type(int8_t ATQA0, uint8_t ATQA1, uint8_t S
|
||||||
UNUSED(ATQA1);
|
UNUSED(ATQA1);
|
||||||
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
|
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
|
||||||
return MfClassicType1k;
|
return MfClassicType1k;
|
||||||
|
} else if((ATQA0 == 0x01) && (ATQA1 == 0x0F) && (SAK == 0x01)) {
|
||||||
|
//skylanders support
|
||||||
|
return MfClassicType1k;
|
||||||
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
|
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
|
||||||
return MfClassicType4k;
|
return MfClassicType4k;
|
||||||
}
|
}
|
||||||
return MfClassicType1k;
|
return MfClassicType1k;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mf_classic_get_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK, MfClassicReader* reader) {
|
|
||||||
UNUSED(ATQA1);
|
|
||||||
furi_assert(reader);
|
|
||||||
memset(reader, 0, sizeof(MfClassicReader));
|
|
||||||
|
|
||||||
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
|
|
||||||
reader->type = MfClassicType1k;
|
|
||||||
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
|
|
||||||
reader->type = MfClassicType4k;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mf_classic_reader_add_sector(
|
void mf_classic_reader_add_sector(
|
||||||
MfClassicReader* reader,
|
MfClassicReader* reader,
|
||||||
uint8_t sector,
|
uint8_t sector,
|
||||||
|
|
|
@ -82,8 +82,6 @@ bool mf_classic_check_card_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK);
|
||||||
|
|
||||||
MfClassicType mf_classic_get_classic_type(int8_t ATQA0, uint8_t ATQA1, uint8_t SAK);
|
MfClassicType mf_classic_get_classic_type(int8_t ATQA0, uint8_t ATQA1, uint8_t SAK);
|
||||||
|
|
||||||
bool mf_classic_get_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK, MfClassicReader* reader);
|
|
||||||
|
|
||||||
uint8_t mf_classic_get_total_sectors_num(MfClassicType type);
|
uint8_t mf_classic_get_total_sectors_num(MfClassicType type);
|
||||||
|
|
||||||
uint8_t mf_classic_get_sector_trailer_block_num_by_sector(uint8_t sector);
|
uint8_t mf_classic_get_sector_trailer_block_num_by_sector(uint8_t sector);
|
||||||
|
|
|
@ -7,7 +7,8 @@ MifareType mifare_common_get_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) {
|
||||||
type = MifareTypeUltralight;
|
type = MifareTypeUltralight;
|
||||||
} else if(
|
} else if(
|
||||||
((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) ||
|
((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) ||
|
||||||
((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18))) {
|
((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) ||
|
||||||
|
((ATQA0 == 0x01) && (ATQA1 == 0x0F) && (SAK == 0x01))) {
|
||||||
type = MifareTypeClassic;
|
type = MifareTypeClassic;
|
||||||
} else if(ATQA0 == 0x44 && ATQA1 == 0x03 && SAK == 0x20) {
|
} else if(ATQA0 == 0x44 && ATQA1 == 0x03 && SAK == 0x20) {
|
||||||
type = MifareTypeDesfire;
|
type = MifareTypeDesfire;
|
||||||
|
|
Loading…
Reference in a new issue