investigate: capture raw NDEF bytes for app-written tags (#1098, #1106)#1107
Draft
wizzomafizzo wants to merge 2 commits into
Draft
investigate: capture raw NDEF bytes for app-written tags (#1098, #1106)#1107wizzomafizzo wants to merge 2 commits into
wizzomafizzo wants to merge 2 commits into
Conversation
App-written NTAG213 tags (#1098, #1106) read on Core as a validly-formatted tag with an empty NDEF message (messageNil=false, zero records = an NDEF TLV of length 0). go-pn532 already prints the raw bytes it reads from the tag via Debugf, but Core never captured that output, so the decisive bytes never reached the log. Add a zerolog adapter in the PN532 reader that forwards go-pn532's debug lines to log.Debug(), installed once when the existing debug_logging config is on. Pairs with go-pn532's new SetDebugWriter hook. Includes temporary local wiring to build against a sibling go-pn532 checkout (go.mod replace + docker mount); see PR description for removal.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
Why
App-written NTAG213 tags don't launch on Core (#1098, #1106). Across the attached logs the failing
scans show a validly-formatted NTAG213 (valid Capability Container →
variant=NTAG213,hasNDEF=true) whose NDEF message is empty:messageNil=falsewith zero records, which is emittedonly when the NDEF TLV has a length byte of 0 (
03 00). The record the app intended to write is notwhere Core reads it.
go-pn532 already prints the exact bytes it reads from a tag (
readNDEFHeader: user data = [...]) viaDebugf, but Core never wired that output anywhere, so the decisive bytes are absent from every log.This PR captures them.
What
pkg/readers/pn532/debug.go: azerologDebugWriterthat forwards each go-pn532 debug line tolog.Debug().Str("src","pn532"), installed once viasync.Once.pkg/readers/pn532/pn532.go:Openinstalls it when the existingdebug_loggingconfig isenabled. No new config key.
SetDebugWriter(io.Writer)hook in go-pn532 (see note below).With
debug_loggingon, a failing app-written tag and a working Core-written tag can be scanned andtheir byte dumps diffed to decide write-side vs read-side.
This branch builds against a local sibling
../go-pn532checkout because theSetDebugWriterhook it calls is not yet in a released go-pn532. Two temporary bits must be undone before this can
merge:
go.mod—replace github.com/ZaparooProject/go-pn532 => ../go-pn532scripts/tasks/docker.yml— theGOPN532_MOUNTvar + its{{.GOPN532_MOUNT}}mount, whichbind the sibling checkout into the build container so the replace resolves there too.
Before merge: land
SetDebugWriterin go-pn532, cut a release, bump the go-pn532 version ingo.mod,and delete both items above.
Status
Parked pending on-device reproduction (a physically app-written failing tag scanned on the MiSTer
with
debug_loggingon). If the captured bytes show a genuine empty NDEF (03 00), the fix isapp-side (write read-back verification); if they show a valid record Core misreads, a read-side fix
lands in go-pn532.
An app-team write-up (read-back verification for #1098, hidden error toast for #1106) is kept locally
in
docs/plans/nfc-app-write-verification.md(that directory is git-excluded, so it is not in thisPR).