Skip to content

fix(hotplug_libudev.c): validate existing reader works before discarding duplicates in HPAddDevice - #261

Closed
Pandapip1 wants to merge 1 commit into
LudovicRousseau:masterfrom
Pandapip1:handle-card-broken-from-suspend
Closed

fix(hotplug_libudev.c): validate existing reader works before discarding duplicates in HPAddDevice#261
Pandapip1 wants to merge 1 commit into
LudovicRousseau:masterfrom
Pandapip1:handle-card-broken-from-suspend

Conversation

@Pandapip1

@Pandapip1 Pandapip1 commented Jun 4, 2026

Copy link
Copy Markdown

When suspending to RAM, existing libusb handles break. With LudovicRousseau/CCID#191, when they get retried, they now correctly report IFD_NO_SUCH_DEVICE. This will cause ifdwrapper.c to correctly trigger a hotplug. Now, we just need to make sure that the presence of the previous broken handle doesn't cause our new handle to get discarded.

This is patch two of a two-patch series targeting both the CCID and PCSC repos. See: LudovicRousseau/CCID#191

…ing duplicates in HPAddDevice

When suspending to RAM, existing libusb handles break. With LudovicRousseau/CCID#191, when they get retried, they now correctly report IFD_NO_SUCH_DEVICE. This will cause ifdwrapper.c to correctly trigger a hotplug. Now, we just need to make sure that the presence of the previous broken handle doesn't cause our new handle to get discarded.

This is patch two of a two-patch series targeting both the CCID and PCSC repos. See: LudovicRousseau/CCID#191
@Pandapip1 Pandapip1 changed the title fix(hotplug_libudev.c): validate existing reader works before discard… fix(hotplug_libudev.c): validate existing reader works before discarding duplicates in HPAddDevice Jun 4, 2026
@Pandapip1
Pandapip1 marked this pull request as draft June 4, 2026 21:08
@Pandapip1

Copy link
Copy Markdown
Author

This one is more substantial and more likely to be wrong than the other patch, so I'll keep this in draft until I've fully tested it, unless you're really confident this is correct.

@Pandapip1

Pandapip1 commented Jun 4, 2026

Copy link
Copy Markdown
Author

Never mind, I'm apparently not testing it, since that causes my system to want to rebuild everything from source again. I'm 70-80% confident this works as intended.

@Pandapip1
Pandapip1 marked this pull request as ready for review June 4, 2026 21:18
@Pandapip1
Pandapip1 marked this pull request as draft June 4, 2026 21:22
@Pandapip1
Pandapip1 marked this pull request as ready for review June 4, 2026 21:36
@LudovicRousseau

Copy link
Copy Markdown
Owner

Can you provide a pcscd trace as documented at https://ccid.apdu.fr/#support please?

@Pandapip1

Copy link
Copy Markdown
Author

Sure. It's intermittent, so I can't get it to you right away, but as soon as it happens I'll get the log file to you.

@Pandapip1

Pandapip1 commented Jun 5, 2026

Copy link
Copy Markdown
Author

Or, it could happen almost immediately without a suspend?!

