From 6f51f8f1e7e2c568f58c33c1c28446a74496f77a Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Fri, 14 Apr 2023 14:20:53 +0200 Subject: [PATCH] Disable USB-persist for CCID devices The Linux kernel tries to keep the USB connection during suspend/resume cycles. This is a bad idea if the reader/token is unpluged while the computer is suspended. More documentation is available at https://docs.kernel.org/driver-api/usb/persist.html If a CCID reader (including a composite one) is disconnected and reconnected while the computer is suspended then the USB device will be considered removed and connected again. PC/SC applications will have to reconnect. Closes: https://github.com/LudovicRousseau/PCSC/issues/154 "USB resets leave the reader connection in a broken state #154" --- src/92_pcscd_ccid.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/92_pcscd_ccid.rules b/src/92_pcscd_ccid.rules index 00780177..2b3122ac 100644 --- a/src/92_pcscd_ccid.rules +++ b/src/92_pcscd_ccid.rules @@ -11,6 +11,10 @@ ENV{DEVTYPE}!="usb_device", GOTO="pcscd_ccid_rules_end" # Kobil mIDentity ATTRS{idVendor}=="0d46", ATTRS{idProduct}=="4081", RUN+="/usr/sbin/Kobil_mIDentity_switch" +# disable USB-persist for CCID devices (including composite ones) +# https://docs.kernel.org/driver-api/usb/persist.html +ENV{ID_USB_INTERFACES}=="*:0b0000:*", TEST=="power/persist", ATTR{power/persist}="0" + # Keep USB autosuspend off for the C3PO LTC31 v1 SmartCard Reader ATTR{idVendor}=="0783", ATTR{idProduct}=="0003", GOTO="pcscd_ccid_rules_end"