Skip to content

Add Transparent Reader Support (TRS)#324

Open
sidcha wants to merge 2 commits into
masterfrom
trs_dev
Open

Add Transparent Reader Support (TRS)#324
sidcha wants to merge 2 commits into
masterfrom
trs_dev

Conversation

@sidcha

@sidcha sidcha commented Jul 12, 2026

Copy link
Copy Markdown
Member

TRS tunnels raw smart-card APDUs from the CP, through a PD acting as a transparent pipe, to a card in the reader (OSDP CMD_XWR/REPLY_XRD, capability SMART_CARD_SUPPORT). The control panel drives the card directly, so a compromised reader cannot forge a credential.

The CP runs the session as a library-driven state machine: it negotiates transparent mode, streams the app's APDUs, and tears the session down on osdp_cp_trs_stop(). Apps submit OSDP_CMD_XWR commands and receive card responses as OSDP_EVENT_TRS events.

The PD answers each APDU either synchronously, in the command callback, or deferred: it ACKs "working" and delivers the response on a later poll once a slow card responds. Deferral keeps a shared multi-drop bus non-blocking, so each PD's session makes progress independently.

Gated behind OPT_BUILD_OSDP_TRS (default off); wired into both build systems and covered by a CP<->PD APDU round-trip unit test.

Co-developed-by: Aaron Tulino (Aaronjamt) git@aaronjamt.com

@sidcha
sidcha force-pushed the trs_dev branch 2 times, most recently from 492f333 to dcdb1a3 Compare July 13, 2026 14:16
sidcha added 2 commits July 14, 2026 19:27
TRS tunnels raw smart-card APDUs from the CP, through a PD acting as
a transparent pipe, to a card in the reader (OSDP CMD_XWR/REPLY_XRD,
capability SMART_CARD_SUPPORT). The control panel drives the card
directly, so a compromised reader cannot forge a credential.

The CP runs the session as a library-driven state machine: it
negotiates transparent mode, streams the app's APDUs, and tears the
session down on osdp_cp_trs_stop(). Apps submit OSDP_CMD_XWR commands
and receive card responses as OSDP_EVENT_TRS events.

The PD answers each APDU either synchronously, in the command
callback, or deferred: it ACKs "working" and delivers the response on
a later poll once a slow card responds. Deferral keeps a shared
multi-drop bus non-blocking, so each PD's session makes progress
independently.

Gated behind OPT_BUILD_OSDP_TRS (default off); wired into both build
systems and covered by a CP<->PD APDU round-trip unit test.

Fixes: #22
Co-developed-by: Aaron Tulino (Aaronjamt) <git@aaronjamt.com>
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
The RPK40 reports a card with the reader byte alone, and the decoder
rejected the frame for want of the status byte that follows it. Take
such a reply at face value -- a card is there -- and report the status
as unspecified.

This is a workaround for readers that do not distinguish contact from
contactless, not a reading of the spec; revert it if the truncated
reply turns out to mean something else.

Related-to: #22
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
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