❯ sudo LIBCCID_ifdLogLevel=0x000F pcscd --foreground --debug --apdu --color | tee -i log.txt
00000000 ../src/debuglog.c:396:DebugLogSetLevel() debug level=debug
00000012 ../src/debuglog.c:417:DebugLogSetCategory() Debug options: APDU
00000002 [129475947855552] ../src/pcscdaemon.c:359:main() Force colored logs
00000079 [129475947855552] ../src/configfile.l:365:DBGetReaderList() Parsing conf file: /etc/reader.conf.d
00000005 [129475947855552] ../src/pcscdaemon.c:669:main() pcsc-lite 2.4.1 daemon ready.
00000039 [129475947855552] ../src/pcscdaemon.c:752:main() Using drivers directory: /var/lib/pcsc/drivers
00000007 [129475947855552] ../src/hotplug_libudev.c:122:HPReadBundleValues() Cannot open PC/SC drivers directory: /var/lib/pcsc/drivers
00000002 [129475947855552] ../src/hotplug_libudev.c:123:HPReadBundleValues() Disabling USB support for pcscd.
00000002 [129475947855552] ../src/hotplug_libudev.c:735:HPRegisterForHotplugEvents() No bundle files in pcsc drivers directory: /var/lib/pcsc/drivers
00000001 [129475947855552] ../src/hotplug_libudev.c:737:HPRegisterForHotplugEvents() Disabling USB support for pcscd
99999999 [129475947855552] ../src/winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000011 [129475947855552] ../src/winscard_msg_srv.c:264:ProcessEventsServer() ProcessCommonChannelRequest detects: 6
00000002 [129475947855552] ../src/pcscdaemon.c:130:SVCServiceRunLoop() A new context thread creation is requested: 6
00014316 [129475928909504] ../src/winscard_svc.c:362:ContextThread() Authorized PC/SC client
00000007 [129475928909504] ../src/winscard_svc.c:365:ContextThread() Thread is started: dwClientID=6, threadContext @0x58bb960dcec0
00000007 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_VERSION from client 6
00000005 [129475928909504] ../src/winscard_svc.c:395:ContextThread() Client is protocol version 4:5
00000002 [129475928909504] ../src/winscard_svc.c:422:ContextThread() CMD_VERSION for client 6, rv=SCARD_S_SUCCESS
00000061 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: ESTABLISH_CONTEXT from client 6
00000043 [129475928909504] ../src/winscard.c:210:SCardEstablishContext() Establishing Context: 0x4D28D02F
00000002 [129475928909504] ../src/winscard_svc.c:505:ContextThread() ESTABLISH_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000049 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_GET_READERS_STATE from client 6
00000037 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: RELEASE_CONTEXT from client 6
00000008 [129475928909504] ../src/winscard.c:224:SCardReleaseContext() Releasing Context: 0x4D28D02F
00000002 [129475928909504] ../src/winscard_svc.c:520:ContextThread() RELEASE_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000180 [129475928909504] ../src/winscard_svc.c:376:ContextThread() Client die: 6
00000012 [129475928909504] ../src/winscard_svc.c:1116:MSGCleanupClient() Thread is stopping: dwClientID=6, threadContext @0x58bb960dcec0
00000002 [129475928909504] ../src/winscard_svc.c:1124:MSGCleanupClient() Freeing SCONTEXT @0x58bb960dcec0
00009383 [129475947855552] ../src/winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000017 [129475947855552] ../src/winscard_msg_srv.c:264:ProcessEventsServer() ProcessCommonChannelRequest detects: 6
00000002 [129475947855552] ../src/pcscdaemon.c:130:SVCServiceRunLoop() A new context thread creation is requested: 6
00011486 [129475928909504] ../src/winscard_svc.c:362:ContextThread() Authorized PC/SC client
00000008 [129475928909504] ../src/winscard_svc.c:365:ContextThread() Thread is started: dwClientID=6, threadContext @0x58bb960dcec0
00000007 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_VERSION from client 6
00000004 [129475928909504] ../src/winscard_svc.c:395:ContextThread() Client is protocol version 4:5
00000001 [129475928909504] ../src/winscard_svc.c:422:ContextThread() CMD_VERSION for client 6, rv=SCARD_S_SUCCESS
00000067 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: ESTABLISH_CONTEXT from client 6
00000016 [129475928909504] ../src/winscard.c:210:SCardEstablishContext() Establishing Context: 0x44F1E59C
00000002 [129475928909504] ../src/winscard_svc.c:505:ContextThread() ESTABLISH_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000037 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_GET_READERS_STATE from client 6
00000046 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: RELEASE_CONTEXT from client 6
00000007 [129475928909504] ../src/winscard.c:224:SCardReleaseContext() Releasing Context: 0x44F1E59C
00000001 [129475928909504] ../src/winscard_svc.c:520:ContextThread() RELEASE_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000038 [129475928909504] ../src/winscard_svc.c:376:ContextThread() Client die: 6
00000008 [129475928909504] ../src/winscard_svc.c:1116:MSGCleanupClient() Thread is stopping: dwClientID=6, threadContext @0x58bb960dcec0
00000001 [129475928909504] ../src/winscard_svc.c:1124:MSGCleanupClient() Freeing SCONTEXT @0x58bb960dcec0
04530338 [129475947855552] ../src/winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000024 [129475947855552] ../src/winscard_msg_srv.c:264:ProcessEventsServer() ProcessCommonChannelRequest detects: 6
00000003 [129475947855552] ../src/pcscdaemon.c:130:SVCServiceRunLoop() A new context thread creation is requested: 6
00011680 [129475928909504] ../src/winscard_svc.c:362:ContextThread() Authorized PC/SC client
00000007 [129475928909504] ../src/winscard_svc.c:365:ContextThread() Thread is started: dwClientID=6, threadContext @0x58bb960dcec0
00000007 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_VERSION from client 6
00000004 [129475928909504] ../src/winscard_svc.c:395:ContextThread() Client is protocol version 4:5
00000001 [129475928909504] ../src/winscard_svc.c:422:ContextThread() CMD_VERSION for client 6, rv=SCARD_S_SUCCESS
00000058 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: ESTABLISH_CONTEXT from client 6
00000010 [129475928909504] ../src/winscard.c:210:SCardEstablishContext() Establishing Context: 0x78074612
00000002 [129475928909504] ../src/winscard_svc.c:505:ContextThread() ESTABLISH_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000040 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_GET_READERS_STATE from client 6
00000050 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: RELEASE_CONTEXT from client 6
00000005 [129475928909504] ../src/winscard.c:224:SCardReleaseContext() Releasing Context: 0x78074612
00000002 [129475928909504] ../src/winscard_svc.c:520:ContextThread() RELEASE_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000048 [129475928909504] ../src/winscard_svc.c:376:ContextThread() Client die: 6
00000009 [129475928909504] ../src/winscard_svc.c:1116:MSGCleanupClient() Thread is stopping: dwClientID=6, threadContext @0x58bb960dcec0
00000001 [129475928909504] ../src/winscard_svc.c:1124:MSGCleanupClient() Freeing SCONTEXT @0x58bb960dcec0
36032118 [129475947855552] ../src/winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000025 [129475947855552] ../src/winscard_msg_srv.c:264:ProcessEventsServer() ProcessCommonChannelRequest detects: 6
00000005 [129475947855552] ../src/pcscdaemon.c:130:SVCServiceRunLoop() A new context thread creation is requested: 6
00014163 [129475928909504] ../src/winscard_svc.c:362:ContextThread() Authorized PC/SC client
00000007 [129475928909504] ../src/winscard_svc.c:365:ContextThread() Thread is started: dwClientID=6, threadContext @0x58bb960dcec0
00000008 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_VERSION from client 6
00000004 [129475928909504] ../src/winscard_svc.c:395:ContextThread() Client is protocol version 4:5
00000002 [129475928909504] ../src/winscard_svc.c:422:ContextThread() CMD_VERSION for client 6, rv=SCARD_S_SUCCESS
00000072 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: ESTABLISH_CONTEXT from client 6
00000010 [129475928909504] ../src/winscard.c:210:SCardEstablishContext() Establishing Context: 0x6E137276
00000003 [129475928909504] ../src/winscard_svc.c:505:ContextThread() ESTABLISH_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000030 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_GET_READERS_STATE from client 6
00000047 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: RELEASE_CONTEXT from client 6
00000008 [129475928909504] ../src/winscard.c:224:SCardReleaseContext() Releasing Context: 0x6E137276
00000002 [129475928909504] ../src/winscard_svc.c:520:ContextThread() RELEASE_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000064 [129475928909504] ../src/winscard_svc.c:376:ContextThread() Client die: 6
00000016 [129475928909504] ../src/winscard_svc.c:1116:MSGCleanupClient() Thread is stopping: dwClientID=6, threadContext @0x58bb960dcec0
00000002 [129475928909504] ../src/winscard_svc.c:1124:MSGCleanupClient() Freeing SCONTEXT @0x58bb960dcec0
01342195 [129475947855552] ../src/winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000015 [129475947855552] ../src/winscard_msg_srv.c:264:ProcessEventsServer() ProcessCommonChannelRequest detects: 6
00000002 [129475947855552] ../src/pcscdaemon.c:130:SVCServiceRunLoop() A new context thread creation is requested: 6
00013157 [129475928909504] ../src/winscard_svc.c:362:ContextThread() Authorized PC/SC client
00000007 [129475928909504] ../src/winscard_svc.c:365:ContextThread() Thread is started: dwClientID=6, threadContext @0x58bb960dcec0
00000009 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_VERSION from client 6
00000003 [129475928909504] ../src/winscard_svc.c:395:ContextThread() Client is protocol version 4:5
00000002 [129475928909504] ../src/winscard_svc.c:422:ContextThread() CMD_VERSION for client 6, rv=SCARD_S_SUCCESS
00000072 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: ESTABLISH_CONTEXT from client 6
00000010 [129475928909504] ../src/winscard.c:210:SCardEstablishContext() Establishing Context: 0x5D07CFED
00000003 [129475928909504] ../src/winscard_svc.c:505:ContextThread() ESTABLISH_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000024 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_GET_READERS_STATE from client 6
00000050 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: RELEASE_CONTEXT from client 6
00000007 [129475928909504] ../src/winscard.c:224:SCardReleaseContext() Releasing Context: 0x5D07CFED
00000002 [129475928909504] ../src/winscard_svc.c:520:ContextThread() RELEASE_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000029 [129475928909504] ../src/winscard_svc.c:376:ContextThread() Client die: 6
00000010 [129475928909504] ../src/winscard_svc.c:1116:MSGCleanupClient() Thread is stopping: dwClientID=6, threadContext @0x58bb960dcec0
00000002 [129475928909504] ../src/winscard_svc.c:1124:MSGCleanupClient() Freeing SCONTEXT @0x58bb960dcec0
02518494 [129475947855552] ../src/winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000024 [129475947855552] ../src/winscard_msg_srv.c:264:ProcessEventsServer() ProcessCommonChannelRequest detects: 6
00000003 [129475947855552] ../src/pcscdaemon.c:130:SVCServiceRunLoop() A new context thread creation is requested: 6
00012396 [129475928909504] ../src/winscard_svc.c:362:ContextThread() Authorized PC/SC client
00000008 [129475928909504] ../src/winscard_svc.c:365:ContextThread() Thread is started: dwClientID=6, threadContext @0x58bb960dcec0
00000007 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_VERSION from client 6
00000004 [129475928909504] ../src/winscard_svc.c:395:ContextThread() Client is protocol version 4:5
00000001 [129475928909504] ../src/winscard_svc.c:422:ContextThread() CMD_VERSION for client 6, rv=SCARD_S_SUCCESS
00000069 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: ESTABLISH_CONTEXT from client 6
00000009 [129475928909504] ../src/winscard.c:210:SCardEstablishContext() Establishing Context: 0x7D7AFA5B
00000003 [129475928909504] ../src/winscard_svc.c:505:ContextThread() ESTABLISH_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000055 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: CMD_GET_READERS_STATE from client 6
00000055 [129475928909504] ../src/winscard_svc.c:383:ContextThread() Received command: RELEASE_CONTEXT from client 6
00000006 [129475928909504] ../src/winscard.c:224:SCardReleaseContext() Releasing Context: 0x7D7AFA5B
00000002 [129475928909504] ../src/winscard_svc.c:520:ContextThread() RELEASE_CONTEXT for client 6, rv=SCARD_S_SUCCESS
00000054 [129475928909504] ../src/winscard_svc.c:376:ContextThread() Client die: 6
00000009 [129475928909504] ../src/winscard_svc.c:1116:MSGCleanupClient() Thread is stopping: dwClientID=6, threadContext @0x58bb960dcec0
00000002 [129475928909504] ../src/winscard_svc.c:1124:MSGCleanupClient() Freeing SCONTEXT @0x58bb960dcec0

