New upstream version 1.9.5

This commit is contained in:
Ludovic Rousseau 2021-12-04 13:36:24 +01:00
parent 5e7e63335c
commit 8360e0e1aa
26 changed files with 655 additions and 595 deletions

View File

@ -1,3 +1,11 @@
1.9.5: Ludovic Rousseau
4 December 2021
- pcscd: autoexit even if no client connects
- Fix variable substitution in systemd units
- fix potential race conditions with powerState handling
- Add and use tag TAG_IFD_DEVICE_REMOVED
- UnitaryTests: port code to Python 3
1.9.4: Ludovic Rousseau
1 October 2021
- fix a memory leak when libusb is used for hotplug (i.e. non-Linux

View File

@ -1,4 +1,503 @@
commit baa02edd1fb47c18b6bb7dfe79b2b38390271ce6 (HEAD -> master, zotac/master)
commit d92b5d4fad5dea95ce8d12fac07fe1eec2150ad1 (HEAD -> master)
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Dec 4 13:16:36 2021 +0100
Release 1.9.5
Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
ChangeLog | 8 ++++++++
configure.ac | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
commit e098afc1bfe46acc74102a5e8d2b2cd14c785445
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Dec 4 13:26:26 2021 +0100
etc/: remove systemd unit files on clean
Fix 'make distcheck'
ERROR: files left in build directory after distclean:
./etc/pcscd.socket
./etc/pcscd.service
make[1]: *** [Makefile:732 : distcleancheck] Erreur 1
etc/Makefile.am | 2 ++
1 file changed, 2 insertions(+)
commit 2f970328ec14b20fdef01e3816df6c88d00e3a90
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Dec 4 13:23:53 2021 +0100
etc/: add pcscd.{service,socket}.in in archive
We must distribute the *.in files
etc/Makefile.am | 4 ++++
1 file changed, 4 insertions(+)
commit 4b39499ac201116a90dee5151dcc7b5af6ac153d (origin/master, origin/HEAD, github/master)
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Dec 4 12:46:18 2021 +0100
Improve handling of files etc/pcscd.{service,socket}.in
Use the same code template from https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Installation-Directory-Variables.html#index-sysconfdir-1
The substitution now also works if ./configure is called again with a
different --prefix= value.
Thanks to Kirill Elagin for the initial patch
" [Pcsclite-muscle] Incorrect use of Autoconf to expand variables in
plaintext files "
http://lists.infradead.org/pipermail/pcsclite-muscle/2021-December/001215.html
Hello,
First, here is a concrete instance of this issue. In pcsclite 1.9.2
`EnvironmentFile=` was added to the `etc/pcscd.service.in` file. If
you look at a machine that has this (or newer) version installed, you
will find in `/etc/systemd/system/pcscd.service` this line:
```
EnvironmentFile=-${prefix}/etc/default/pcscd
```
It results in the following error reported to the system journal:
```
systemd[1]: /etc/systemd/system/pcscd.service:9: EnvironmentFile= path
is not absolute, ignoring: ${prefix}/etc/default/pcscd
```
The root cause is that `AC_CONFIG_FILES` is used, arguably somewhat
incorrectly, to replace all kinds of variables in all kinds of files,
while it is meant to only list makefiles. Quite often, this is not a
problem, since those variables just get replaced by correct values and
thats it, however some variables do not get expanded fully, for
example, the @sysconfdir@ variable used in `pcscd.service.in` is
replaced with literal `${prefix}/etc` by default as can be seen above.
As [Autoconf documentation](https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Installation-Directory-Variables.html#Installation-Directory-Variables)
explains, this is done intentionally literal `${prefix}` is used as
part of the replacement value since @sysconfdir@ is supposed to be
used only in makefiles where it will be processed by Make. The
documentation explicitly calls out this practice:
“A corollary is that you should not use these variables except in makefiles.”
“Similarly, you should not rely on AC_CONFIG_FILES to replace bindir
and friends in your shell scripts and other files.”
Then it goes on to give an example of how a full replacement can be
achieved with the help of Make and sed, however I am not exactly sure
if this is a standard practice or if there is a better solution these
days.
In addition to that, pcsc-lite (ab)uses `AC_CONFIG_FILES` to replace
variables in some other files too, however this does not cause
problems since, as far as I can tell, all of those variables are of
the kind that gets expanded fully with one notable exception: the
variables used in `src/libpcsclite.pc.in` are also not being expanded
fully, so they remain in the generated file, however, luckily, .pc
files allow references to other variables defined in the same file and
due to a convenient coincidence the names of the variables used by
`./configure` and defined in the `libpcsclite.pc` match. I dont know,
I mean, this still sounds a little fragile to me and I think it would
be better to switch to some more robust solution.
Cheers,
Kirill
etc/Makefile.am | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
commit 88ec131029ba9648a63ca072004e90414d10647e
Author: Kirill Elagin <kirelagin@gmail.com>
Date: Fri Dec 3 22:55:10 2021 -0500
Fix variable substitution in systemd units
Before this change, Autoconf was used to subsitute variables, including
@sysconfdir@, in systemd unit files. This is not how Autoconf should be
used and had an unintended negative consequence: the @sysconfdir@
variable was not fully expanded, so literal `${prefix}/etc` was ending up
in the pcscd.service file, where it was invalid.
Use sed to perform the subsitution from within the makefile where the
variables get expanded fully. This seems to be the standard approach
recommended by Autoconf documentation and used in various projects.
Also, remove the `SCRIPT_IN_FILES` variable from the makefile, which was
not used and seems to be a copy-paste from some other project.
configure.ac | 2 --
etc/Makefile.am | 12 ++++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
commit e1b1590c7f32e0353404967f457643d122367772
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 27 16:32:31 2021 +0100
SCardDisconnect: Use RFGetPowerState
The fix in 0cf804f99c588e7abc5cd42f42b9582df5e8fb17 was not complete.
src/winscard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 0cf804f99c588e7abc5cd42f42b9582df5e8fb17
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 27 15:28:10 2021 +0100
Use RFGetPowerState & RFSetPowerState
This will help fix potential race conditions.
I was not able to generate a problem using ThreadSanitizer but that is
not a proof that the code is correct
https://clang.llvm.org/docs/ThreadSanitizer.html
Thanks to andrei-datcu for the patch
"No data races in EHStatusHandlerThread #112"
https://github.com/LudovicRousseau/PCSC/pull/112
src/eventhandler.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
commit c6aba284be54b5d166f638511f916ad3f8f2f897
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 27 15:16:02 2021 +0100
SCardReconnect: use RFSetPowerState() and factorize code
src/winscard.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
commit 46ded0cf6afb0030cd83dae6cf071a48daee6a0f
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 27 15:05:16 2021 +0100
Add RFGetPowerState() & RFSetPowerState() functions
These 2 functions get & set the card power state and guard the operation
between lock/unlock of the powerState_lock mutex.
This will help fix potential race conditions
Thanks to andrei-datcu for the patch
"No data races in EHStatusHandlerThread #112"
https://github.com/LudovicRousseau/PCSC/pull/112
src/readerfactory.c | 15 +++++++++++++++
src/readerfactory.h | 2 ++
2 files changed, 17 insertions(+)
commit 9b6b667260228b797ac5af5479bdf7a3045ae389
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 13 18:18:29 2021 +0100
Fix typo in comment
src/pcscdaemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 6f55e47728bbe96100aee0cb4d405d1d32dbf14c
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 13 18:13:15 2021 +0100
pcscdaemon: autoexit even if no client connects
pcscd will now auto exit even if no PC/SC client has connected.
The idea is to auto exit if pcscd is restarted after an upgrade or a new
driver installation. In that case pcscd is NOT strated by a new client
so the alarm is not set the client disconnect.
If you use something like "service pcscd restart" to restart pcscd then
it will exit after 60 seconds (if no client uses it).
src/pcscdaemon.c | 7 +++++++
1 file changed, 7 insertions(+)
commit 7d3379ed4ed51b3fb7f5237bba6c26e2705995fa
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 13 17:58:07 2021 +0100
Fix typo in comment
src/pcscdaemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit acd76b194b16776dcd3bb447ccfbbd4e0ce703c8
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat Nov 13 17:57:19 2021 +0100
Fix typo in comment
src/pcscdaemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit d81489a7b2f34d368e99b687466b01ad5939b50a
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Fri Nov 12 17:04:40 2021 +0100
c.sh: /lib is now a symbolic link to /usr/lib on GNU/Linux
See https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
c.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 76d2f91b88857dc955c888da965ccda4145d236e
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 21:17:04 2021 +0100
transmit_card_removed: remove unused import
Fix lgtm.com recommendation:
Import of 'sleep' is not used.
UnitaryTests/transmit_card_removed.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 21792d6d83e1f1d62f8554aa715265909d63ce53
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:40:11 2021 +0100
SCardGetStatusChange: port to Python 3
.../SCardGetStatusChange/SCardGetStatusChange.py | 32 +++++++++++-----------
1 file changed, 16 insertions(+), 16 deletions(-)
commit 5d253fb86a5f096e9885d06b2a1de3ce13fe9ef2
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:38:35 2021 +0100
SCardGetStatusChange: remove unused import
Fix lgtm.com recommendation:
Import of 'sys' is not used.
UnitaryTests/SCardGetStatusChange/SCardGetStatusChange.py | 1 -
1 file changed, 1 deletion(-)
commit 1dd791ea98c38636208c4cc4222f1025fc9f92ac
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:37:54 2021 +0100
SCardGetStatusChange_PnP: port to Python 3
.../SCardGetStatusChange_PnP.py | 36 +++++++++++-----------
1 file changed, 18 insertions(+), 18 deletions(-)
commit 9be58fdca0cf6e173ebb68717d690ca05a983e01
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:09:34 2021 +0100
SCardGetStatusChange_PnP: remove unused import
Fix lgtm.com recommendation:
Import of 'sys' is not used.
UnitaryTests/SCardGetStatusChange/SCardGetStatusChange_PnP.py | 2 --
1 file changed, 2 deletions(-)
commit 68cc8fb154d9c515b07b0ab0b3766d6a34b28211
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:08:33 2021 +0100
SCardGetStatusChange_loop: remove unused import
Fix lgtm.com recommendation:
Import of 'sys' is not used.
UnitaryTests/SCardGetStatusChange/SCardGetStatusChange_loop.py | 1 -
1 file changed, 1 deletion(-)
commit 650bfac39f43e5608618919a8f03b49b6da4e9a9
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:05:43 2021 +0100
ThreadSafeConnect: remove unused import
Fix lgtm.com recommendation:
Import of 'SCardGetErrorMessage' is not used.
UnitaryTests/ThreadSafeConnect.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 390d49b45207614c5682a44f452fae89ba4c56ea
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:03:48 2021 +0100
SCardBeginTransaction_Reset: remove unused import
Fix lgtm.com recommendation:
Import of 'sleep' is not used.
UnitaryTests/SCardBeginTransaction_Reset.py | 1 -
1 file changed, 1 deletion(-)
commit 2dd7849c489a349665ac4f66b6b98e3426fb6cdc
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 19:02:40 2021 +0100
FEATURE_CCID_ESC_COMMAND_Gemalto_features: remove unused import
Fix lgtm.com recommendation:
Import of 'PCSCv2_PART10_PROPERTY_wIdProduct' is not used.
Import of 'PCSCv2_PART10_PROPERTY_wIdVendor' is not used.
UnitaryTests/FEATURE_CCID_ESC_COMMAND_Gemalto_features.py | 1 -
1 file changed, 1 deletion(-)
commit b0ba6757ff14d716bbff3eed1f08b674f456857e
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Nov 7 18:58:33 2021 +0100
control_switch_interface: catch a specific exception
Fix lgtm.com recommendation:
Except block directly handles BaseException.
UnitaryTests/control_switch_interface.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
commit abaab9636c4460fe3c82ac58881fee9e1a54b003
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Wed Nov 3 19:05:48 2021 +0100
SCardGetStatusChange_loop: handle KeyboardInterrupt
Catch the KeyboardInterrupt exception and cleanly disconnect and exit
.../SCardGetStatusChange_loop.py | 37 +++++++++++-----------
1 file changed, 19 insertions(+), 18 deletions(-)
commit 9519ad6c89b260d6d4b0a7303da3186e7fd94566
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Wed Nov 3 19:04:20 2021 +0100
SCardGetStatusChange_loop: make the code more explicit
Use True instead of 1
UnitaryTests/SCardGetStatusChange/SCardGetStatusChange_loop.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 2c613018f3d60c497593d8bc4a66d78e25990e47
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Wed Nov 3 18:22:42 2021 +0100
SCardGetStatusChange_loop: port to Python 3
.../SCardGetStatusChange_loop.py | 36 +++++++++++-----------
1 file changed, 18 insertions(+), 18 deletions(-)
commit d47c15727c37e1b5e63a0d5b29394b41f84d791d
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Wed Nov 3 18:16:10 2021 +0100
transmit_loop: handle KeyboardInterrupt
Catch the KeyboardInterrupt exception and cleanly disconnect and exit
UnitaryTests/transmit_loop.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
commit 61cd3872bb8aba49ffa357722e753caec80db117
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Wed Nov 3 18:14:16 2021 +0100
transmit_loop: make the code more explicit
Use True instead of 1
UnitaryTests/transmit_loop.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 91da0d5dd94b08fd5840c5c04e5a8b3b9e3b019a
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Oct 10 17:11:23 2021 +0200
Update README_INTERNALS.txt
Remove now incorrect text.
src/README_INTERNALS.txt | 35 -----------------------------------
1 file changed, 35 deletions(-)
commit 6f8f170db3c88c59a5ddb5ae5319b921a901a6aa
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Oct 10 17:05:13 2021 +0200
Remove unmaintained hotplug_linux.c
This hotplug mechanism should not be used anymore.
For example the directory "/proc/bus/usb" used to scan the USB bus does
not exist anymore on my Debian Bullseye system.
src/Makefile.am | 1 -
src/README_INTERNALS.txt | 1 -
src/hotplug_linux.c | 472 -----------------------------------------------
3 files changed, 474 deletions(-)
commit ed97272cf2d5f5e45e4af9b1bd86d529cadabbf1
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Oct 10 16:57:47 2021 +0200
Use REMOVE_READER_FLAG_REMOVED for the other hotplug variants
- hotplug_libusb.c is used on non-Linux systems like *BSD
- hotplug_macosx.c is for macOS only but should not be used
src/hotplug_libusb.c | 2 +-
src/hotplug_macosx.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
commit c5a47f7e713de9c70deb7382de13c91966684eed
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Oct 10 16:45:08 2021 +0200
Use TAG_IFD_DEVICE_REMOVED when the reader is removed
When a USB reader is removed then use the new IFD Handler tag
TAG_IFD_DEVICE_REMOVED to signal the fact to the driver.
RFRemoveReader() has a new "flags" parameter.
By default the value REMOVE_READER_NO_FLAG is used.
When the libudev hotplug mechanism detects that a USB device has been
removed then RFRemoveReader() is called with REMOVE_READER_FLAG_REMOVED.
RFRemoveReader() will then use TAG_IFD_DEVICE_REMOVED to tell the
driver that the device has been removed and that no communication with
the device should occur.
src/hotplug_libudev.c | 2 +-
src/readerfactory.c | 35 +++++++++++++++++++++++++++--------
src/readerfactory.h | 5 ++++-
3 files changed, 32 insertions(+), 10 deletions(-)
commit ba516815edbd838fa8d0dc45691c8fec0d8c4fc3
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sun Oct 10 16:37:16 2021 +0200
Add tag TAG_IFD_DEVICE_REMOVED
This tag is used to tell the driver that the reader has been detected
removed. So the driver do not try to talk to the device since that will
fails.
The idea is to avoid error messages in the logs like:
00000000 [140611055253248] ccid_usb.c:871:WriteUSB() write failed (1/12): -4 LIBUSB_ERROR_NO_DEVICE
00000692 [140611271165696] ccid_usb.c:871:WriteUSB() write failed (1/12): -4 LIBUSB_ERROR_NO_DEVICE
when the device is removed and pcscd tells the driver to close the
connection.
src/PCSC/ifdhandler.h | 1 +
1 file changed, 1 insertion(+)
commit baa02edd1fb47c18b6bb7dfe79b2b38390271ce6 (tag: 1.9.4)
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Fri Oct 1 17:40:31 2021 +0200
@ -38,7 +537,7 @@ Date: Fri Oct 1 17:46:55 2021 +0200
configure.ac | 2 --
1 file changed, 2 deletions(-)
commit a79e1d8409befc6ae0e6d77c0ff47a24f1bb31c3 (origin/master, origin/HEAD, github/master)
commit a79e1d8409befc6ae0e6d77c0ff47a24f1bb31c3
Author: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Fri Oct 1 16:51:49 2021 +0200

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.

10
aclocal.m4 vendored
View File

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.16.4 -*- Autoconf -*-
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
@ -891,7 +891,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.4], [],
m4_if([$1], [1.16.5], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -907,7 +907,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.4])dnl
[AM_AUTOMAKE_VERSION([1.16.5])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
@ -1344,6 +1344,10 @@ m4_defn([AC_PROG_CC])
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
m4_ifdef([_$0_ALREADY_INIT],
[m4_fatal([$0 expanded multiple times
]m4_defn([_$0_ALREADY_INIT]))],
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl

24
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for pcsc-lite 1.9.4.
# Generated by GNU Autoconf 2.71 for pcsc-lite 1.9.5.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@ -618,8 +618,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pcsc-lite'
PACKAGE_TARNAME='pcsc-lite'
PACKAGE_VERSION='1.9.4'
PACKAGE_STRING='pcsc-lite 1.9.4'
PACKAGE_VERSION='1.9.5'
PACKAGE_STRING='pcsc-lite 1.9.5'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1422,7 +1422,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures pcsc-lite 1.9.4 to adapt to many kinds of systems.
\`configure' configures pcsc-lite 1.9.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1493,7 +1493,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pcsc-lite 1.9.4:";;
short | recursive ) echo "Configuration of pcsc-lite 1.9.5:";;
esac
cat <<\_ACEOF
@ -1646,7 +1646,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pcsc-lite configure 1.9.4
pcsc-lite configure 1.9.5
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@ -2062,7 +2062,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pcsc-lite $as_me 1.9.4, which was
It was created by pcsc-lite $as_me 1.9.5, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@ -3333,7 +3333,7 @@ fi
# Define the identity of the package.
PACKAGE='pcsc-lite'
VERSION='1.9.4'
VERSION='1.9.5'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -16531,7 +16531,7 @@ PCSCLITE_FEATURES: ${PCSCLITE_FEATURES}
EOF
# Write Makefiles
ac_config_files="$ac_config_files Makefile doc/Makefile doc/doxygen.conf doc/pcscd.8 doc/reader.conf.5 doc/example/Makefile etc/Makefile etc/pcscd.service etc/pcscd.socket src/Makefile src/libpcsclite.pc src/pcscd.h src/PCSC/pcsclite.h src/spy/Makefile"
ac_config_files="$ac_config_files Makefile doc/Makefile doc/doxygen.conf doc/pcscd.8 doc/reader.conf.5 doc/example/Makefile etc/Makefile src/Makefile src/libpcsclite.pc src/pcscd.h src/PCSC/pcsclite.h src/spy/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -17081,7 +17081,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by pcsc-lite $as_me 1.9.4, which was
This file was extended by pcsc-lite $as_me 1.9.5, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -17149,7 +17149,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
pcsc-lite config.status 1.9.4
pcsc-lite config.status 1.9.5
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
@ -17571,8 +17571,6 @@ do
"doc/reader.conf.5") CONFIG_FILES="$CONFIG_FILES doc/reader.conf.5" ;;
"doc/example/Makefile") CONFIG_FILES="$CONFIG_FILES doc/example/Makefile" ;;
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
"etc/pcscd.service") CONFIG_FILES="$CONFIG_FILES etc/pcscd.service" ;;
"etc/pcscd.socket") CONFIG_FILES="$CONFIG_FILES etc/pcscd.socket" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"src/libpcsclite.pc") CONFIG_FILES="$CONFIG_FILES src/libpcsclite.pc" ;;
"src/pcscd.h") CONFIG_FILES="$CONFIG_FILES src/pcscd.h" ;;

View File

@ -3,7 +3,7 @@
AC_PREREQ([2.69])
AC_INIT([pcsc-lite],[1.9.4])
AC_INIT([pcsc-lite],[1.9.5])
AC_CONFIG_SRCDIR(src/pcscdaemon.c)
AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip)
AC_CONFIG_HEADERS([config.h])
@ -461,8 +461,6 @@ doc/pcscd.8
doc/reader.conf.5
doc/example/Makefile
etc/Makefile
etc/pcscd.service
etc/pcscd.socket
src/Makefile
src/libpcsclite.pc
src/pcscd.h

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.

View File

@ -1,9 +1,29 @@
if HAVE_SYSTEMD
SCRIPT_IN_FILES = \
EXTRA_DIST = \
pcscd.service.in \
pcscd.socket.in
systemdsystemunit_DATA = \
pcscd.service \
pcscd.socket
CLEANFILES = $(systemdsystemunit_DATA)
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@sbindir_exp[@]|$(sbindir_exp)|g' \
-e 's|@ipcdir[@]|$(ipcdir)|g'
$(systemdsystemunit_DATA): Makefile
rm -f $@ $@.tmp
srcdir=''; \
test -f ./$@.in || srcdir=$(srcdir)/; \
$(edit) $${srcdir}$@.in >$@.tmp
chmod +x $@.tmp
chmod a-w $@.tmp
mv $@.tmp $@
pcscd.service: $(srcdir)/pcscd.service.in
pcscd.socket: $(srcdir)/pcscd.socket.in
endif

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
@ -99,7 +99,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = pcscd.service pcscd.socket
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@ -150,8 +150,7 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(systemdsystemunitdir)"
DATA = $(systemdsystemunit_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/pcscd.service.in \
$(srcdir)/pcscd.socket.in
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
@ -306,7 +305,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
usbdropdir = @usbdropdir@
@HAVE_SYSTEMD_TRUE@SCRIPT_IN_FILES = \
@HAVE_SYSTEMD_TRUE@EXTRA_DIST = \
@HAVE_SYSTEMD_TRUE@ pcscd.service.in \
@HAVE_SYSTEMD_TRUE@ pcscd.socket.in
@ -314,6 +313,12 @@ usbdropdir = @usbdropdir@
@HAVE_SYSTEMD_TRUE@ pcscd.service \
@HAVE_SYSTEMD_TRUE@ pcscd.socket
@HAVE_SYSTEMD_TRUE@CLEANFILES = $(systemdsystemunit_DATA)
@HAVE_SYSTEMD_TRUE@edit = sed \
@HAVE_SYSTEMD_TRUE@ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
@HAVE_SYSTEMD_TRUE@ -e 's|@sbindir_exp[@]|$(sbindir_exp)|g' \
@HAVE_SYSTEMD_TRUE@ -e 's|@ipcdir[@]|$(ipcdir)|g'
all: all-am
.SUFFIXES:
@ -346,10 +351,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
pcscd.service: $(top_builddir)/config.status $(srcdir)/pcscd.service.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
pcscd.socket: $(top_builddir)/config.status $(srcdir)/pcscd.socket.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@ -445,6 +446,7 @@ install-strip:
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@ -537,6 +539,18 @@ uninstall-am: uninstall-systemdsystemunitDATA
.PRECIOUS: Makefile
@HAVE_SYSTEMD_TRUE@$(systemdsystemunit_DATA): Makefile
@HAVE_SYSTEMD_TRUE@ rm -f $@ $@.tmp
@HAVE_SYSTEMD_TRUE@ srcdir=''; \
@HAVE_SYSTEMD_TRUE@ test -f ./$@.in || srcdir=$(srcdir)/; \
@HAVE_SYSTEMD_TRUE@ $(edit) $${srcdir}$@.in >$@.tmp
@HAVE_SYSTEMD_TRUE@ chmod +x $@.tmp
@HAVE_SYSTEMD_TRUE@ chmod a-w $@.tmp
@HAVE_SYSTEMD_TRUE@ mv $@.tmp $@
@HAVE_SYSTEMD_TRUE@pcscd.service: $(srcdir)/pcscd.service.in
@HAVE_SYSTEMD_TRUE@pcscd.socket: $(srcdir)/pcscd.socket.in
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -16,7 +16,6 @@ if ENABLE_USB
USB_CONFIG = tokenparser.l \
hotplug_libudev.c \
hotplug_libusb.c \
hotplug_linux.c \
hotplug_macosx.c
endif

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
@ -172,14 +172,13 @@ am__pcscd_SOURCES_DIST = auth.c auth.h atrhandler.c atrhandler.h \
PCSC/wintypes.h prothandler.c prothandler.h readerfactory.c \
readerfactory.h simclist.c simclist.h sys_generic.h sys_unix.c \
tokenparser.l hotplug_libudev.c hotplug_libusb.c \
hotplug_linux.c hotplug_macosx.c utils.c utils.h winscard.c \
winscard_msg.c winscard_msg.h winscard_msg_srv.c \
winscard_svc.c winscard_svc.h
hotplug_macosx.c utils.c utils.h winscard.c winscard_msg.c \
winscard_msg.h winscard_msg_srv.c winscard_svc.c \
winscard_svc.h
@ENABLE_SERIAL_TRUE@am__objects_1 = pcscd-configfile.$(OBJEXT)
@ENABLE_USB_TRUE@am__objects_2 = pcscd-tokenparser.$(OBJEXT) \
@ENABLE_USB_TRUE@ pcscd-hotplug_libudev.$(OBJEXT) \
@ENABLE_USB_TRUE@ pcscd-hotplug_libusb.$(OBJEXT) \
@ENABLE_USB_TRUE@ pcscd-hotplug_linux.$(OBJEXT) \
@ENABLE_USB_TRUE@ pcscd-hotplug_macosx.$(OBJEXT)
am_pcscd_OBJECTS = pcscd-auth.$(OBJEXT) pcscd-atrhandler.$(OBJEXT) \
$(am__objects_1) pcscd-debuglog.$(OBJEXT) \
@ -236,7 +235,6 @@ am__depfiles_remade = ./$(DEPDIR)/libpcsclite_la-debug.Plo \
./$(DEPDIR)/pcscd-hotplug_generic.Po \
./$(DEPDIR)/pcscd-hotplug_libudev.Po \
./$(DEPDIR)/pcscd-hotplug_libusb.Po \
./$(DEPDIR)/pcscd-hotplug_linux.Po \
./$(DEPDIR)/pcscd-hotplug_macosx.Po \
./$(DEPDIR)/pcscd-ifdwrapper.Po \
./$(DEPDIR)/pcscd-pcscdaemon.Po \
@ -514,7 +512,6 @@ lib_LTLIBRARIES = libpcsclite.la
@ENABLE_USB_TRUE@USB_CONFIG = tokenparser.l \
@ENABLE_USB_TRUE@ hotplug_libudev.c \
@ENABLE_USB_TRUE@ hotplug_libusb.c \
@ENABLE_USB_TRUE@ hotplug_linux.c \
@ENABLE_USB_TRUE@ hotplug_macosx.c
libpcsclite_la_SOURCES = \
@ -786,7 +783,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcscd-hotplug_generic.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcscd-hotplug_libudev.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcscd-hotplug_libusb.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcscd-hotplug_linux.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcscd-hotplug_macosx.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcscd-ifdwrapper.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcscd-pcscdaemon.Po@am__quote@ # am--include-marker
@ -1130,20 +1126,6 @@ pcscd-hotplug_libusb.obj: hotplug_libusb.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcscd_CFLAGS) $(CFLAGS) -c -o pcscd-hotplug_libusb.obj `if test -f 'hotplug_libusb.c'; then $(CYGPATH_W) 'hotplug_libusb.c'; else $(CYGPATH_W) '$(srcdir)/hotplug_libusb.c'; fi`
pcscd-hotplug_linux.o: hotplug_linux.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcscd_CFLAGS) $(CFLAGS) -MT pcscd-hotplug_linux.o -MD -MP -MF $(DEPDIR)/pcscd-hotplug_linux.Tpo -c -o pcscd-hotplug_linux.o `test -f 'hotplug_linux.c' || echo '$(srcdir)/'`hotplug_linux.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pcscd-hotplug_linux.Tpo $(DEPDIR)/pcscd-hotplug_linux.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hotplug_linux.c' object='pcscd-hotplug_linux.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcscd_CFLAGS) $(CFLAGS) -c -o pcscd-hotplug_linux.o `test -f 'hotplug_linux.c' || echo '$(srcdir)/'`hotplug_linux.c
pcscd-hotplug_linux.obj: hotplug_linux.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcscd_CFLAGS) $(CFLAGS) -MT pcscd-hotplug_linux.obj -MD -MP -MF $(DEPDIR)/pcscd-hotplug_linux.Tpo -c -o pcscd-hotplug_linux.obj `if test -f 'hotplug_linux.c'; then $(CYGPATH_W) 'hotplug_linux.c'; else $(CYGPATH_W) '$(srcdir)/hotplug_linux.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pcscd-hotplug_linux.Tpo $(DEPDIR)/pcscd-hotplug_linux.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hotplug_linux.c' object='pcscd-hotplug_linux.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcscd_CFLAGS) $(CFLAGS) -c -o pcscd-hotplug_linux.obj `if test -f 'hotplug_linux.c'; then $(CYGPATH_W) 'hotplug_linux.c'; else $(CYGPATH_W) '$(srcdir)/hotplug_linux.c'; fi`
pcscd-hotplug_macosx.o: hotplug_macosx.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcscd_CFLAGS) $(CFLAGS) -MT pcscd-hotplug_macosx.o -MD -MP -MF $(DEPDIR)/pcscd-hotplug_macosx.Tpo -c -o pcscd-hotplug_macosx.o `test -f 'hotplug_macosx.c' || echo '$(srcdir)/'`hotplug_macosx.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pcscd-hotplug_macosx.Tpo $(DEPDIR)/pcscd-hotplug_macosx.Po
@ -1462,6 +1444,8 @@ distdir-am: $(DISTFILES)
check-am: all-am
check: check-recursive
all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(DATA) $(HEADERS)
install-sbinPROGRAMS: install-libLTLIBRARIES
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(nodistheaderdir)" "$(DESTDIR)$(pcdir)" "$(DESTDIR)$(includedir)"; do \
@ -1526,7 +1510,6 @@ distclean: distclean-recursive
-rm -f ./$(DEPDIR)/pcscd-hotplug_generic.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_libudev.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_libusb.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_linux.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_macosx.Po
-rm -f ./$(DEPDIR)/pcscd-ifdwrapper.Po
-rm -f ./$(DEPDIR)/pcscd-pcscdaemon.Po
@ -1608,7 +1591,6 @@ maintainer-clean: maintainer-clean-recursive
-rm -f ./$(DEPDIR)/pcscd-hotplug_generic.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_libudev.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_libusb.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_linux.Po
-rm -f ./$(DEPDIR)/pcscd-hotplug_macosx.Po
-rm -f ./$(DEPDIR)/pcscd-ifdwrapper.Po
-rm -f ./$(DEPDIR)/pcscd-pcscdaemon.Po

View File

@ -328,6 +328,7 @@ whichever location your reader resides.
#define TAG_IFD_POLLING_THREAD_KILLABLE 0x0FB1 /**< the polling thread can be killed */
#define TAG_IFD_STOP_POLLING_THREAD 0x0FB2 /**< method used to stop the polling thread (instead of just pthread_kill()) */
#define TAG_IFD_POLLING_THREAD_WITH_TIMEOUT 0x0FB3 /**< driver uses a polling thread with a timeout parameter */
#define TAG_IFD_DEVICE_REMOVED 0x0FB4 /**< signals the reader has been removed*/
/*
* IFD Handler version number enummerations

View File

@ -279,7 +279,7 @@ extern const SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci, g_rgSCardRawPci;
#define INFINITE 0xFFFFFFFF /**< Infinite timeout */
#endif
#define PCSCLITE_VERSION_NUMBER "1.9.4" /**< Current version */
#define PCSCLITE_VERSION_NUMBER "1.9.5" /**< Current version */
/** Maximum readers context (a slot is count as a reader) */
#define PCSCLITE_MAX_READERS_CONTEXTS 16

View File

@ -26,16 +26,12 @@ pcscd (daemon)
eventhandler.c
hotplug_generic.c
hotplug_libusb.c
hotplug_linux.c (this file is OS dependant)
hotplug_macosx.c (this file is OS dependant)
ifdwrapper.c
pcscdaemon.c
powermgt_generic.c
powermgt_macosx.c (this file is OS dependant)
prothandler.c
readerfactory.c
sys_unix.c (this file is OS dependant)
thread_unix.c (this file is OS dependant)
tokenparser.l
winscard.c
winscard_msg.c
@ -49,7 +45,6 @@ libpcsclite.la (client library)
dyn_unix.c
error.c
sys_unix.c
thread_unix.c
winscard_clnt.c or winscard_scf.c
winscard_msg.c
@ -187,37 +182,6 @@ We can have:
=> does not work
Memory structures
-----------------
pcscd side:
- pcscd open/creates a shared memory segment (EHInitializeEventStructures()
in eventhandler.c)
- static PREADER_STATE readerStates[PCSCLITE_MAX_READERS_CONTEXTS]; is
an array of pointers on READER_STATE. Each entry readerStates[i]
points to a memory shared segment. It contains the state of each
readers.
- reader contexts are also created and maintained
- static PREADER_CONTEXT sReadersContexts[PCSCLITE_MAX_READERS_CONTEXTS];
is an array of pointers on READER_CONTEXT
- the structure is allocated by RFAllocateReaderSpace() in
readerfactory.c
- each READER_CONTEXT contains a pointer to a READER_STATE for the
context
libpcsclite side:
- the library open the shared memory segment (SCardEstablishContextTH()
in winscard_clnt.c)
- each entry readerStates[i] gets a reference to the memory segment of
the server.
The memory is READ ONLY on the library side.
Inter-thread communication:
---------------------------

View File

@ -285,7 +285,7 @@ static void * EHStatusHandlerThread(READER_CONTEXT * rContext)
if (rv == IFD_SUCCESS)
{
readerState = SCARD_PRESENT | SCARD_POWERED | SCARD_NEGOTIABLE;
rContext->powerState = POWER_STATE_POWERED;
RFSetPowerState(rContext, POWER_STATE_POWERED);
Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_POWERED");
if (rContext->readerState->cardAtrLength > 0)
@ -300,7 +300,7 @@ static void * EHStatusHandlerThread(READER_CONTEXT * rContext)
else
{
readerState = SCARD_PRESENT | SCARD_SWALLOWED;
rContext->powerState = POWER_STATE_UNPOWERED;
RFSetPowerState(rContext, POWER_STATE_UNPOWERED);
Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_UNPOWERED");
Log3(PCSC_LOG_ERROR, "Error powering up card: %ld 0x%04lX", rv, rv);
}
@ -383,7 +383,7 @@ static void * EHStatusHandlerThread(READER_CONTEXT * rContext)
rContext->readerState->cardAtrLength = 0;
rContext->readerState->cardProtocol = SCARD_PROTOCOL_UNDEFINED;
rContext->readerState->readerState = SCARD_PRESENT;
rContext->powerState = POWER_STATE_UNPOWERED;
RFSetPowerState(rContext, POWER_STATE_UNPOWERED);
Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_UNPOWERED");
rv = IFD_SUCCESS;
Log1(PCSC_LOG_INFO, "Skip card power on");
@ -402,13 +402,13 @@ static void * EHStatusHandlerThread(READER_CONTEXT * rContext)
if (rv == IFD_SUCCESS)
{
rContext->readerState->readerState = SCARD_PRESENT | SCARD_POWERED | SCARD_NEGOTIABLE;
rContext->powerState = POWER_STATE_POWERED;
RFSetPowerState(rContext, POWER_STATE_POWERED);
Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_POWERED");
}
else
{
rContext->readerState->readerState = SCARD_PRESENT | SCARD_SWALLOWED;
rContext->powerState = POWER_STATE_UNPOWERED;
RFSetPowerState(rContext, POWER_STATE_UNPOWERED);
Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_UNPOWERED");
rContext->readerState->cardAtrLength = 0;
}
@ -456,7 +456,7 @@ static void * EHStatusHandlerThread(READER_CONTEXT * rContext)
int timeout;
#ifndef DISABLE_ON_DEMAND_POWER_ON
if (POWER_STATE_POWERED == rContext->powerState)
if (POWER_STATE_POWERED == RFGetPowerState(rContext))
/* The card is powered but not yet used */
timeout = PCSCLITE_POWER_OFF_GRACE_PERIOD;
else

View File

@ -367,7 +367,7 @@ static void HPRemoveDevice(struct udev_device *dev)
Log4(PCSC_LOG_INFO, "Removing USB device[%d]: %s at %s", i,
readerTracker[i].fullName, readerTracker[i].devpath);
RFRemoveReader(readerTracker[i].fullName, PCSCLITE_HP_BASE_PORT + i);
RFRemoveReader(readerTracker[i].fullName, PCSCLITE_HP_BASE_PORT + i, REMOVE_READER_FLAG_REMOVED);
free(readerTracker[i].devpath);
readerTracker[i].devpath = NULL;

View File

@ -762,7 +762,7 @@ static LONG HPRemoveHotPluggable(int reader_index)
readerTracker[reader_index].bus_device);
RFRemoveReader(readerTracker[reader_index].fullName,
PCSCLITE_HP_BASE_PORT + reader_index);
PCSCLITE_HP_BASE_PORT + reader_index, REMOVE_READER_FLAG_REMOVED);
free(readerTracker[reader_index].fullName);
readerTracker[reader_index].status = READER_ABSENT;
readerTracker[reader_index].bus_device[0] = '\0';

