Skip to content

Add Lego Dimensions Toy Pad support#2

Draft
pathawks wants to merge 2 commits intomainfrom
lego-dimensions
Draft

Add Lego Dimensions Toy Pad support#2
pathawks wants to merge 2 commits intomainfrom
lego-dimensions

Conversation

@pathawks
Copy link
Copy Markdown
Owner

Summary

  • Event-driven WebHID driver for the Lego Dimensions portal (VID 0x0E6F, PID 0x0241)
  • Reads NTAG213 tags with PWD_AUTH, identifies vehicles from plaintext IDs; characters show UID only (TEA-encrypted)
  • 3-pad scanner UI with LED color feedback and per-pad state management
  • Character/vehicle database (73 characters, 228 vehicles) from Ellerbach/LegoDimensions

Sources

Test plan

  • Connect Toy Pad portal, verify initialization and LED idle color
  • Place a vehicle figure, confirm name lookup and .bin download
  • Place a character figure, confirm UID-only identification
  • Test multi-pad: figures on all 3 pads simultaneously
  • Remove and re-place figures, verify state transitions
  • Test PWD_AUTH failure path (non-Lego NTAG213)
  • Verify Xbox variant (PID 0x0141) is detected but handled gracefully
  • Confirm no regressions on PowerSaves Amiibo scanner

Event-driven WebHID driver for the Lego Dimensions portal with
NTAG213 reading (PWD_AUTH), vehicle ID lookup from plaintext pages,
and a 3-pad scanner UI. Character IDs remain encrypted (UID only).

Sources: Ellerbach/LegoDimensions (MIT), AlinaNova21/node-ld (ISC)
The Toy Pad's READ command args were documented as
[mode, tagIndex, page] in the reference projects we copied from;
the actual order is [mode, page, tagIndex]. With the wrong order,
the portal silently returns pages 0-3 regardless of the requested
page — so the driver had literally never been reading real NTAG213
content past page 3, just pages 0-3 repeated 11x and labeled a
"character." Correcting the order yields genuine 180-byte NTAG213
dumps with unique CRCs per tag.

While here, make the scanner actually useful for non-Lego tags:

- Classify tags using the marker byte from the portal's 0x56 event:
  NTAG (Lego), MIFARE Classic Disney, foreign MIFARE, 4-byte MIFARE.
  Non-Lego tags short-circuit with device-agnostic messages instead
  of being labeled as Lego characters.
- Validate the returned page-0 UID against the anti-collision UID,
  because the portal doesn't reliably honor tagIndex when multiple
  tags are on the pad — it returns data for whichever tag its NFC
  controller happens to be locked onto. Mismatches now show
  "another tag on the portal is blocking this read" instead of
  silently presenting another tag's bytes.
- Clear the failed-UID cache when a non-NTAG tag is removed, so a
  Disney tag being lifted off unblocks NTAG tags that had been
  failing via NFC coexistence.
- Display the UID in the error state.
- Tighten the portal-command msg-id range to 0x20..0x7F so late
  auto-read responses (which the portal sends with IDs starting at
  0x86) can't masquerade as our outstanding READ.

Plus a top-of-file TODO block in the driver cataloguing the known
limitations that weren't fixed in this pass: no multi-tag
addressing, Disney coexistence poisoning NTAG reads, unverified
PWD_AUTH arg order, leaked HID listener on reconnect, no auto-
retry after coexistence clears, Amiibo content not read.
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