Chances are this patch won't end up fixing my issue then since I had assumed this was a bug related to resume from suspend (since that's when it most often happens). I killed it with SIGUSR2 but unfortunately it didn't give me a core dump I could get a backtrace of.

My javacard is currently inserted into the reader; removing and reinserting it does not fix the issue. Back when I was using a yubikey, removing and reinserting the yubikey also did not fix the issue. A restart of pcscd, even without removing and reinserting the key, would cause it to work correctly again.

EDIT: Never mind, it turns out that that's a different problem presenting as a similar issue. I'll modify the systemd unit with those debugging flags; and I'll explain a bit more later.

@Pandapip1

Copy link
Copy Markdown
Author

Since I'm on NixOS and it doesn't have /var, I've ended up modifying the systemd unit rather than running the command at https://ccid.apdu.fr/#support. Here's my full service definition:

# /etc/systemd/system/pcscd.service -> /nix/store/9aqnmc9rk0xxf9346gc6jh6sl0lihyhc-pcsclite-with-polkit-2.4.1/lib/systemd/system/pcscd.service
[Unit]
Description=PC/SC Smart Card Daemon
Requires=pcscd.socket
Requires=polkit.service
Documentation=man:pcscd(8)

[Service]
ExecStart=/nix/store/9aqnmc9rk0xxf9346gc6jh6sl0lihyhc-pcsclite-with-polkit-2.4.1/sbin/pcscd --foreground --auto-exit $PCSCD_ARGS
ExecReload=/nix/store/9aqnmc9rk0xxf9346gc6jh6sl0lihyhc-pcsclite-with-polkit-2.4.1/sbin/pcscd --hotplug
EnvironmentFile=-/etc/default/pcscd
User=pcscd
RuntimeDirectory=pcscd
RuntimeDirectoryPreserve=yes
PIDFile=/run/pcscd/pcscd.pid

