Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skylanders (/activision) mifare classic to identification procedure #1497

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/nfc/protocols/mifare_classic.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,10 @@ static bool mf_classic_is_allowed_access(
}

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 == 0x0F) && (ATQA1 == 0x01) && (SAK == 0x01)) { //skylanders identification handling
return true;
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
return true;
} else {
Expand All @@ -332,22 +333,24 @@ 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) {
UNUSED(ATQA1);
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
return MfClassicType1k;
} else if ((ATQA0 == 0x0F) && (ATQA1 == 0x01) && (SAK == 0x01)) { //skylanders identification handling
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 == 0x0F) && (ATQA1 == 0x01) && (SAK == 0x01)) { //skylanders identification handling
reader->type = MfClassicType1k;
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
reader->type = MfClassicType4k;
} else {
Expand Down
3 changes: 2 additions & 1 deletion lib/nfc/protocols/mifare_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 == 0x0F) && (ATQA1 == 0x01) && (SAK == 0x01))) { //skylanders identification handling
type = MifareTypeClassic;
} else if(ATQA0 == 0x44 && ATQA1 == 0x03 && SAK == 0x20) {
type = MifareTypeDesfire;
Expand Down