nfc: NTAG203 support (#1383)

* nfc: Fix original MFUL feature flags
* nfc: Add NTAG203 read support
* nfc: Update emulation lock byte handling for NTAG203
* nfc: Add NTAG203 counter emulation support
* nfc: Add NTAG203 tag generator
* nfc: Fix NTAG203 emulating GET_VERSION
* nfc: Fix MFUL version reading
* nfc: Complete NTAG203 counter emulation behavior
* nfc: Complete NTAG203 emulation
* nfc: Remove unnecessary init in MFUL emulation
* nfc: Add notes about MFUL type enum

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Yukai Li
2022-07-25 09:21:05 -06:00
committed by GitHub
parent 30820b83b5
commit f8e0ec42c5
4 changed files with 237 additions and 57 deletions

View File

@@ -26,15 +26,23 @@
#define MF_UL_NAK_INVALID_ARGUMENT (0x0)
#define MF_UL_NAK_AUTHLIM_REACHED (0x4)
#define MF_UL_NTAG203_COUNTER_PAGE (41)
// Important: order matters; some features are based on positioning in this enum
typedef enum {
MfUltralightTypeUnknown,
MfUltralightTypeNTAG203,
// Below have config pages and GET_VERSION support
MfUltralightTypeUL11,
MfUltralightTypeUL21,
MfUltralightTypeNTAG213,
MfUltralightTypeNTAG215,
MfUltralightTypeNTAG216,
// Below also have sector select
// NTAG I2C's *does not* have regular config pages, so it's a bit of an odd duck
MfUltralightTypeNTAGI2C1K,
MfUltralightTypeNTAGI2C2K,
// NTAG I2C Plus has stucture expected from NTAG21x
MfUltralightTypeNTAGI2CPlus1K,
MfUltralightTypeNTAGI2CPlus2K,
@@ -58,6 +66,8 @@ typedef enum {
MfUltralightSupportSingleCounter = 1 << 10,
// ASCII mirror is not a command, but handy to have as a flag
MfUltralightSupportAsciiMirror = 1 << 11,
// NTAG203 counter that's in memory rather than through a command
MfUltralightSupportCounterInMemory = 1 << 12,
} MfUltralightFeatures;
typedef enum {
@@ -173,6 +183,11 @@ bool mf_ultralight_read_version(
MfUltralightReader* reader,
MfUltralightData* data);
bool mf_ultralight_read_pages_direct(
FuriHalNfcTxRxContext* tx_rx,
uint8_t start_index,
uint8_t* data);
bool mf_ultralight_read_pages(
FuriHalNfcTxRxContext* tx_rx,
MfUltralightReader* reader,