# Paths
ProtectProc=invisible

# Capabilities
CapabilityBoundingSet=

# Security
NoNewPrivileges=yes

# Process Properties
UMask=0077

# Sandboxing
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateUsers=identity
ProtectHostname=yes
ProtectClock=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
RestrictNamespaces=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes

# System Call Filtering
SystemCallFilter=@system-service
SystemCallFilter=~@resources @privileged
SystemCallArchitectures=native

[Install]
Also=pcscd.socket

# /nix/store/9jfq62fgnnzfqbgm340zq9za2ni2x5cx-system-units/pcscd.service.d/overrides.conf -> /nix/store/1vg63jnw0z61fp8i73kipk884nj3iy8x-unit-pcscd.service/pcscd.service
[Unit]

[Service]
Environment="LIBCCID_ifdLogLevel=0x000F"
Environment="LOCALE_ARCHIVE=/nix/store/78i8xfh6bdkcnzc1bs3fpj7dbgvxxa4h-glibc-locales-2.42-61/lib/locale/locale-archive"
Environment="PATH=/nix/store/9ypz3flqsrl5xl495mm8h645gadjsxi1-coreutils-9.11/bin:/nix/store/c1cjgg6p8m8fssivzrc2p13mwwml3p3v-findutils-4.10.0/bin:/nix/store/gn94gpcp5q08x4v6g8mvw8v4r65rcjzk-gnugrep-3.12/bin:/nix/store/kgxafhycw2kybbqih759ykc2043qyi5j-gnused-4.9/bin:/nix/store/a8avqfxd649rfgfpqldja6v38ljb8fj5-systemd-260.1/bin:/nix/store/9ypz3flqsrl5xl495mm8h645gadjsxi1-coreutils-9.11/sbin:/nix/store/c1cjgg6p8m8fssivzrc2p13mwwml3p3v-findutils-4.10.0/sbin:/nix/store/gn94gpcp5q08x4v6g8mvw8v4r65rcjzk-gnugrep-3.12/sbin:/nix/store/kgxafhycw2kybbqih759ykc2043qyi5j-gnused-4.9/sbin:/nix/store/a8avqfxd649rfgfpqldja6v38ljb8fj5-systemd-260.1/sbin"
Environment="PCSCLITE_HP_DROPDIR=/nix/store/q1mprzvl7017gfbzcd7ng8712si0l1n7-pcscd-plugins"
Environment="TZDIR=/nix/store/v2hsfkf03b3l79rhcxw4nq7w79kr3qkw-tzdata-2026b/share/zoneinfo"
ExecStart=
ExecStart=/nix/store/9aqnmc9rk0xxf9346gc6jh6sl0lihyhc-pcsclite-with-polkit-2.4.1/bin/pcscd -f -x -c /nix/store/a72f2j7d8mb9c6qzvsyrfrpzd8h2f5yc-reader.conf --debug --apdu --color

Will get back to you when I repro it.

@LudovicRousseau

Copy link
Copy Markdown
Owner

i do not see any problem in you logs.

But this:

00000039 [129475947855552] ../src/pcscdaemon.c:752:main() Using drivers directory: /var/lib/pcsc/drivers
00000007 [129475947855552] ../src/hotplug_libudev.c:122:HPReadBundleValues() Cannot open PC/SC drivers directory: /var/lib/pcsc/drivers
00000002 [129475947855552] ../src/hotplug_libudev.c:123:HPReadBundleValues() Disabling USB support for pcscd.

is not a good way to use USB devices.

I think you need to use: export PCSCLITE_HP_DROPDIR=/nix/store/q1mprzvl7017gfbzcd7ng8712si0l1n7-pcscd-plugins

@Pandapip1

Pandapip1 commented Jun 6, 2026

Copy link
Copy Markdown
Author

Okay, I've finally hit it again. Here are the last 2k lines from the log. Can't upload the whole thing because it's over 25 MB and 192k lines long.

pcscd.log

@Pandapip1

Pandapip1 commented Jun 6, 2026

Copy link
Copy Markdown
Author

Here's a complete log run for one that happened a lot faster.

pcscd.log

I now no longer think this is a resume from suspend-related bug, since I'm pretty sure I didn't step away during those 30 minutes. This patch is still probably correct, but I'm no longer confident this fixes my specific issue.

@Pandapip1

Copy link
Copy Markdown
Author

Here's one that happened in ~10 minutes

pcscd.log

@LudovicRousseau

Copy link
Copy Markdown
Owner

I do not find any error or issue in your latest log.

What line in the log is problematic according to you?

@Pandapip1

Copy link
Copy Markdown
Author

The smartcard was reported as not inserted despite being inserted. I did notice SCARD_E_SHARING_VIOLATION which led me to https://blog.apdu.fr/posts/2024/12/gnupg-and-pcsc-conflicts-episode-3/. Seems similar enough to the problem I'm having; will add pcsc-shared to scdaemon.conf and report back.

@Pandapip1
Pandapip1 marked this pull request as draft June 6, 2026 18:09
@LudovicRousseau

Copy link
Copy Markdown
Owner

I can't do anything if the reader reports "card absent" but the card is present.

The Alcor Micro AU9540 or AU9560 readers are not very good readers.
https://ccid.apdu.fr/ccid/unsupported.html#0x058F0x9540
https://ccid.apdu.fr/ccid/unsupported.html#0x058F0x9540_1

This problem has nothing to do with suspend to RAM.

@Pandapip1

Copy link
Copy Markdown
Author

Fair enough. I'll assume this is a hardware bug then.

@Pandapip1 Pandapip1 closed this Jun 7, 2026
@Pandapip1
Pandapip1 deleted the handle-card-broken-from-suspend branch June 7, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants