Skip to content

ntag: add write/read commands with NDEF support, fix false-OK on mfu wrbl#40

Open
nieldk wants to merge 1 commit into
whywilson:mainfrom
nieldk:main
Open

ntag: add write/read commands with NDEF support, fix false-OK on mfu wrbl#40
nieldk wants to merge 1 commit into
whywilson:mainfrom
nieldk:main

Conversation

@nieldk
Copy link
Copy Markdown

@nieldk nieldk commented May 14, 2026

Adds NDEF write and read support for NTAG21x tags (213/215/216), and fixes
a silent write failure bug affecting both ntag write and hf mfu wrbl.

New commands

ntag write – writes NDEF records to an NTAG21x tag
--uri URI record (e.g. https://sec1.dk)
--text [--lang] Plain text record with language code
--name [...] vCard 3.0 contact record
--ssid --pass Wi-Fi credential record (WFA WSC)
--hex Raw NDEF message (hex)

ntag read – reads and decodes NDEF records from an NTAG21x tag
--dump Also print raw page hex dump

New file: script/ntag_ndef.py
NDEF encoder/decoder for URI, Text, vCard, Wi-Fi, and raw records.
URI prefix compression per NFC Forum URI RTD spec (prefix table 0x00-0x23).
Wi-Fi uses WFA WSC TLV format, readable by Android and iOS natively.

Bug fixes

  • hf mfu wrbl and ntag write both checked if resp: to determine write
    success. Response has no bool, so this was always True regardless of
    whether the card accepted the write. Fixed to check resp.data[0] == 0x00
    (PN532 InDataExchange error byte). Failed writes now print the error byte.

  • pn532_cli_main.py used str.split() to parse the command line, causing
    quoted string arguments (e.g. --text "Hello world") to include the literal
    quote characters in the value. Fixed to use shlex.split().

  • NtagWrite and NtagRead added to PN532Capabilities in pn532_enum.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant