ntag: add write/read commands with NDEF support, fix false-OK on mfu wrbl#40
Open
nieldk wants to merge 1 commit into
Open
ntag: add write/read commands with NDEF support, fix false-OK on mfu wrbl#40nieldk wants to merge 1 commit into
nieldk wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 writesuccess. 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.