View File

@ -1,472 +0,0 @@
/*
* MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
*
* Copyright (C) 2001-2003
* David Corcoran <corcoran@musclecard.com>
* Copyright (C) 2002-2011
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
* The USB code was based partly on Johannes Erdfelt
* libusb code found at libusb.sourceforge.net
*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* @brief This provides a search API for hot pluggble devices.
*/
#include "config.h"
#include <string.h>
#if defined(__linux__) && !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUDEV)
#include <sys/types.h>
#include <stdio.h>
#include <dirent.h>
#include <fcntl.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include "misc.h"
#include "pcsclite.h"
#include "pcscd.h"
#include "debuglog.h"
#include "parser.h"
#include "readerfactory.h"
#include "winscard_msg.h"
#include "sys_generic.h"
#include "hotplug.h"
#include "utils.h"
#undef DEBUG_HOTPLUG
#define PCSCLITE_USB_PATH "/proc/bus/usb"
#define FALSE 0
#define TRUE 1
pthread_mutex_t usbNotifierMutex;
struct usb_device_descriptor
{
u_int8_t bLength;
u_int8_t bDescriptorType;
u_int16_t bcdUSB;
u_int8_t bDeviceClass;
u_int8_t bDeviceSubClass;
u_int8_t bDeviceProtocol;
u_int8_t bMaxPacketSize0;
u_int16_t idVendor;
u_int16_t idProduct;
u_int16_t bcdDevice;
u_int8_t iManufacturer;
u_int8_t iProduct;
u_int8_t iSerialNumber;
u_int8_t bNumConfigurations;
}
__attribute__ ((packed));
static LONG HPAddHotPluggable(int, unsigned long);
static LONG HPRemoveHotPluggable(int, unsigned long);
static LONG HPReadBundleValues(void);
static void HPEstablishUSBNotifications(void);
static pthread_t usbNotifyThread;
static int AraKiriHotPlug = FALSE;
static int bundleSize = 0;
/**
* A list to keep track of 20 simultaneous readers
*/
static struct _bundleTracker
{
long manuID;
long productID;
struct _deviceNumber {
int id;
char status;
} deviceNumber[PCSCLITE_MAX_READERS_CONTEXTS];
char *bundleName;
char *libraryPath;
char *readerName;
}
bundleTracker[PCSCLITE_MAX_READERS_CONTEXTS];
static LONG HPReadBundleValues(void)
{
LONG rv;
DIR *hpDir;
struct dirent *currFP = 0;
char fullPath[FILENAME_MAX];
char fullLibPath[FILENAME_MAX];
unsigned int listCount = 0;
hpDir = opendir(PCSCLITE_HP_DROPDIR);
if (hpDir == NULL)
{
Log1(PCSC_LOG_INFO,
"Cannot open PC/SC drivers directory: " PCSCLITE_HP_DROPDIR);
Log1(PCSC_LOG_INFO, "Disabling USB support for pcscd.");
return -1;
}
#define GET_KEY(key, values) \
rv = LTPBundleFindValueWithKey(&plist, key, values); \
if (rv) \
{ \
Log2(PCSC_LOG_ERROR, "Value/Key not defined for " key " in %s", \
fullPath); \
continue; \
}
while ((currFP = readdir(hpDir)) != 0)
{
if (strstr(currFP->d_name, ".bundle") != 0)
{
unsigned int alias;
list_t plist, *values;
list_t *manuIDs, *productIDs, *readerNames;
char *libraryPath;
/*
* The bundle exists - let's form a full path name and get the
* vendor and product ID's for this particular bundle
*/
snprintf(fullPath, FILENAME_MAX, "%s/%s/Contents/Info.plist",
PCSCLITE_HP_DROPDIR, currFP->d_name);
fullPath[FILENAME_MAX - 1] = '\0';
rv = bundleParse(fullPath, &plist);
if (rv)
continue;
/* get CFBundleExecutable */
GET_KEY(PCSCLITE_HP_LIBRKEY_NAME, &values)
libraryPath = list_get_at(values, 0);
(void)snprintf(fullLibPath, sizeof(fullLibPath),
"%s/%s/Contents/%s/%s",
PCSCLITE_HP_DROPDIR, currFP->d_name, PCSC_ARCH,
libraryPath);
fullLibPath[sizeof(fullLibPath) - 1] = '\0';
GET_KEY(PCSCLITE_HP_CPCTKEY_NAME, &values)
GET_KEY(PCSCLITE_HP_MANUKEY_NAME, &manuIDs)
GET_KEY(PCSCLITE_HP_PRODKEY_NAME, &productIDs)
GET_KEY(PCSCLITE_HP_NAMEKEY_NAME, &readerNames)
/* while we find a nth ifdVendorID in Info.plist */
for (alias=0; alias<list_size(manuIDs); alias++)
{
char *value;
/* variables entries */
value = list_get_at(manuIDs, alias);
bundleTracker[listCount].manuID = strtol(value, NULL, 16);
value = list_get_at(productIDs, alias);
bundleTracker[listCount].productID = strtol(value, NULL, 16);
bundleTracker[listCount].readerName = strdup(list_get_at(readerNames, alias));
/* constant entries for a same driver */
bundleTracker[listCount].bundleName = strdup(currFP->d_name);
bundleTracker[listCount].libraryPath = strdup(fullLibPath);
#ifdef DEBUG_HOTPLUG
Log2(PCSC_LOG_INFO, "Found driver for: %s",
bundleTracker[listCount].readerName);
#endif
listCount++;
if (listCount >= COUNT_OF(bundleTracker))
{
Log2(PCSC_LOG_CRITICAL, "Too many readers declared. Maximum is %zd", COUNT_OF(bundleTracker));
goto end;
}
}
bundleRelease(&plist);
}
}
end:
bundleSize = listCount;
if (bundleSize == 0)
{
Log1(PCSC_LOG_INFO,
"No bundle files in pcsc drivers directory: " PCSCLITE_HP_DROPDIR);
Log1(PCSC_LOG_INFO, "Disabling USB support for pcscd");
}
closedir(hpDir);
return bundleSize;
}
static void HPEstablishUSBNotifications(void)
{
int i, j, usbDeviceStatus;
DIR *dir, *dirB;
struct dirent *entry, *entryB;
int deviceNumber;
int suspectDeviceNumber;
char dirpath[FILENAME_MAX];
char filename[FILENAME_MAX * 2];
int fd, ret;
struct usb_device_descriptor usbDescriptor;
usbDeviceStatus = 0;
suspectDeviceNumber = 0;
while (1)
{
for (i = 0; i < bundleSize; i++)
{
usbDeviceStatus = 0;
suspectDeviceNumber = 0;
for (j=0; j < PCSCLITE_MAX_READERS_CONTEXTS; j++)
/* clear rollcall */
bundleTracker[i].deviceNumber[j].status = 0;
dir = NULL;
dir = opendir(PCSCLITE_USB_PATH);
if (dir == NULL)
{
Log1(PCSC_LOG_ERROR,
"Cannot open USB path directory: " PCSCLITE_USB_PATH);
return;
}
entry = NULL;
while ((entry = readdir(dir)) != 0)
{
/*
* Skip anything starting with a
*/
if (entry->d_name[0] == '.')
continue;
if (!strchr("0123456789",
entry->d_name[strlen(entry->d_name) - 1]))
{
continue;
}
snprintf(dirpath, sizeof dirpath, "%s/%s",
PCSCLITE_USB_PATH, entry->d_name);
dirB = opendir(dirpath);
if (dirB == NULL)
{
Log2(PCSC_LOG_ERROR,
"USB path seems to have disappeared %s", dirpath);
closedir(dir);
return;
}
while ((entryB = readdir(dirB)) != NULL)
{
/*
* Skip anything starting with a
*/
if (entryB->d_name[0] == '.')
continue;
/* Get the device number so we can distinguish
multiple readers */
snprintf(filename, sizeof filename, "%s/%s",
dirpath, entryB->d_name);
deviceNumber = atoi(entryB->d_name);
fd = open(filename, O_RDONLY);
if (fd < 0)
continue;
ret = read(fd, (void *) &usbDescriptor,
sizeof(usbDescriptor));
close(fd);
if (ret < 0)
continue;
/*
* Device is found and we don't know about it
*/
if (usbDescriptor.idVendor == bundleTracker[i].manuID &&
usbDescriptor.idProduct == bundleTracker[i].productID &&
usbDescriptor.idVendor !=0 &&
usbDescriptor.idProduct != 0)
{
for (j=0; j < PCSCLITE_MAX_READERS_CONTEXTS; j++)
{
if (bundleTracker[i].deviceNumber[j].id == deviceNumber &&
bundleTracker[i].deviceNumber[j].id != 0)
{
bundleTracker[i].deviceNumber[j].status = 1; /* i'm here */
break;
}
}
if (j == PCSCLITE_MAX_READERS_CONTEXTS)
{
usbDeviceStatus = 1;
suspectDeviceNumber = deviceNumber;
}
}
} /* End of while */
closedir(dirB);
} /* End of while */
if (usbDeviceStatus == 1)
{
pthread_mutex_lock(&usbNotifierMutex);
for (j=0; j < PCSCLITE_MAX_READERS_CONTEXTS; j++)
{
if (bundleTracker[i].deviceNumber[j].id == 0)
break;
}
if (j == PCSCLITE_MAX_READERS_CONTEXTS)
Log1(PCSC_LOG_ERROR,
"Too many identical readers plugged in");
else
{
HPAddHotPluggable(i, j+1);
bundleTracker[i].deviceNumber[j].id = suspectDeviceNumber;
}
pthread_mutex_unlock(&usbNotifierMutex);
}
else
if (usbDeviceStatus == 0)
{
for (j=0; j < PCSCLITE_MAX_READERS_CONTEXTS; j++)
{
if (bundleTracker[i].deviceNumber[j].id != 0 &&
bundleTracker[i].deviceNumber[j].status == 0)
{
pthread_mutex_lock(&usbNotifierMutex);
HPRemoveHotPluggable(i, j+1);
bundleTracker[i].deviceNumber[j].id = 0;
pthread_mutex_unlock(&usbNotifierMutex);
}
}
}
else
{
/*
* Do nothing - no USB devices found
*/
}
if (dir)
closedir(dir);
} /* End of for..loop */
SYS_Sleep(1);
if (AraKiriHotPlug)
{
int retval;
Log1(PCSC_LOG_INFO, "Hotplug stopped");
pthread_exit(&retval);
}
} /* End of while loop */
}
LONG HPSearchHotPluggables(void)
{
int i, j;
for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
{
bundleTracker[i].productID = 0;
bundleTracker[i].manuID = 0;
for (j=0; j < PCSCLITE_MAX_READERS_CONTEXTS; j++)
bundleTracker[i].deviceNumber[j].id = 0;
}
if (HPReadBundleValues() > 0)
ThreadCreate(&usbNotifyThread, THREAD_ATTR_DETACHED,
(PCSCLITE_THREAD_FUNCTION( )) HPEstablishUSBNotifications, 0);
return 0;
}
LONG HPStopHotPluggables(void)
{
AraKiriHotPlug = TRUE;
return 0;
}
static LONG HPAddHotPluggable(int i, unsigned long usbAddr)
{
/* NOTE: The deviceName is an empty string "" until someone implements
* the code to get it */
RFAddReader(bundleTracker[i].readerName, PCSCLITE_HP_BASE_PORT + usbAddr,
bundleTracker[i].libraryPath, "");
return 1;
} /* End of function */
static LONG HPRemoveHotPluggable(int i, unsigned long usbAddr)
{
RFRemoveReader(bundleTracker[i].readerName, PCSCLITE_HP_BASE_PORT + usbAddr);
return 1;
} /* End of function */
/**
* Sets up callbacks for device hotplug events.
*/
ULONG HPRegisterForHotplugEvents(void)
{
(void)pthread_mutex_init(&usbNotifierMutex, NULL);
return 0;
}
void HPReCheckSerialReaders(void)
{
}
#endif /* __linux__ && !HAVE_LIBUSB */

