diff options
author | Werner Koch <wk@gnupg.org> | 2024-03-06 11:54:33 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2024-03-07 13:21:43 +0100 |
commit | a1ea3b13e0c79cb301216727b17631fbf1b23e06 (patch) | |
tree | 1203512c1a0be060dcc5f573480892f6e4eda766 /scd/ccid-driver.c | |
parent | doc: Typo fix in comment (diff) | |
download | gnupg2-a1ea3b13e0c79cb301216727b17631fbf1b23e06.tar.xz gnupg2-a1ea3b13e0c79cb301216727b17631fbf1b23e06.zip |
scd: Let the CCID module auto detach the kernel driver.
* scd/ccid-driver.c (ccid_open_usb_reader): Call
libusb_set_auto_detach_kernel_driver.
* scd/scdaemon.c (oCompatibilityFlags): New.
(opts): Add option "compatibility-flags".
(compatibility_flags): New.
(main): Parse flags.
* scd/scdaemon.h (opt): Add field compat_flags.
(COMPAT_CCID_NO_AUTO_DETACH): New.
Diffstat (limited to 'scd/ccid-driver.c')
-rw-r--r-- | scd/ccid-driver.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index ad1e16a12..7319ada41 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -1779,6 +1779,20 @@ ccid_open_usb_reader (const char *spec_reader_name, #ifdef USE_NPTH npth_unprotect (); #endif + if (!(opt.compat_flags & COMPAT_CCID_NO_AUTO_DETACH)) + { + rc = libusb_set_auto_detach_kernel_driver (idev, 1); + if (rc) + { +#ifdef USE_NPTH + npth_protect (); +#endif + DEBUGOUT_1 ("note: set_auto_detach_kernel_driver failed: %d\n", rc); +#ifdef USE_NPTH + npth_unprotect (); +#endif + } + } rc = libusb_claim_interface (idev, ifc_no); if (rc) { |