在windows平台上可以直接使用windows自带的wincard库,在linux平台上需要安装第三方开源包pcsclite
1、首先需要下载PCSC代码
Ludovic Rousseau / PCSC · GitLab
有不同的版本,注意服务端和客户端要保持版本一致,不然会提示错误
这里用1.8.10版本
#define PROTOCOL_VERSION_MAJOR 4
/** Minor version of the current message protocol */
#define PROTOCOL_VERSION_MINOR 3git checkout 1.8.10
2、下载CCID
git clone --recurse-submodules Ludovic Rousseau / CCID · GitLab
git checkout 1.4.36
cd m4
ln -s ../PCSC/m4/ax_pthread.m4 ax_pthread.m4
ln -s ../PCSC/m4/as-ac-expand.m4 as-ac-expand.m4
不然编译会报错configure.ac:45: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:139: error: possibly undefined macro: AC_DEFINE
+ automake --add-missing --copy --force --foreign
以下这个配置文件很关键,pcscd进程需要这个配置文件
src/Info.plist.src
需要安装的包有
sudo apt-get install automake libtool flex libudev libusb-dev autoconf m4 libsystemd-dev g++ pkg-config
开源库的官方文档地址: