Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgornekich <n.gorbadey@gmail.com>2022-08-07 18:33:14 +0300
committerGitHub <noreply@github.com>2022-08-07 18:33:14 +0300
commit173c94156d4c6644046ea782eb6ac7e1b18033a4 (patch)
tree1b0e07047f31e7cd17fe59766b3a1ee8c4f816b4
parentf3d7d7dba085f4e676c1d901122fb021a3553644 (diff)
NFC: Add Skylanders support (#1553)
* nfc: add skylanders support * nfc: format sources Co-authored-by: あく <alleteam@gmail.com>
-rw-r--r--lib/nfc/parsers/troyka_parser.c3
-rw-r--r--lib/nfc/protocols/mifare_classic.c21
-rw-r--r--lib/nfc/protocols/mifare_classic.h2
-rw-r--r--lib/nfc/protocols/mifare_common.c3
4 files changed, 10 insertions, 19 deletions
diff --git a/lib/nfc/parsers/troyka_parser.c b/lib/nfc/parsers/troyka_parser.c
index 653887cb..3167b518 100644
--- a/lib/nfc/parsers/troyka_parser.c
+++ b/lib/nfc/parsers/troyka_parser.c
@@ -39,7 +39,8 @@ bool troyka_parser_read(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* tx_rx) {
MfClassicReader reader = {};
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++) {
mf_classic_reader_add_sector(
&reader, troyka_keys[i].sector, troyka_keys[i].key_a, troyka_keys[i].key_b);
diff --git a/lib/nfc/protocols/mifare_classic.c b/lib/nfc/protocols/mifare_classic.c
index 93fe6f69..44b783d6 100644
--- a/lib/nfc/protocols/mifare_classic.c
+++ b/lib/nfc/protocols/mifare_classic.c
@@ -324,6 +324,9 @@ bool mf_classic_check_card_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) {
UNUSED(ATQA1);
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
return true;
+ } else if((ATQA0 == 0x01) && (ATQA1 == 0x0F) && (SAK == 0x01)) {
+ //skylanders support
+ return true;
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
return true;
} else {
@@ -335,27 +338,15 @@ MfClassicType mf_classic_get_classic_type(int8_t ATQA0, uint8_t ATQA1, uint8_t S
UNUSED(ATQA1);
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
return MfClassicType1k;
+ } else if((ATQA0 == 0x01) && (ATQA1 == 0x0F) && (SAK == 0x01)) {
+ //skylanders support
+ return MfClassicType1k;
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
return MfClassicType4k;
}
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(
MfClassicReader* reader,
uint8_t sector,
diff --git a/lib/nfc/protocols/mifare_classic.h b/lib/nfc/protocols/mifare_classic.h
index 85f67b11..b9921fb1 100644
--- a/lib/nfc/protocols/mifare_classic.h
+++ b/lib/nfc/protocols/mifare_classic.h
@@ -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);
-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_sector_trailer_block_num_by_sector(uint8_t sector);
diff --git a/lib/nfc/protocols/mifare_common.c b/lib/nfc/protocols/mifare_common.c
index fd622765..90b57e1f 100644
--- a/lib/nfc/protocols/mifare_common.c
+++ b/lib/nfc/protocols/mifare_common.c
@@ -7,7 +7,8 @@ MifareType mifare_common_get_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) {
type = MifareTypeUltralight;
} else if(
((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;
} else if(ATQA0 == 0x44 && ATQA1 == 0x03 && SAK == 0x20) {
type = MifareTypeDesfire;