Skip to content

Port libccid to QNX 8.0 with USB device enumeration#178

Open
hnampally wants to merge 2 commits into
LudovicRousseau:masterfrom
hnampally:qnx800-port
Open

Port libccid to QNX 8.0 with USB device enumeration#178
hnampally wants to merge 2 commits into
LudovicRousseau:masterfrom
hnampally:qnx800-port

Conversation

@hnampally

@hnampally hnampally commented Dec 31, 2025

Copy link
Copy Markdown

Add libusb API shim layer for QNX using native libusbdi. Enables USB device discovery and CCID reader detection on QNX 8.0 Neutrino systems.

  • Implement libusb_shim.h and libusb_shim_qnx.c with libusbdi integration
  • Add CMake build system for QNX aarch64le cross-compilation
  • Modify ccid_usb.c/h for conditional QNX includes
  • Update documentation with QNX support and build instructions

Tested on QNX Raspberry Pi interfaced to a RP2350 running pico-hsm: enumeration working, CCID detection verified

AI assistance used: GitHub Copilot(Claude Haiku 4.5)

@LudovicRousseau

Copy link
Copy Markdown
Owner

How is the author of src/libusb_shim.h and src/libusb_shim_qnx.c?
I only find Copyright (C) 2025 in the file headers but with no name of the copyright holder.

@hnampally

hnampally commented Dec 31, 2025

Copy link
Copy Markdown
Author

How is the author of src/libusb_shim.h and src/libusb_shim_qnx.c? I only find Copyright (C) 2025 in the file headers but with no name of the copyright holder.

Thanks for the review! I’ll get that copyright header updated. Just as a heads-up, I used GitHub Copilot (Claude 4.5 Haiku) to help develop this patch, and I'll be sure to include that in the commit message.

Add libusb API shim layer for QNX using native libusbdi. Enables USB device
discovery and CCID reader detection on QNX 8.0 Neutrino systems.

- Implement libusb_shim.h and libusb_shim_qnx.c with libusbdi integration
- Add CMake build system for QNX aarch64le cross-compilation
- Modify ccid_usb.c/h for conditional QNX includes
- Update documentation with QNX support and build instructions

Tested on QNX Raspberry Pi: enumeration working, CCID detection verified

AI assistance used: GitHub Copilot(Claude Haiku 4.5)
@LudovicRousseau

Copy link
Copy Markdown
Owner

You write:

- **Pico Key (FEFF:FCFD)** ✅ Correctly identified as CCID device

I do not (yet) have this device in my list of CCID devices.
Please follow https://ccid.apdu.fr/#CCID_compliant

What is used to build the driver? meson or CMake?

@hnampally

hnampally commented Jan 1, 2026

Copy link
Copy Markdown
Author

@LudovicRousseau Apologies for the confusion. To clarify, the Pico 2 is not CCID-compliant. Since I lack a commercial CCID device for testing, I used an un-provisioned RP2350 with a dummy VID/PID and hardcoded a fallback on line #705 to simulate compliance. I plan to patch my local firmware with a valid VID/PID for testing and remove this hardcoded logic from libusb_shim_qnx.c if that make sense, please advice.

The primary goal of this PR is to port libccid and subsequently the pcsc tool to QNX for educational purposes (using QNX hobbyist license). I am also currently working on pcsc port.

What is used to build the driver? meson or CMake?

I initially tried Meson but found it difficult to manually configure the cross-file environment. CMake’s platform modules provided much smoother auto-detection after sourcing qnx_sdp.env. Consequently, I will remove the QNX-specific changes from meson.build as they are no longer required for this cross-compilation flow

- Refactor src/libusb_shim_qnx.c to use perform_synchronous_transfer helper for bulk and interrupt transfers.
- Implement synchronous behavior using pthread_cond_wait and usbd_io callbacks.
- Map QNX USBD_STATUS_* codes to libusb error codes (e.g., TIMEOUT, STALL).
- Update libusb_claim_interface to properly open pipes for all endpoints and handle configuration iteration.
- Remove synthetic descriptor fallback; use real descriptors from QNX stack.
- Add examples/test_transfer.c for verifying transfer functionality.
- Add examples/qnx_reference_test.c and examples/linux_verify.py as reference tools.
- Update QNX_PORTING_GUIDE.md to reflect current status (Synchronous Transfers: Working).
- Update CMakeLists.txt to build test utilities.
- Cleanup meson.build and qnx-toolchain.cmake.

AI assitant use: Github Copilot(Gemini)
@hnampally

hnampally commented Jan 2, 2026

Copy link
Copy Markdown
Author

@LudovicRousseau Please find screenshot below and attached test output logs for your reference.
image

test_transfer.log
parse.log

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.

2 participants