Skip to content
Merged
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
7 changes: 1 addition & 6 deletions lib/nfc_protocols/mifare_ultralight.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,10 +1173,6 @@ void mf_ul_prepare_emulation(MfUltralightEmulator* emulator, MfUltralightData* d
emulator->data_changed = false;
emulator->comp_write_cmd_started = false;
emulator->sector_select_cmd_started = false;
if(emulator->data.type == MfUltralightTypeNTAG203) {
// Clear holding counter
emulator->data.counter[0] = 0;
}
mf_ul_reset_emulation(emulator, true);
}

Expand Down Expand Up @@ -1239,8 +1235,7 @@ bool mf_ul_prepare_emulation_response(
} else if(buff_rx_len >= 8) {
uint8_t cmd = buff_rx[0];
if(cmd == MF_UL_GET_VERSION_CMD) {
if(emulator->data.type != MfUltralightTypeUnknown &&
emulator->data.type != MfUltralightTypeNTAG203) {
if(emulator->data.type >= MfUltralightTypeUL11) {
if(buff_rx_len == 1 * 8) {
tx_bytes = sizeof(emulator->data.version);
memcpy(buff_tx, &emulator->data.version, tx_bytes);
Expand Down
5 changes: 5 additions & 0 deletions lib/nfc_protocols/mifare_ultralight.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@

#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,

Expand Down