pcsc_mon
A lightweight, thread-safe PC/SC monitor for detecting smart card reader and card events in Rust.
This crate provides a singleton-style interface for monitoring reader addition/removal and card insertion/removal events using pcsc. It supports hotplug detection, background monitoring, and callback registration.
Features
- Detect reader plug/unplug events.
- Detect card insert/removal events.
- Automatically manages
pcsc::Contextandpcsc::Cardin callbacks. - Thread-safe, event-driven API.
- Singleton pattern ensures safe concurrent access.
Example
use PcscMonitor;
Known Quirks
- When a reader is unplugged, it is marked internally with State::IGNORE. If the same reader is re-plugged, a card must be inserted and removed again to re-trigger card events. This is a peculiarity of pcsc crate
License
MIT License © 2025 Thernamyte Cloud & Medien UG (haftungsbeschränkt)
See LICENSE for details.