View File

@ -818,7 +818,8 @@ static int HPScan(void)
if (!found)
{
RFRemoveReader(a->m_driver->m_friendlyName,
PCSCLITE_HP_BASE_PORT + a->m_address);
PCSCLITE_HP_BASE_PORT + a->m_address,
REMOVE_READER_FLAG_REMOVED);
}
}

View File

@ -49,7 +49,7 @@
#define PCSCLITE_CSOCK_NAME PCSCLITE_IPC_DIR "/pcscd.comm"
#define PCSCLITE_VERSION_NUMBER "1.9.4" /**< Current version */
#define PCSCLITE_VERSION_NUMBER "1.9.5" /**< Current version */
#define PCSCLITE_STATUS_POLL_RATE 400000 /**< Status polling rate */
#define PCSCLITE_LOCK_POLL_RATE 100000 /**< Lock polling rate */

View File

@ -700,7 +700,7 @@ int main(int argc, char **argv)
}
/*
* post initialistion
* post initialization
*/
Init = FALSE;
@ -738,7 +738,7 @@ int main(int argc, char **argv)
(void)signal(SIGPIPE, SIG_IGN);
(void)signal(SIGHUP, SIG_IGN); /* needed for Solaris. The signal is sent
* when the shell is existed */
* when the shell is exited */
#if !defined(PCSCLITE_STATIC_DRIVER) && defined(USE_USB)
/*
@ -760,7 +760,7 @@ int main(int argc, char **argv)
RFWaitForReaderInit();
#endif
/* initialisation succeeded */
/* initialization succeeded */
if (pipefd[1] >= 0)
{
char buf = 0;
@ -776,6 +776,13 @@ int main(int argc, char **argv)
pipefd[1] = -1;
}
if (AutoExit)
{
Log2(PCSC_LOG_DEBUG, "Starting suicide alarm in %d seconds",
TIME_BEFORE_SUICIDE);
alarm(TIME_BEFORE_SUICIDE);
}
SVCServiceRunLoop();
Log1(PCSC_LOG_ERROR, "SVCServiceRunLoop returned");

