<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ludovic Rousseau's blog (Posts about pcsc-lite)</title><link>https://blog.apdu.fr/</link><description></description><atom:link href="https://blog.apdu.fr/categories/pcsc-lite.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:ludovic.rousseau+blog@free.fr"&gt;Ludovic Rousseau&lt;/a&gt; - License &lt;a href="/posts/2010/08/my-blog-messages-license/"&gt;CC BY-NC-SA 4.0 Deed&lt;/a&gt; for the text &amp;amp; &lt;a href="/posts/2019/01/my-blog-source-code-license/"&gt;GNU GPLv3&lt;/a&gt; for the code</copyright><lastBuildDate>Sun, 01 Feb 2026 13:16:32 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>pcsc-lite backward &amp; forward compatible with itself</title><link>https://blog.apdu.fr/posts/2026/01/pcsc-lite-backward-forward-compatible-with-itself/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;pcsc-lite 2.4.1 now provides a backward &amp;amp; forward compatible mechanism
that supports both the current and previous &lt;cite&gt;internal&lt;/cite&gt; communication
protocols.&lt;/p&gt;
&lt;p&gt;The communication protocol we are talking about here is the one between
the client (libpcsclite) and the server (pcscd) sides. It is an
internal-only protocol that is specific to pcsc-lite.&lt;/p&gt;
&lt;section id="protocol-negotiation"&gt;
&lt;h2&gt;Protocol negotiation&lt;/h2&gt;
&lt;p&gt;To ensure that the client and server are using the same protocol, they
negotiate the procotol they know. If they are different, the server
will refuse the connection. In the application (client side), the
&lt;a class="reference external" href="https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67"&gt;SCardEstablishContext()&lt;/a&gt;
function will return the error code &lt;code class="docutils literal"&gt;SCARD_E_SERVICE_STOPPED&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Up to version 2.4.0, both the server and the client only supported one
protocol version (version 4:5).&lt;/p&gt;
&lt;/section&gt;
&lt;section id="sandboxes"&gt;
&lt;h2&gt;Sandboxes&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="https://www.wikipedia.org/wiki/Flatpak"&gt;Flatpack&lt;/a&gt;, &lt;a class="reference external" href="https://www.wikipedia.org/wiki/Snap_(software)"&gt;Snap&lt;/a&gt;, &lt;a class="reference external" href="https://www.wikipedia.org/wiki/AppImage"&gt;AppImage&lt;/a&gt; and other sandbox
technologies are now used to distribute applications.&lt;/p&gt;
&lt;p&gt;In some/many cases, the server (pcscd daemon) running on the host comes
from a different version of pcsc-lite than the client used in the
sandbox. If the internal communication protocol differs, the
communication is not possible.&lt;/p&gt;
&lt;p&gt;I receive requests to solve this problem. See:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/LudovicRousseau/PCSC/issues/199"&gt;Backward protocol compatibility #199&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/LudovicRousseau/PCSC/issues/246"&gt;Runtime-configurable IPC dir #246&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://salsa.debian.org/rousseau/PCSC/-/issues/22"&gt;Support multiple versions of the internal protocol: fix Flatpak issues&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id="protocol-history"&gt;
&lt;h2&gt;Protocol History&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th class="head"&gt;&lt;p&gt;pcsc-lite version&lt;/p&gt;&lt;/th&gt;
&lt;th class="head"&gt;&lt;p&gt;Release Date&lt;/p&gt;&lt;/th&gt;
&lt;th class="head"&gt;&lt;p&gt;Protocol version&lt;/p&gt;&lt;/th&gt;
&lt;th class="head"&gt;&lt;p&gt;Compatible with&lt;/p&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;2.4.1&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;1 Jan 2026&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;4:5&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;4:4 &amp;amp; 4:5&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;2.4.0&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;19 Oct 2025&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="5"&gt;&lt;p&gt;4:5&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="5"&gt;&lt;p&gt;4:5&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;2.3.3&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;2 Apr 2025&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;2.3.2&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;26 Mar 2025&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;2.3.1&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;24 Dec 2024&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;2.3.0&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;3 Aug 2024&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;2.2.3&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;26 May 2024&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="3"&gt;&lt;p&gt;4:4&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="3"&gt;&lt;p&gt;4:4&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;...&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;!--  --&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;1.8.24&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;12 Oct 2018&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;1.8.23&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;18 Dec 2017&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="3"&gt;&lt;p&gt;4:3&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="3"&gt;&lt;p&gt;4:3&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;...&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;!--  --&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;1.8.9&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;16 Oct 2013&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;1.8.8&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;16 Jan 2012&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="3"&gt;&lt;p&gt;4:2&lt;/p&gt;&lt;/td&gt;
&lt;td rowspan="3"&gt;&lt;p&gt;4:2&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;...&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;!--  --&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;p&gt;1.6.5&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;12 Oct 2010&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/section&gt;
&lt;section id="new-protocol-negotiation"&gt;
&lt;h2&gt;New protocol negotiation&lt;/h2&gt;
&lt;p&gt;From pcsc-lite 2.4.1 onwards, the protocol negotiation is smarter.&lt;/p&gt;
&lt;p&gt;The daemon side will accept the current version and also the previous
one. Versions 4:5 and 4:4 are accepted. It is straightforward, as the
only change with version 4:5 is the addition of a new command
(command &lt;code class="docutils literal"&gt;CMD_GET_READER_EVENTS&lt;/code&gt; introduced in commit
&lt;a class="reference external" href="https://salsa.debian.org/rousseau/PCSC/-/commit/53f57ed700bcd0bc47d970dc674ba3fd5ee5b387"&gt;53f57ed700bcd0bc47d970dc674ba3fd5ee5b387&lt;/a&gt;).
Old clients will simply not use the new command.&lt;/p&gt;
&lt;p&gt;The client side will also accept the current version and the previous
one. These are versions 4:5 and 4:4. Using a recent client (protocol 4:5)
with an old server (protocol 4:4) will have a small side effect. The
&lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; function will not include the number of
reader events (see
&lt;a class="reference external" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/"&gt;Improved SCardGetStatusChange() for "\\?PnP?\Notification" special reader&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Applications using pcsc-lite 2.4.1 can use a daemon as old as
pcsc-lite version 1.8.24, released in October 2018.&lt;/p&gt;
&lt;p&gt;A pcscd daemon from pcsc-lite 2.4.1 can handle clients as old as the
same pcsc-lite version 1.8.24 from October 2018.&lt;/p&gt;
&lt;p&gt;Supporting the (older) protocol version 4:3 may be possible but would
require more efforts and be more complex. Contact me if you require
this.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="conclusion"&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;This change should help mix PC/SC servers and clients from more
different versions.&lt;/p&gt;
&lt;p&gt;This should prevent people from using ugly hacks.&lt;/p&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2026/01/pcsc-lite-backward-forward-compatible-with-itself/</guid><pubDate>Wed, 07 Jan 2026 15:55:10 GMT</pubDate></item><item><title>New version of pcsc-lite: 2.4.1</title><link>https://blog.apdu.fr/posts/2026/01/new-version-of-pcsc-lite-241/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;I have just released a new version of &lt;a class="reference external" href="https://pcsclite.apdu.fr/files/"&gt;pcsc-lite 2.4.1&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://pcsclite.apdu.fr/"&gt;pcsc-lite&lt;/a&gt; is a Free Software
implementation of the &lt;a class="reference external" href="https://www.wikipedia.org/wiki/PC/SC"&gt;PC/SC&lt;/a&gt;
(also known as WinSCard) API for Unix systems. It provides an API for
using &lt;a class="reference external" href="https://www.wikipedia.org/wiki/Smart_card"&gt;smart cards&lt;/a&gt; and
smart card readers.&lt;/p&gt;
&lt;p&gt;This version offers backwards compatibility for both the client and
server components. It should now be easier to mix and match different
versions of pcscd and libpcsclite (and using different internal protocol
versions).&lt;/p&gt;
&lt;section id="changes"&gt;
&lt;h2&gt;Changes:&lt;/h2&gt;
&lt;dl class="simple"&gt;
&lt;dt&gt;2.4.1: Ludovic Rousseau&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;1 January 2026&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Add backward version support on the client side&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add backward version support on the server side&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;hotplug libudev: rescan the USB bus with &lt;code class="docutils literal"&gt;pcscd &lt;span class="pre"&gt;--hotplug&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;fix a value in &lt;code class="docutils literal"&gt;pcscd.service&lt;/code&gt; systemd file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;meson: install systemd files even if libsystemd is not used&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Some other minor improvements&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2026/01/new-version-of-pcsc-lite-241/</guid><pubDate>Wed, 07 Jan 2026 14:33:25 GMT</pubDate></item><item><title>Outdated and broken PC/SC drivers with pcsc-lite 2.4.0</title><link>https://blog.apdu.fr/posts/2025/10/outdated-and-broken-pcsc-drivers-with-pcsc-lite-240/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;Since pcsc-lite 2.4.0 and the fact that pcscd can now run as a normal
user (see &lt;a class="reference external" href="https://blog.apdu.fr/posts/2025/10/pcscd-runs-as-pcscd-user/"&gt;pcscd runs as pcscd user&lt;/a&gt;), the driver must configure the
reader's device access rights. Otherwise, the pcscd process will
not be able to use the device.&lt;/p&gt;
&lt;section id="unmaintained-drivers"&gt;
&lt;h2&gt;Unmaintained drivers&lt;/h2&gt;
&lt;p&gt;Some older, unmaintained drivers will no longer work with pcscd. I have
requested their removal from Debian unstable.&lt;/p&gt;
&lt;p&gt;They are:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;libasedrive-serial &amp;amp; libasedrive-usb from &lt;a class="reference external" href="https://tracker.debian.org/pkg/asedriveiiie"&gt;asedriveiiie&lt;/a&gt; (see bug &lt;a class="reference external" href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1119077"&gt;#1119077&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;libgempc410 &amp;amp; libgempc430 from &lt;a class="reference external" href="https://tracker.debian.org/pkg/ifd-gempc"&gt;ifd-gempc&lt;/a&gt; (see bug &lt;a class="reference external" href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1119078"&gt;#1119078&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I am the Debian maintainer of these packages, so it is my responsibility
to open tickets to &lt;a class="reference external" href="https://wiki.debian.org/ftpmaster_Removals"&gt;remove the packages&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I also filed a &lt;em&gt;release critical&lt;/em&gt; bug &lt;a class="reference external" href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1119081"&gt;#1119081&lt;/a&gt; on
&lt;a class="reference external" href="https://tracker.debian.org/pkg/libgcr410"&gt;libgcr410&lt;/a&gt; so that this
driver will not be included in the next version of Debian (unless the
issue is fixed).&lt;/p&gt;
&lt;section id="old-hardware"&gt;
&lt;h3&gt;Old hardware&lt;/h3&gt;
&lt;p&gt;These drivers are intended for very old serial smart card readers (who
still has a serial port on their computer?) or USB readers from the
last century.&lt;/p&gt;
&lt;p&gt;The advantage of Free Software is that if someone still has such a
device, they can obtain the source code of the driver (still available
online), adapt it and use it.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="old-software"&gt;
&lt;h3&gt;Old software&lt;/h3&gt;
&lt;p&gt;There has been no new version of the asedriveiiie software since September 2010.
The source code is no longer available from the publisher (a commecial company).&lt;/p&gt;
&lt;p&gt;The ifd-gempc software is maintained upstream by me. The latest &lt;em&gt;major&lt;/em&gt;
version dates from April 2012 and was mostly compiler warnings fixes. The
source code is still available at &lt;a class="reference external" href="https://ifd-gempc.apdu.fr/"&gt;https://ifd-gempc.apdu.fr/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The libgcr410 software was also written by me. I wrote it before
ifd-gempc and I am surprised to see it packaged in Debian, as it should
be replaced by ifd-gempc. The Debian package has been abandonned by its
Debian maintainer since March 2008. More recent Debian versions have
been produced by the Debian Quality Assurance (QA) team.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="popularity"&gt;
&lt;h3&gt;Popularity&lt;/h3&gt;
&lt;p&gt;I have already published an article on the popularity of Debian packages
for smart cards in 2020 in &lt;a class="reference external" href="https://blog.apdu.fr/posts/2020/04/smart-card-usage-in-debian-popcon/"&gt;Smart card Usage in Debian: pcscd and drivers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With updated graphics, we now have:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;asedriveiiie&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;a class="reference external image-reference" href="https://qa.debian.org/popcon.php?package=asedriveiiie"&gt;
&lt;img alt="Popularity contest statistics for asedriveiiie" src="https://blog.apdu.fr/images/2025/10/asedriveiiie.png"&gt;
&lt;/a&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;ifd-gempc&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;a class="reference external image-reference" href="https://qa.debian.org/popcon.php?package=ifd-gempc"&gt;
&lt;img alt="Popularity contest statistics for ifd-gempc" src="https://blog.apdu.fr/images/2025/10/ifdgempc.png"&gt;
&lt;/a&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;libgcr410&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;a class="reference external image-reference" href="https://qa.debian.org/popcon.php?package=libgcr410"&gt;
&lt;img alt="Popularity contest statistics for libgcr410" src="https://blog.apdu.fr/images/2025/10/libgcr410.png"&gt;
&lt;/a&gt;
&lt;p&gt;Very few people still have these packages installed. And even fewer
use them.&lt;/p&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id="changes-required"&gt;
&lt;h2&gt;Changes required&lt;/h2&gt;
&lt;p&gt;I also filed the bug &lt;a class="reference external" href="https://github.com/acshk/acsccid/issues/39"&gt;#39&lt;/a&gt;
"Set group to pcscd in the udev rules file" on the upstream &lt;a class="reference external" href="https://github.com/acshk/acsccid"&gt;acsccid&lt;/a&gt; driver.&lt;/p&gt;
&lt;p&gt;This driver is a fork of &lt;a class="reference external" href="https://ccid.apdu.fr/"&gt;my CCID driver&lt;/a&gt; and
is still actively maintained. The problem should therefore be resolved
in a new version.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="conclusion"&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I don't have enough free time to maintain software that is no longer in
use.&lt;/p&gt;
&lt;p&gt;I haven't used these drivers for at least 10 years. And I don't plan on
using them in the future, because I discovered that I no longer have the
smart card readers.&lt;/p&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2025/10/outdated-and-broken-pcsc-drivers-with-pcsc-lite-240/</guid><pubDate>Fri, 31 Oct 2025 16:59:51 GMT</pubDate></item><item><title>New version of pcsc-lite: 2.4.0</title><link>https://blog.apdu.fr/posts/2025/10/new-version-of-pcsc-lite-240/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;I just released a new version of &lt;a class="reference external" href="https://pcsclite.apdu.fr/files/"&gt;pcsc-lite 2.4.0&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://pcsclite.apdu.fr/"&gt;pcsc-lite&lt;/a&gt; is a Free Software
implementation of the PC/SC (or WinSCard) API for Unix systems.&lt;/p&gt;
&lt;p&gt;The major change in this release is that the &lt;code class="docutils literal"&gt;pcscd&lt;/code&gt; daemon process now
runs as a normal user instead of root (when systemd is used).&lt;/p&gt;
&lt;p&gt;You must use drivers that configure the reader device access rights so
that a user in the pcscd group can access it for reading and writing.
That is the case for libccid 1.7.0.  See
&lt;a class="reference external" href="https://blog.apdu.fr/posts/2025/10/new-version-of-libccid-170/"&gt;New version of libccid: 1.7.0&lt;/a&gt;.&lt;/p&gt;
&lt;section id="changes"&gt;
&lt;h2&gt;Changes:&lt;/h2&gt;
&lt;dl class="simple"&gt;
&lt;dt&gt;2.4.0: Ludovic Rousseau&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;19 October 2025&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Run pcscd under a pcscd user instead of root when using systemd&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set PIDFile in systemd service file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Protect contextMapList modifications using a mutex&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;meson:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fix &lt;code class="docutils literal"&gt;libpcsclite.pc&lt;/code&gt; file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;respect builtin meson default_library option&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;build and install spy lib &amp;amp; tool only when needed&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;UnitaryTests/*.py&lt;/span&gt;&lt;/code&gt;: fix pylint warnings&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improve Doxygen documentation&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2025/10/new-version-of-pcsc-lite-240/</guid><pubDate>Sun, 19 Oct 2025 13:25:09 GMT</pubDate></item><item><title>New version of pcsc-lite: 2.3.3</title><link>https://blog.apdu.fr/posts/2025/04/new-version-of-pcsc-lite-233/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;I just released a new version of &lt;a class="reference external" href="https://pcsclite.apdu.fr/files/"&gt;pcsc-lite 2.3.3&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://pcsclite.apdu.fr/"&gt;pcsc-lite&lt;/a&gt; is a Free Software
implementation of the PC/SC (or WinSCard) API for Unix systems.&lt;/p&gt;
&lt;p&gt;Polkit rules was broken. So it was no more possible to give access to
remote users for example. See &lt;a class="reference external" href="https://blog.apdu.fr/posts/2023/11/pcsc-lite-and-polkit/"&gt;pcsc-lite and polkit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a class="reference external" href="https://github.com/mk-fg"&gt;Mike Kazantsev&lt;/a&gt; for the very nice
bug report in &lt;a class="reference external" href="https://github.com/LudovicRousseau/PCSC/issues/231"&gt;PrivateUsers=yes in systemd sandboxing options prevents
polkit rules from getting user/group info&lt;/a&gt;.&lt;/p&gt;
&lt;section id="changes"&gt;
&lt;h2&gt;Changes:&lt;/h2&gt;
&lt;dl class="simple"&gt;
&lt;dt&gt;2.3.3: Ludovic Rousseau&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;2 April 2025&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Make polkit rules work again (bug introduced in 2.3.2)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2025/04/new-version-of-pcsc-lite-233/</guid><pubDate>Wed, 02 Apr 2025 15:54:28 GMT</pubDate></item><item><title>Ignore readers using PCSCLITE_IGNORE udev property</title><link>https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;Version 2.3.2 of pcsc-lite (&lt;a class="reference external" href="https://blog.apdu.fr/posts/2025/03/new-version-of-pcsc-lite-232/"&gt;New version of pcsc-lite: 2.3.2&lt;/a&gt;)
introduced a new way to ignore a smart card reader.&lt;/p&gt;
&lt;p&gt;The &lt;a class="reference external" href="https://github.com/LudovicRousseau/PCSC/commit/a4184a0a8336c0a06c6596131a9644c35b657a31"&gt;patch&lt;/a&gt;
included in pcsc-lite is from Valtteri Vuorikoski and I will quote his
git commit message in this article.&lt;/p&gt;
&lt;section id="use-case"&gt;
&lt;h2&gt;Use case&lt;/h2&gt;
&lt;p&gt;"This is similar to the existing filtering support provided by
&lt;code class="docutils literal"&gt;PCSCLITE_FILTER_IGNORE_READER_NAMES&lt;/code&gt;
(&lt;a class="reference external" href="https://blog.apdu.fr/posts/2015/12/remove-andor-customize-pcsc-reader-names/"&gt;Remove  and/or customize PC/SC reader names&lt;/a&gt;), but allows using the
full range of udev rules to match specific devices. For example, if you
have several Yubikeys and one is attached to a specific USB port that is
being forwarded to a virtual machine (viz. it should not be touched by
programs on the host machine), this facility allows setting a rule to
keep pcscd away from that Yubikey. Yubikeys attached to other ports keep
working normally."&lt;/p&gt;
&lt;/section&gt;
&lt;section id="udev"&gt;
&lt;h2&gt;udev&lt;/h2&gt;
&lt;p&gt;By default pcsc-lite uses libudev to detect readers events (plug or unplug
of a USB reader). The idea is to use a flag set by udev to tell
pcsc-lite to ignore a reader.&lt;/p&gt;
&lt;p&gt;Example rule that targets a Yubikey attached to a specific USB port and causes
pcscd to ignore that device:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_fa2903a3426a4bfe9d5c8a0af231776b-1" name="rest_code_fa2903a3426a4bfe9d5c8a0af231776b-1" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_fa2903a3426a4bfe9d5c8a0af231776b-1"&gt;&lt;/a&gt;ACTION!="remove|unbind", SUBSYSTEM=="usb", ATTR{idVendor}=="1050",
&lt;a id="rest_code_fa2903a3426a4bfe9d5c8a0af231776b-2" name="rest_code_fa2903a3426a4bfe9d5c8a0af231776b-2" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_fa2903a3426a4bfe9d5c8a0af231776b-2"&gt;&lt;/a&gt;ATTR{idProduct}=="0406", KERNEL=="1-2.3", ENV{PCSCLITE_IGNORE}="1"
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code class="docutils literal"&gt;KERNEL&lt;/code&gt; match targets a USB device attached to port 3 of a hub on
port 2 of USB bus 1, and rule sets property &lt;code class="docutils literal"&gt;PCSCLITE_IGNORE&lt;/code&gt; to cause
the device to be ignored.&lt;/p&gt;
&lt;p&gt;The reader with &lt;a class="reference external" href="https://ccid.apdu.fr/select_readers/?idProduct=1030&amp;amp;idVendor=4176"&gt;idVendor=0x1050 and idProduct=0x0406&lt;/a&gt; is
the &lt;a class="reference external" href="https://ccid.apdu.fr/ccid/shouldwork.html#0x10500x0406"&gt;YubiKey FIDO+CCID&lt;/a&gt; from Yubico.&lt;/p&gt;
&lt;p&gt;Or if you want to ignore &lt;strong&gt;any&lt;/strong&gt; reader connected to USB port 1-3:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_9bb6230287e74dfeaa90b001facf7940-1" name="rest_code_9bb6230287e74dfeaa90b001facf7940-1" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_9bb6230287e74dfeaa90b001facf7940-1"&gt;&lt;/a&gt;ACTION!="remove|unbind", SUBSYSTEM=="usb", KERNEL=="1-3", ENV{PCSCLITE_IGNORE}="1"
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You put the above rule is a file &lt;code class="docutils literal"&gt;/etc/udev/rules.d/foobar.rules&lt;/code&gt; and
voila.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="config"&gt;
&lt;h2&gt;Config&lt;/h2&gt;
&lt;p&gt;To know what value for &lt;code class="docutils literal"&gt;KERNEL=&lt;/code&gt; to use you can run &lt;code class="docutils literal"&gt;udevadm monitor&lt;/code&gt;
and connect a USB reader. You will get something like:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-1" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-1" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-1"&gt;&lt;/a&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;udevadm&lt;span class="w"&gt; &lt;/span&gt;monitor
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-2" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-2" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-2"&gt;&lt;/a&gt;&lt;span class="go"&gt;monitor will print the received events for:&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-3" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-3" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-3"&gt;&lt;/a&gt;&lt;span class="go"&gt;UDEV - the event which udev sends out after rule processing&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-4" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-4" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-4"&gt;&lt;/a&gt;&lt;span class="go"&gt;KERNEL - the kernel uevent&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-5" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-5" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-5"&gt;&lt;/a&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-6" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-6" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-6"&gt;&lt;/a&gt;&lt;span class="go"&gt;KERNEL[2022.067560] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-7" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-7" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-7"&gt;&lt;/a&gt;&lt;span class="go"&gt;KERNEL[2022.069016] change   /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-8" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-8" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-8"&gt;&lt;/a&gt;&lt;span class="go"&gt;KERNEL[2022.069332] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-9" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-9" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-9"&gt;&lt;/a&gt;&lt;span class="go"&gt;KERNEL[2022.069416] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-10" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-10" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-10"&gt;&lt;/a&gt;&lt;span class="go"&gt;UDEV  [2022.690370] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-11" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-11" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-11"&gt;&lt;/a&gt;&lt;span class="go"&gt;UDEV  [2022.695881] change   /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-12" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-12" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-12"&gt;&lt;/a&gt;&lt;span class="go"&gt;UDEV  [2022.700310] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)&lt;/span&gt;
&lt;a id="rest_code_d44fc71c16a045e18894e8ac5a0057ff-13" name="rest_code_d44fc71c16a045e18894e8ac5a0057ff-13" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_d44fc71c16a045e18894e8ac5a0057ff-13"&gt;&lt;/a&gt;&lt;span class="go"&gt;UDEV  [2022.728691] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can see the "1-3" information to use in the &lt;code class="docutils literal"&gt;.rules&lt;/code&gt; file.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="debug"&gt;
&lt;h2&gt;Debug&lt;/h2&gt;
&lt;p&gt;To debug your configuration and check the new field &lt;code class="docutils literal"&gt;PCSCLITE_IGNORE&lt;/code&gt; is
correctly set you can use &lt;code class="docutils literal"&gt;udevadm monitor &lt;span class="pre"&gt;--property&lt;/span&gt;&lt;/code&gt; and you get
something like:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-1" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-1" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-1"&gt;&lt;/a&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;udevadm&lt;span class="w"&gt; &lt;/span&gt;monitor&lt;span class="w"&gt; &lt;/span&gt;--property
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-2" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-2" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-2"&gt;&lt;/a&gt;&lt;span class="go"&gt;monitor will print the received events for:&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-3" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-3" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-3"&gt;&lt;/a&gt;&lt;span class="go"&gt;UDEV - the event which udev sends out after rule processing&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-4" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-4" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-4"&gt;&lt;/a&gt;&lt;span class="go"&gt;KERNEL - the kernel uevent&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-5" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-5" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-5"&gt;&lt;/a&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-6" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-6" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-6"&gt;&lt;/a&gt;&lt;span class="go"&gt;KERNEL[2265.405075] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-7" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-7" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-7"&gt;&lt;/a&gt;&lt;span class="go"&gt;ACTION=add&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-8" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-8" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-8"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-9" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-9" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-9"&gt;&lt;/a&gt;&lt;span class="go"&gt;SUBSYSTEM=usb&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-10" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-10" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-10"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVNAME=/dev/bus/usb/001/015&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-11" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-11" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-11"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVTYPE=usb_device&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-12" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-12" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-12"&gt;&lt;/a&gt;&lt;span class="go"&gt;PRODUCT=8e6/3437/100&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-13" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-13" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-13"&gt;&lt;/a&gt;&lt;span class="go"&gt;TYPE=0/0/0&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-14" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-14" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-14"&gt;&lt;/a&gt;&lt;span class="go"&gt;BUSNUM=001&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-15" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-15" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-15"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVNUM=015&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-16" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-16" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-16"&gt;&lt;/a&gt;&lt;span class="go"&gt;SEQNUM=4692&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-17" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-17" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-17"&gt;&lt;/a&gt;&lt;span class="go"&gt;MAJOR=189&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-18" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-18" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-18"&gt;&lt;/a&gt;&lt;span class="go"&gt;MINOR=14&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-19" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-19" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-19"&gt;&lt;/a&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-20" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-20" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-20"&gt;&lt;/a&gt;&lt;span class="go"&gt;[...]&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-21" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-21" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-21"&gt;&lt;/a&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-22" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-22" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-22"&gt;&lt;/a&gt;&lt;span class="go"&gt;UDEV  [2266.066186] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-23" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-23" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-23"&gt;&lt;/a&gt;&lt;span class="go"&gt;ACTION=bind&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-24" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-24" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-24"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-25" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-25" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-25"&gt;&lt;/a&gt;&lt;span class="go"&gt;SUBSYSTEM=usb&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-26" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-26" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-26"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVNAME=/dev/bus/usb/001/015&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-27" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-27" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-27"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVTYPE=usb_device&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-28" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-28" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-28"&gt;&lt;/a&gt;&lt;span class="go"&gt;DRIVER=usb&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-29" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-29" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-29"&gt;&lt;/a&gt;&lt;span class="go"&gt;PRODUCT=8e6/3437/100&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-30" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-30" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-30"&gt;&lt;/a&gt;&lt;span class="go"&gt;TYPE=0/0/0&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-31" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-31" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-31"&gt;&lt;/a&gt;&lt;span class="go"&gt;BUSNUM=001&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-32" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-32" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-32"&gt;&lt;/a&gt;&lt;span class="go"&gt;DEVNUM=015&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-33" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-33" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-33"&gt;&lt;/a&gt;&lt;span class="go"&gt;SEQNUM=4695&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-34" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-34" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-34"&gt;&lt;/a&gt;&lt;span class="go"&gt;USEC_INITIALIZED=2265405122&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-35" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-35" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-35"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_BUS=usb&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-36" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-36" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-36"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_MODEL=USB_SmartCard_Reader&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-37" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-37" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-37"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_MODEL_ENC=USB\x20SmartCard\x20Reader&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-38" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-38" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-38"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_MODEL_ID=3437&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-39" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-39" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-39"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_SERIAL=Gemplus_USB_SmartCard_Reader&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-40" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-40" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-40"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_VENDOR=Gemplus&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-41" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-41" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-41"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_VENDOR_ENC=Gemplus&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-42" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-42" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-42"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_VENDOR_ID=08e6&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-43" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-43" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-43"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_REVISION=0100&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-44" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-44" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-44"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_MODEL=USB_SmartCard_Reader&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-45" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-45" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-45"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_MODEL_ENC=USB\x20SmartCard\x20Reader&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-46" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-46" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-46"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_MODEL_ID=3437&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-47" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-47" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-47"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_SERIAL=Gemplus_USB_SmartCard_Reader&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-48" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-48" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-48"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_VENDOR=Gemplus&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-49" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-49" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-49"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_VENDOR_ENC=Gemplus&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-50" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-50" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-50"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_VENDOR_ID=08e6&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-51" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-51" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-51"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_REVISION=0100&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-52" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-52" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-52"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_USB_INTERFACES=:0b0000:&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-53" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-53" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-53"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_VENDOR_FROM_DATABASE=Gemalto (was Gemplus)&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-54" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-54" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-54"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_MODEL_FROM_DATABASE=GemPC Twin SmartCard Reader&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-55" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-55" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-55"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_PATH_WITH_USB_REVISION=pci-0000:00:14.0-usbv2-0:3&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-56" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-56" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-56"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_PATH=pci-0000:00:14.0-usb-0:3&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-57" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-57" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-57"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_PATH_TAG=pci-0000_00_14_0-usb-0_3&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-58" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-58" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-58"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_SMARTCARD_READER=1&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-59" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-59" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-59"&gt;&lt;/a&gt;&lt;span class="go"&gt;ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_3&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-60" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-60" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-60"&gt;&lt;/a&gt;&lt;span class="go"&gt;SYSTEMD_WANTS=smartcard.target&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-61" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-61" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-61"&gt;&lt;/a&gt;&lt;span class="go"&gt;SYSTEMD_USER_WANTS=smartcard.target&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-62" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-62" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-62"&gt;&lt;/a&gt;&lt;span class="hll"&gt;&lt;span class="go"&gt;PCSCLITE_IGNORE=1&lt;/span&gt;
&lt;/span&gt;&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-63" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-63" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-63"&gt;&lt;/a&gt;&lt;span class="go"&gt;MAJOR=189&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-64" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-64" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-64"&gt;&lt;/a&gt;&lt;span class="go"&gt;MINOR=14&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-65" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-65" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-65"&gt;&lt;/a&gt;&lt;span class="go"&gt;TAGS=:uaccess:security-device:seat:systemd:&lt;/span&gt;
&lt;a id="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-66" name="rest_code_316aab1c0f0b4479a76877e5f9dfcfce-66" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_316aab1c0f0b4479a76877e5f9dfcfce-66"&gt;&lt;/a&gt;&lt;span class="go"&gt;CURRENT_TAGS=:uaccess:security-device:seat:systemd:&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In pcscd logs I get:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code text"&gt;&lt;a id="rest_code_b25d7d23de5147a0852e2834b3045b6f-1" name="rest_code_b25d7d23de5147a0852e2834b3045b6f-1" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_b25d7d23de5147a0852e2834b3045b6f-1"&gt;&lt;/a&gt;04337722 [140613033731776] ../src/hotplug_libudev.c:656:HPEstablishUSBNotifications() USB Device add
&lt;a id="rest_code_b25d7d23de5147a0852e2834b3045b6f-2" name="rest_code_b25d7d23de5147a0852e2834b3045b6f-2" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_b25d7d23de5147a0852e2834b3045b6f-2"&gt;&lt;/a&gt;00000411 [140613033731776] ../src/hotplug_libudev.c:299:get_driver() Looking for a driver for VID: 0x08E6, PID: 0x3437, path: /dev/bus/usb/001/016
&lt;a id="rest_code_b25d7d23de5147a0852e2834b3045b6f-3" name="rest_code_b25d7d23de5147a0852e2834b3045b6f-3" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_b25d7d23de5147a0852e2834b3045b6f-3"&gt;&lt;/a&gt;&lt;span class="hll"&gt;00000303 [140613033731776] ../src/hotplug_libudev.c:417:HPAddDevice() Device Gemalto PC Twin Reader at /dev/bus/usb/001/016 (1-3:1.0) has PCSCLITE_IGNORE set: ignored
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And I do not see the PC/SC reader with &lt;code class="docutils literal"&gt;pcsc_scan&lt;/code&gt; command:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_12e08539a35c49f6aa0355c7b6ca416f-1" name="rest_code_12e08539a35c49f6aa0355c7b6ca416f-1" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_12e08539a35c49f6aa0355c7b6ca416f-1"&gt;&lt;/a&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;pcsc_scan&lt;span class="w"&gt; &lt;/span&gt;-r
&lt;a id="rest_code_12e08539a35c49f6aa0355c7b6ca416f-2" name="rest_code_12e08539a35c49f6aa0355c7b6ca416f-2" href="https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/#rest_code_12e08539a35c49f6aa0355c7b6ca416f-2"&gt;&lt;/a&gt;&lt;span class="go"&gt;No reader found.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id="conclusion"&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I am sure you will find other use cases for this new feature.&lt;/p&gt;
&lt;p&gt;Thanks to Valtteri Vuorikoski for the patch. If you have ideas of
changes or improvements for pcsc-lite do not hesitate to submit them.&lt;/p&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2025/04/ignore-readers-using-pcsclite_ignore-udev-property/</guid><pubDate>Wed, 02 Apr 2025 12:00:29 GMT</pubDate></item><item><title>New version of pcsc-lite: 2.3.2</title><link>https://blog.apdu.fr/posts/2025/03/new-version-of-pcsc-lite-232/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;I just released a new version of &lt;a class="reference external" href="https://pcsclite.apdu.fr/files/"&gt;pcsc-lite 2.3.2&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://pcsclite.apdu.fr/"&gt;pcsc-lite&lt;/a&gt; is a Free Software
implementation of the PC/SC (or WinSCard) API for Unix systems.&lt;/p&gt;
&lt;section id="changes"&gt;
&lt;h2&gt;Changes:&lt;/h2&gt;
&lt;dl class="simple"&gt;
&lt;dt&gt;2.3.2: Ludovic Rousseau&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;26 March 2025&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Hardening systemd &lt;code class="docutils literal"&gt;pcscd.service&lt;/code&gt; file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;pcscd.service: add missing &lt;code class="docutils literal"&gt;Requires=polkit.service&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;pcsc-spy: add missing &lt;code class="docutils literal"&gt;PCSCv2_PART10_PROPERTY_*&lt;/code&gt; definitions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support udev &lt;code class="docutils literal"&gt;PCSCLITE_IGNORE&lt;/code&gt; property to filter readers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;debuglog: force use of colors when &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;--color&lt;/span&gt;&lt;/code&gt; is used&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Some other minor improvements&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2025/03/new-version-of-pcsc-lite-232/</guid><pubDate>Wed, 26 Mar 2025 15:26:20 GMT</pubDate></item><item><title>Static library libpcsclite.a</title><link>https://blog.apdu.fr/posts/2024/12/static-library-libpcsclitea/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;With pcsc-lite 2.3.1 (&lt;a class="reference external" href="https://blog.apdu.fr/posts/2024/12/new-version-of-pcsc-lite-231/"&gt;New version of pcsc-lite: 2.3.1&lt;/a&gt;) a static
library &lt;code class="docutils literal"&gt;libpcsclite.a&lt;/code&gt; is also generated by default.&lt;/p&gt;
&lt;p&gt;Using the static library &lt;code class="docutils literal"&gt;libpcsclite.a&lt;/code&gt; instead of the dynamic one
&lt;code class="docutils literal"&gt;libpcsclite.so.1&lt;/code&gt; has pros and cons.&lt;/p&gt;
&lt;section id="pros"&gt;
&lt;h2&gt;Pros&lt;/h2&gt;
&lt;p&gt;The application binary does not depend on an external library. It is
then easier to use on a minimal system that works on "any" x86_64
GNU/Linux distribution.&lt;/p&gt;
&lt;p&gt;This request comes from a user of &lt;a class="reference external" href="https://www.alpinelinux.org/"&gt;Alpine Linux&lt;/a&gt;. See &lt;a class="reference external" href="https://github.com/LudovicRousseau/PCSC/issues/216"&gt;github issue #216&lt;/a&gt;.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="cons"&gt;
&lt;h2&gt;Cons&lt;/h2&gt;
&lt;p&gt;The mechanism to log pcsc-lite calls can't be used
(&lt;a class="reference external" href="https://blog.apdu.fr/posts/2024/04/pcsc-api-spy-using-libpcsclite_delegate/"&gt;PCSC API spy using LIBPCSCLITE_DELEGATE&lt;/a&gt;). It will also not be
possible to use the mechanism to redirect calls for RDP
(&lt;a class="reference external" href="https://blog.apdu.fr/posts/2024/04/how-to-use-libpcsclite_delegate/"&gt;How to use LIBPCSCLITE_DELEGATE?&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;If the library &lt;code class="docutils literal"&gt;libpcsclite.a&lt;/code&gt; uses a protocol version that is
different from the protocol version used by the installed &lt;code class="docutils literal"&gt;pcscd&lt;/code&gt;
server then client/server communication will fail. It will not "run
everywhere". (See &lt;a class="reference external" href="https://blog.apdu.fr/posts/2022/02/accessing-smart-cards-from-inside/"&gt;Accessing smart cards from inside a flatpak sandbox&lt;/a&gt;).&lt;/p&gt;
&lt;/section&gt;
&lt;section id="conclusion"&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The Debian package does NOT provide the static version of the library
because of the cons listed above.&lt;/p&gt;
&lt;p&gt;But it may make sens for Alpine Linux or another specialized
distribution to provide a static version of the library.&lt;/p&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2024/12/static-library-libpcsclitea/</guid><pubDate>Tue, 24 Dec 2024 15:20:37 GMT</pubDate></item><item><title>New version of pcsc-lite: 2.3.1</title><link>https://blog.apdu.fr/posts/2024/12/new-version-of-pcsc-lite-231/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;I just released a new version of &lt;a class="reference external" href="https://pcsclite.apdu.fr/files/"&gt;pcsc-lite 2.3.1&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://pcsclite.apdu.fr/"&gt;pcsc-lite&lt;/a&gt; is a Free Software
implementation of the PC/SC (or WinSCard) API for Unix systems.&lt;/p&gt;
&lt;section id="changes"&gt;
&lt;h2&gt;Changes:&lt;/h2&gt;
&lt;dl class="simple"&gt;
&lt;dt&gt;2.3.1: Ludovic Rousseau&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;24 December 2024&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Install a default &lt;code class="docutils literal"&gt;/etc/default/pcscd&lt;/code&gt; file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;auth.c: implement polkit support for FreeBSD&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;meson:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;also build static version of libpcsclite&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add options to disable polkit and libsystemd&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add "filter_names" in features when needed&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Doxygen: document &lt;code class="docutils literal"&gt;dwCurrentState&lt;/code&gt; use for &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;"\\?PnP?\Notification"&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Some other minor improvements&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</description><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2024/12/new-version-of-pcsc-lite-231/</guid><pubDate>Tue, 24 Dec 2024 15:12:24 GMT</pubDate></item><item><title>Improved SCardGetStatusChange() for "\\?PnP?\Notification" special reader</title><link>https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/</link><dc:creator>Ludovic Rousseau</dc:creator><description>&lt;p&gt;&lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; works fine to detect a change in one of the
listed readers.
It is also possible to detect when a reader has been added or removed
using the special reader name &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;"\\?PnP?\Notification"&lt;/span&gt;&lt;/code&gt;. See
&lt;a class="reference external" href="https://blog.apdu.fr/posts/2018/02/how-to-use-scardgetstatuschange/"&gt;How to use SCardGetStatusChange()?&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;One old problem is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;how to detect that a reader has been added &lt;strong&gt;between&lt;/strong&gt; two calls to
&lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt;?&lt;/p&gt;
&lt;p&gt;Even if you call &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; just after the previous
&lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; returned you may still suffer from a &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Race_condition"&gt;race
condition&lt;/a&gt; and miss a reader event.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In pcsc-lite &lt;a class="reference external" href="https://blog.apdu.fr/posts/2024/08/new-version-of-pcsc-lite-230/"&gt;version 2.3.0&lt;/a&gt; I
implemented a solution for that use case.&lt;/p&gt;
&lt;p&gt;&lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; will now use the high word (high 16-bits) of the
&lt;code class="docutils literal"&gt;.dwEventState&lt;/code&gt; field for the special reader &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;"\\?PnP?\Notification"&lt;/span&gt;&lt;/code&gt; to
store the number of reader events (since the start of the pcscd daemon).&lt;/p&gt;
&lt;section id="pseudo-code-algorithm"&gt;
&lt;h2&gt;Pseudo code algorithm&lt;/h2&gt;
&lt;p&gt;The suggested way to fix the problem is to use something like that:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;&lt;p&gt;initial call to &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;get the initial value from &lt;code class="docutils literal"&gt;.dwEventState&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;copy this value in &lt;code class="docutils literal"&gt;.dwCurrentState&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;second call to &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If a reader has been added before the second &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt;
call then &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; will return immediately.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="sample-code"&gt;
&lt;h2&gt;Sample code&lt;/h2&gt;
&lt;p&gt;File &lt;code class="docutils literal"&gt;sample.c&lt;/code&gt;:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code c"&gt;&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-1" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-1" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-1"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-2" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-2" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-2"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-3" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-3" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-3"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;string.h&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-4" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-4" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-4"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;stdbool.h&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-5" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-5" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-5"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-6" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-6" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-6"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;winscard.h&amp;gt;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-7" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-7" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-7"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-8" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-8" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-8"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#define CHECK(f, rv, panic) \&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-9" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-9" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-9"&gt;&lt;/a&gt;&lt;span class="cp"&gt; printf(f "(): 0x%08lX, %s\n", rv, pcsc_stringify_error(rv)); \&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-10" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-10" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-10"&gt;&lt;/a&gt;&lt;span class="cp"&gt; if ((SCARD_S_SUCCESS != rv) &amp;amp;&amp;amp; panic) \&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-11" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-11" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-11"&gt;&lt;/a&gt;&lt;span class="cp"&gt; { \&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-12" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-12" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-12"&gt;&lt;/a&gt;&lt;span class="cp"&gt;  return -1; \&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-13" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-13" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-13"&gt;&lt;/a&gt;&lt;span class="cp"&gt; }&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-14" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-14" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-14"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-15" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-15" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-15"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#define PANIC true&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-16" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-16" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-16"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#define DONT_PANIC false&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-17" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-17" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-17"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-18" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-18" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-18"&gt;&lt;/a&gt;&lt;span class="cp"&gt;#define MAX_READERS 16&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-19" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-19" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-19"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-20" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-20" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-20"&gt;&lt;/a&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-21" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-21" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-21"&gt;&lt;/a&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-22" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-22" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-22"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;LONG&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-23" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-23" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-23"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;SCARDCONTEXT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hContext&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-24" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-24" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-24"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;LPTSTR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mszReaders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-25" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-25" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-25"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;DWORD&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;dwReaders&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-26" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-26" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-26"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MAX_READERS&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{};&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-27" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-27" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-27"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-28" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-28" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-28"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;SCARD_READERSTATE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MAX_READERS&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-29" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-29" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-29"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-30" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-30" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-30"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SCardEstablishContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SCARD_SCOPE_SYSTEM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;hContext&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-31" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-31" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-31"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;CHECK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SCardEstablishContext"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PANIC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-32" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-32" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-32"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-33" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-33" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-33"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SCardListReaders&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;dwReaders&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-34" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-34" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-34"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;CHECK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SCardListReaders"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;DONT_PANIC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-35" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-35" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-35"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-36" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-36" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-36"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;mszReaders&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;calloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dwReaders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-37" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-37" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-37"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SCardListReaders&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mszReaders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;dwReaders&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-38" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-38" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-38"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;CHECK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SCardListReaders"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;DONT_PANIC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-39" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-39" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-39"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Found readers:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-40" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-40" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-40"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-41" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-41" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-41"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;mszReaders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-42" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-42" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-42"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-43" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-43" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-43"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;" %s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-44" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-44" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-44"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-45" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-45" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-45"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-46" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-46" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-46"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Found %d readers&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-47" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-47" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-47"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-48" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-48" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-48"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="cm"&gt;/* add the special reader */&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-49" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-49" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-49"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\\\\&lt;/span&gt;&lt;span class="s"&gt;?PnP?&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;Notification"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-50" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-50" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-50"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-51" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-51" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-51"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="cm"&gt;/* get the initial states */&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-52" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-52" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-52"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-53" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-53" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-53"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-54" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-54" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-54"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;szReader&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-55" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-55" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-55"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;dwCurrentState&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SCARD_STATE_UNAWARE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-56" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-56" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-56"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-57" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-57" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-57"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SCardGetStatusChange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-58" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-58" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-58"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;CHECK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SCardGetStatusChange"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;DONT_PANIC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-59" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-59" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-59"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-60" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-60" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-60"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="cm"&gt;/* set the current state */&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-61" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-61" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-61"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-62" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-62" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-62"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-63" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-63" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-63"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;dwCurrentState&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;dwEventState&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-64" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-64" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-64"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"reader: %s, events #: %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-65" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-65" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-65"&gt;&lt;/a&gt;&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;dwEventState&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-66" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-66" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-66"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"reader: %s, events state 0x%04X&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-67" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-67" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-67"&gt;&lt;/a&gt;&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;dwEventState&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0xFFFF&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-68" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-68" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-68"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-69" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-69" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-69"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-70" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-70" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-70"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="cm"&gt;/* wait for a change */&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-71" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-71" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-71"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SCardGetStatusChange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;INFINITE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-72" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-72" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-72"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;CHECK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SCardGetStatusChange"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PANIC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-73" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-73" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-73"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-74" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-74" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-74"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="cm"&gt;/* new state */&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-75" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-75" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-75"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;nb_readers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-76" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-76" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-76"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-77" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-77" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-77"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"reader: %s, events #: %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-78" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-78" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-78"&gt;&lt;/a&gt;&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;dwEventState&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-79" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-79" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-79"&gt;&lt;/a&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"reader: %s, events state 0x%04X&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-80" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-80" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-80"&gt;&lt;/a&gt;&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;readers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rgReaderStates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;dwEventState&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0xFFFF&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-81" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-81" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-81"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-82" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-82" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-82"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-83" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-83" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-83"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mszReaders&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-84" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-84" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-84"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-85" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-85" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-85"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SCardReleaseContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hContext&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-86" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-86" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-86"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;CHECK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SCardReleaseContext"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;rv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PANIC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-87" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-87" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-87"&gt;&lt;/a&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-88" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-88" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-88"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-89" name="rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-89" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ad1c3ca3ce76425fa73fd0bc5561632f-89"&gt;&lt;/a&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;File &lt;code class="docutils literal"&gt;Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code makefile"&gt;&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-1" name="rest_code_07bac30c16114089be35184f1e20d8d8-1" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-1"&gt;&lt;/a&gt;&lt;span class="c"&gt;# Linux&lt;/span&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-2" name="rest_code_07bac30c16114089be35184f1e20d8d8-2" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-2"&gt;&lt;/a&gt;&lt;span class="nv"&gt;PCSC_CFLAGS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;shell&lt;span class="w"&gt; &lt;/span&gt;pkg-config&lt;span class="w"&gt; &lt;/span&gt;--cflags&lt;span class="w"&gt; &lt;/span&gt;libpcsclite&lt;span class="k"&gt;)&lt;/span&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-3" name="rest_code_07bac30c16114089be35184f1e20d8d8-3" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-3"&gt;&lt;/a&gt;&lt;span class="nv"&gt;LDLIBS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;shell&lt;span class="w"&gt; &lt;/span&gt;pkg-config&lt;span class="w"&gt; &lt;/span&gt;--libs&lt;span class="w"&gt; &lt;/span&gt;libpcsclite&lt;span class="k"&gt;)&lt;/span&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-4" name="rest_code_07bac30c16114089be35184f1e20d8d8-4" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-4"&gt;&lt;/a&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-5" name="rest_code_07bac30c16114089be35184f1e20d8d8-5" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-5"&gt;&lt;/a&gt;&lt;span class="nv"&gt;CFLAGS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;PCSC_CFLAGS&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-g
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-6" name="rest_code_07bac30c16114089be35184f1e20d8d8-6" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-6"&gt;&lt;/a&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-7" name="rest_code_07bac30c16114089be35184f1e20d8d8-7" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-7"&gt;&lt;/a&gt;&lt;span class="nf"&gt;sample&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sample&lt;/span&gt;.&lt;span class="n"&gt;c&lt;/span&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-8" name="rest_code_07bac30c16114089be35184f1e20d8d8-8" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-8"&gt;&lt;/a&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-9" name="rest_code_07bac30c16114089be35184f1e20d8d8-9" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-9"&gt;&lt;/a&gt;&lt;span class="nf"&gt;clean&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;a id="rest_code_07bac30c16114089be35184f1e20d8d8-10" name="rest_code_07bac30c16114089be35184f1e20d8d8-10" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_07bac30c16114089be35184f1e20d8d8-10"&gt;&lt;/a&gt;&lt;span class="w"&gt;    &lt;/span&gt;rm&lt;span class="w"&gt; &lt;/span&gt;-f&lt;span class="w"&gt; &lt;/span&gt;sample
&lt;/pre&gt;&lt;/div&gt;
&lt;section id="connect-a-reader"&gt;
&lt;h3&gt;Connect a reader&lt;/h3&gt;
&lt;p&gt;We start the sample code with no reader connected:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-1" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-1" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-1"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardEstablishContext(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-2" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-2" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-2"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardListReaders(): 0x8010002E, Cannot find a smart card reader.&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-3" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-3" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-3"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardListReaders(): 0x8010002E, Cannot find a smart card reader.&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-4" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-4" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-4"&gt;&lt;/a&gt;&lt;span class="go"&gt; Found readers:&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-5" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-5" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-5"&gt;&lt;/a&gt;&lt;span class="go"&gt; Found 0 readers&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-6" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-6" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-6"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardGetStatusChange(): 0x8010000A, Command timeout.&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-7" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-7" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-7"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events #: 33&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-8" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-8" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-8"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events state 0x0000&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-9" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-9" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-9"&gt;&lt;/a&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-10" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-10" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-10"&gt;&lt;/a&gt;&lt;span class="hll"&gt;&lt;span class="go"&gt; &amp;gt;&amp;gt;&amp;gt; connection of a new reader here&lt;/span&gt;
&lt;/span&gt;&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-11" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-11" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-11"&gt;&lt;/a&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-12" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-12" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-12"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardGetStatusChange(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-13" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-13" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-13"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events #: 34&lt;/span&gt;
&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-14" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-14" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-14"&gt;&lt;/a&gt;&lt;span class="hll"&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events state 0x0002&lt;/span&gt;
&lt;/span&gt;&lt;a id="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-15" name="rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-15" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_2c32ef2456ca4b4d9aa567962b4c28e1-15"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardReleaseContext(): 0x00000000, Command successful.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;State value 0x0002 is &lt;code class="docutils literal"&gt;SCARD_STATE_CHANGED&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The first &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; returns a reader events of 33.
After I connect a reader the number goes to 34.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="disconnect-a-reader"&gt;
&lt;h3&gt;Disconnect a reader&lt;/h3&gt;
&lt;p&gt;We restart the sample code with the reader connected:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-1" name="rest_code_ff77d2363d934a478f2409bfe0e44509-1" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-1"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardEstablishContext(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-2" name="rest_code_ff77d2363d934a478f2409bfe0e44509-2" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-2"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardListReaders(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-3" name="rest_code_ff77d2363d934a478f2409bfe0e44509-3" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-3"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardListReaders(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-4" name="rest_code_ff77d2363d934a478f2409bfe0e44509-4" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-4"&gt;&lt;/a&gt;&lt;span class="go"&gt; Found readers:&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-5" name="rest_code_ff77d2363d934a478f2409bfe0e44509-5" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-5"&gt;&lt;/a&gt;&lt;span class="go"&gt;  Gemalto PC Twin Reader 00 00&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-6" name="rest_code_ff77d2363d934a478f2409bfe0e44509-6" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-6"&gt;&lt;/a&gt;&lt;span class="go"&gt; Found 1 readers&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-7" name="rest_code_ff77d2363d934a478f2409bfe0e44509-7" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-7"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardGetStatusChange(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-8" name="rest_code_ff77d2363d934a478f2409bfe0e44509-8" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-8"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events #: 0&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-9" name="rest_code_ff77d2363d934a478f2409bfe0e44509-9" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-9"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events state 0x0012&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-10" name="rest_code_ff77d2363d934a478f2409bfe0e44509-10" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-10"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events #: 34&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-11" name="rest_code_ff77d2363d934a478f2409bfe0e44509-11" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-11"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events state 0x0000&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-12" name="rest_code_ff77d2363d934a478f2409bfe0e44509-12" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-12"&gt;&lt;/a&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-13" name="rest_code_ff77d2363d934a478f2409bfe0e44509-13" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-13"&gt;&lt;/a&gt;&lt;span class="hll"&gt;&lt;span class="go"&gt; &amp;gt;&amp;gt;&amp;gt; removal of the reader here&lt;/span&gt;
&lt;/span&gt;&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-14" name="rest_code_ff77d2363d934a478f2409bfe0e44509-14" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-14"&gt;&lt;/a&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-15" name="rest_code_ff77d2363d934a478f2409bfe0e44509-15" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-15"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardGetStatusChange(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-16" name="rest_code_ff77d2363d934a478f2409bfe0e44509-16" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-16"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events #: 0&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-17" name="rest_code_ff77d2363d934a478f2409bfe0e44509-17" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-17"&gt;&lt;/a&gt;&lt;span class="hll"&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events state 0x000E&lt;/span&gt;
&lt;/span&gt;&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-18" name="rest_code_ff77d2363d934a478f2409bfe0e44509-18" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-18"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events #: 35&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-19" name="rest_code_ff77d2363d934a478f2409bfe0e44509-19" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-19"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events state 0x0002&lt;/span&gt;
&lt;a id="rest_code_ff77d2363d934a478f2409bfe0e44509-20" name="rest_code_ff77d2363d934a478f2409bfe0e44509-20" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_ff77d2363d934a478f2409bfe0e44509-20"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardReleaseContext(): 0x00000000, Command successful.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The reader "Gemalto PC Twin Reader 00 00" has been removed.
Its state value 0x000E contains the bits:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;code class="docutils literal"&gt;SCARD_STATE_UNKNOWN&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code class="docutils literal"&gt;SCARD_STATE_UNAVAILABLE&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code class="docutils literal"&gt;SCARD_STATE_CHANGED&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id="connect-a-second-reader"&gt;
&lt;h3&gt;Connect a second reader&lt;/h3&gt;
&lt;p&gt;We restart the sample code with the reader connected:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-1" name="rest_code_c03ea406a24c403eae190c1363e57559-1" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-1"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardEstablishContext(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-2" name="rest_code_c03ea406a24c403eae190c1363e57559-2" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-2"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardListReaders(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-3" name="rest_code_c03ea406a24c403eae190c1363e57559-3" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-3"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardListReaders(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-4" name="rest_code_c03ea406a24c403eae190c1363e57559-4" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-4"&gt;&lt;/a&gt;&lt;span class="go"&gt; Found readers:&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-5" name="rest_code_c03ea406a24c403eae190c1363e57559-5" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-5"&gt;&lt;/a&gt;&lt;span class="go"&gt;  Gemalto PC Twin Reader 00 00&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-6" name="rest_code_c03ea406a24c403eae190c1363e57559-6" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-6"&gt;&lt;/a&gt;&lt;span class="go"&gt; Found 1 readers&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-7" name="rest_code_c03ea406a24c403eae190c1363e57559-7" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-7"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardGetStatusChange(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-8" name="rest_code_c03ea406a24c403eae190c1363e57559-8" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-8"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events #: 0&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-9" name="rest_code_c03ea406a24c403eae190c1363e57559-9" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-9"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events state 0x0012&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-10" name="rest_code_c03ea406a24c403eae190c1363e57559-10" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-10"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events #: 36&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-11" name="rest_code_c03ea406a24c403eae190c1363e57559-11" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-11"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events state 0x0000&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-12" name="rest_code_c03ea406a24c403eae190c1363e57559-12" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-12"&gt;&lt;/a&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-13" name="rest_code_c03ea406a24c403eae190c1363e57559-13" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-13"&gt;&lt;/a&gt;&lt;span class="hll"&gt;&lt;span class="go"&gt; &amp;gt;&amp;gt;&amp;gt; connection of a second reader&lt;/span&gt;
&lt;/span&gt;&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-14" name="rest_code_c03ea406a24c403eae190c1363e57559-14" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-14"&gt;&lt;/a&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-15" name="rest_code_c03ea406a24c403eae190c1363e57559-15" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-15"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardGetStatusChange(): 0x00000000, Command successful.&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-16" name="rest_code_c03ea406a24c403eae190c1363e57559-16" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-16"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events #: 0&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-17" name="rest_code_c03ea406a24c403eae190c1363e57559-17" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-17"&gt;&lt;/a&gt;&lt;span class="hll"&gt;&lt;span class="go"&gt; reader: Gemalto PC Twin Reader 00 00, events state 0x0010&lt;/span&gt;
&lt;/span&gt;&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-18" name="rest_code_c03ea406a24c403eae190c1363e57559-18" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-18"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events #: 37&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-19" name="rest_code_c03ea406a24c403eae190c1363e57559-19" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-19"&gt;&lt;/a&gt;&lt;span class="go"&gt; reader: \\?PnP?\Notification, events state 0x0002&lt;/span&gt;
&lt;a id="rest_code_c03ea406a24c403eae190c1363e57559-20" name="rest_code_c03ea406a24c403eae190c1363e57559-20" href="https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/#rest_code_c03ea406a24c403eae190c1363e57559-20"&gt;&lt;/a&gt;&lt;span class="go"&gt; SCardReleaseContext(): 0x00000000, Command successful.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The Gemalto reader event state is 0x0010 = &lt;code class="docutils literal"&gt;SCARD_STATE_EMPTY&lt;/code&gt; because
it does not contains a smart card. It does not have the bit
&lt;code class="docutils literal"&gt;SCARD_STATE_CHANGED&lt;/code&gt; set because it's state has not changed.&lt;/p&gt;
&lt;p&gt;The PnP reader state is 0x0002 = &lt;code class="docutils literal"&gt;SCARD_STATE_CHANGED&lt;/code&gt; because a new
reader was connected.&lt;/p&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id="remarks"&gt;
&lt;h2&gt;Remarks&lt;/h2&gt;
&lt;section id="timeout"&gt;
&lt;h3&gt;Timeout&lt;/h3&gt;
&lt;p&gt;It is important to use a timeout of 0 (parameter &lt;a class="reference external" href="https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24"&gt;dwTimeout&lt;/a&gt;)
in the first call to &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; to make the function
returns immediately.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="unitary-test"&gt;
&lt;h3&gt;Unitary Test&lt;/h3&gt;
&lt;p&gt;If you want to know if your implementation of PC/SC includes the fix or
not (or test on Windows or macOS) you can use the program
&lt;a class="reference external" href="https://salsa.debian.org/rousseau/PCSC/-/blob/master/UnitaryTests/SCardGetStatusChange/SCardGetStatusChange_PnP_Events.py?ref_type=heads"&gt;CardGetStatusChange_PnP_Events.py&lt;/a&gt;
included in pcsc-lite &lt;a class="reference external" href="https://salsa.debian.org/rousseau/PCSC/-/tree/master/UnitaryTests/SCardGetStatusChange?ref_type=heads"&gt;UnitaryTests/SCardGetStatusChange/&lt;/a&gt;
directory.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="windows"&gt;
&lt;h3&gt;Windows&lt;/h3&gt;
&lt;p&gt;Microsoft implemented a similar mechanism. But instead of using the
number of reader events it uses the number of connected readers.&lt;/p&gt;
&lt;p&gt;So between the 2 calls to &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; if one reader is
added and one reader is removed you may not be notified.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="macos"&gt;
&lt;h3&gt;macOS&lt;/h3&gt;
&lt;p&gt;Apple does not support the special reader &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;"\\?PnP?\Notification"&lt;/span&gt;&lt;/code&gt;.
See &lt;a class="reference external" href="https://blog.apdu.fr/posts/2015/12/os-x-el-capitan-missing-feature/"&gt;OS X El Capitan missing feature: SCardGetStatusChange() and "\\?PnP?\Notification"&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So there is no way it supports the mechanism presented here.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="backward-compatibility"&gt;
&lt;h3&gt;Backward compatibility&lt;/h3&gt;
&lt;p&gt;To not break existing codes the new &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; beahavior
is enabled only if the number of reader events in &lt;code class="docutils literal"&gt;.dwCurrentState&lt;/code&gt; is
&lt;em&gt;not&lt;/em&gt; zero.&lt;/p&gt;
&lt;p&gt;That is also one reason why you should use a &lt;code class="docutils literal"&gt;dwTimeout&lt;/code&gt; value of 0
for the first call.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="dweventstate-for-normal-readers"&gt;
&lt;h3&gt;&lt;code class="docutils literal"&gt;.dwEventState&lt;/code&gt; for normal readers&lt;/h3&gt;
&lt;p&gt;The high 16-bits of &lt;code class="docutils literal"&gt;.dwEventState&lt;/code&gt; for the normal readers is also
used. It contains the number of &lt;cite&gt;card events&lt;/cite&gt; for this particular
reader.&lt;/p&gt;
&lt;p&gt;This is an old behavior that is documented in the &lt;a class="reference external" href="https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24"&gt;API documentation&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code class="docutils literal"&gt;dwEventState&lt;/code&gt; also contains a number of events in the upper 16
bits (&lt;code class="docutils literal"&gt;dwEventState &amp;amp; 0xFFFF0000&lt;/code&gt;). This number of events is
incremented for each card insertion or removal in the specified reader.
This can be used to detect a card removal/insertion between two calls to
&lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id="conclusion"&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I was aware of this race issue with &lt;code class="docutils literal"&gt;SCardGetStatusChange()&lt;/code&gt; since a
long time (at least 2018. Thanks Maksim). But I got a new motivation
boost after an issue was reported &lt;a class="reference external" href="https://github.com/LudovicRousseau/PCSC/issues/190"&gt;SCardGetStatusChange: Race
condition when attaching multiple readers at the same time&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It is now the job of applications programmers to use this new feature in
their codes.&lt;/p&gt;
&lt;p&gt;If you find a regression in your application because of this change
please open an issue.&lt;/p&gt;
&lt;/section&gt;</description><category>C</category><category>pcsc-lite</category><guid>https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/</guid><pubDate>Sun, 04 Aug 2024 11:07:07 GMT</pubDate></item></channel></rss>