View File

@ -378,7 +378,7 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
/* Cannot connect to reader. Exit gracefully */
Log2(log_level, "%s init failed.", readerName);
(void)RFRemoveReader(readerName, port);
(void)RFRemoveReader(readerName, port, REMOVE_READER_NO_FLAG);
return rv;
}
@ -404,7 +404,7 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
if (rv != SCARD_S_SUCCESS)
{
Log2(PCSC_LOG_ERROR, "%s init failed.", readerName);
(void)RFRemoveReader(readerName, port);
(void)RFRemoveReader(readerName, port, REMOVE_READER_NO_FLAG);
return rv;
}
}
@ -449,7 +449,7 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
if (i == PCSCLITE_MAX_READERS_CONTEXTS)
{
/* No more slot left return */
RFRemoveReader(readerName, port);
RFRemoveReader(readerName, port, REMOVE_READER_NO_FLAG);
return SCARD_E_NO_MEMORY;
}
@ -548,7 +548,7 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
if (rv != SCARD_S_SUCCESS)
{
/* Cannot connect to slot. Exit gracefully */
(void)RFRemoveReader(readerName, port);
(void)RFRemoveReader(readerName, port, REMOVE_READER_NO_FLAG);
return rv;
}
@ -571,7 +571,7 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
if (rv != SCARD_S_SUCCESS)
{
Log2(PCSC_LOG_ERROR, "%s init failed.", readerName);
(void)RFRemoveReader(readerName, port);
(void)RFRemoveReader(readerName, port, REMOVE_READER_NO_FLAG);
return rv;
}
}
@ -579,7 +579,7 @@ LONG RFAddReader(const char *readerNameLong, int port, const char *library,
return SCARD_S_SUCCESS;
}
LONG RFRemoveReader(const char *readerName, int port)
LONG RFRemoveReader(const char *readerName, int port, int flags)
{
char lpcStripReader[MAX_READERNAME];
int i;
@ -610,6 +610,24 @@ LONG RFRemoveReader(const char *readerName, int port)
if ((strncmp(readerName, lpcStripReader, MAX_READERNAME - sizeof(" 00 00")) == 0)
&& (port == sReadersContexts[i]->port))
{
if (flags & REMOVE_READER_FLAG_REMOVED)
{
UCHAR tagValue[1];
DWORD valueLength;
LONG ret;
/* signal to the driver that the reader has been removed */
valueLength = sizeof(tagValue);
ret = IFDGetCapabilities(sReadersContexts[i],
TAG_IFD_DEVICE_REMOVED, &valueLength, tagValue);
if ((IFD_SUCCESS) == ret && (1 == tagValue[0]))
{
tagValue[0] = 1;
ret = IFDSetCapabilities(sReadersContexts[i],
TAG_IFD_DEVICE_REMOVED, sizeof tagValue, tagValue);
}
}
/* remove the reader */
UNREF_READER(sReadersContexts[i])
}
@ -1375,7 +1393,8 @@ void RFCleanupReaders(void)
/* strip the 6 last char ' 00 00' */
lpcStripReader[strlen(lpcStripReader) - 6] = '\0';
rv = RFRemoveReader(lpcStripReader, sReadersContexts[i]->port);
rv = RFRemoveReader(lpcStripReader, sReadersContexts[i]->port,
REMOVE_READER_NO_FLAG);
if (rv != SCARD_S_SUCCESS)
Log2(PCSC_LOG_ERROR, "RFRemoveReader error: 0x%08lX", rv);
@ -1542,7 +1561,7 @@ void RFReCheckReaderConf(void)
Log2(PCSC_LOG_INFO, "Reader %s disappeared",
reader_list[i].pcFriendlyname);
(void)RFRemoveReader(reader_list[i].pcFriendlyname,
reader_list[r].channelId);
reader_list[r].channelId, REMOVE_READER_NO_FLAG);
}
}
}
@ -1564,3 +1583,18 @@ void RFReCheckReaderConf(void)
}
#endif
int RFGetPowerState(READER_CONTEXT * rContext)
{
(void)pthread_mutex_lock(&rContext->powerState_lock);
int result = rContext->powerState;
(void)pthread_mutex_unlock(&rContext->powerState_lock);
return result;
}
void RFSetPowerState(READER_CONTEXT * rContext, int value)
{
(void)pthread_mutex_lock(&rContext->powerState_lock);
rContext->powerState = value;
(void)pthread_mutex_unlock(&rContext->powerState_lock);
}

View File

@ -148,7 +148,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LONG RFAllocateReaderSpace(unsigned int);
LONG RFAddReader(const char *, int, const char *, const char *);
LONG RFRemoveReader(const char *, int);
LONG RFRemoveReader(const char *, int, int);
LONG RFSetReaderName(READER_CONTEXT *, const char *, const char *, int);
LONG RFReaderInfo(const char *, /*@out@*/ struct ReaderContext **);
LONG RFReaderInfoById(SCARDHANDLE, /*@out@*/ struct ReaderContext **);
@ -173,5 +173,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void RFWaitForReaderInit(void);
int RFStartSerialReaders(const char *readerconf);
void RFReCheckReaderConf(void);
int RFGetPowerState(READER_CONTEXT *);
void RFSetPowerState(READER_CONTEXT *, int value);
#define REMOVE_READER_NO_FLAG 0
#define REMOVE_READER_FLAG_REMOVED 1
#endif

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.

View File

@ -715,10 +715,8 @@ LONG SCardReconnect(SCARDHANDLE hCard, DWORD dwShareMode,
}
/* the card is now in use */
(void)pthread_mutex_lock(&rContext->powerState_lock);
rContext->powerState = POWER_STATE_IN_USE;
RFSetPowerState(rContext, POWER_STATE_IN_USE);
Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_IN_USE");
(void)pthread_mutex_unlock(&rContext->powerState_lock);
}
}
@ -900,7 +898,7 @@ LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition)
/* SCARD_UNPOWER_CARD */
rv = IFDPowerICC(rContext, IFD_POWER_DOWN, NULL, NULL);
rContext->powerState = POWER_STATE_UNPOWERED;
RFSetPowerState(rContext, POWER_STATE_UNPOWERED);
Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_UNPOWERED");
}