From c1a70338a70d72b470c18c280b41cf6bc84b5ec0 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Wed, 20 Nov 2024 16:19:18 +0800 Subject: [PATCH 1/2] adopt to new cmake macro --- kiran-authentication-devices.spec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kiran-authentication-devices.spec b/kiran-authentication-devices.spec index 627aa85..c5a2b5e 100644 --- a/kiran-authentication-devices.spec +++ b/kiran-authentication-devices.spec @@ -1,7 +1,7 @@ Name: kiran-authentication-devices Version: 2.5.2 -Release: 3 +Release: 4 Summary: Kiran Authentication Devices License: MulanPSL-2.0 @@ -22,8 +22,8 @@ BuildRequires: kiran-log-qt5-devel BuildRequires: systemd-devel Requires: qt5-qtbase Requires: kiran-log-qt5 -Requires: systemd Requires: libusb +%{?systemd_requires} %description Manage authentication devices @@ -40,10 +40,10 @@ Development files for kiran authentication devices %build %cmake -make %{?_smp_mflags} +%cmake_build %install -%make_install +%cmake_install %post %systemd_post kiran-authentication-devices.service @@ -67,10 +67,10 @@ systemctl enable kiran-authentication-devices.service %files devel %{_includedir}/kiran-authentication-devices/kiran-auth-device-i.h -%clean -rm -rf ${buildroot} - %changelog +* Wed Nov 20 2024 Funda Wang - 2.5.2-4 +- adopt to new cmake macro + * Thu Jan 18 2024 luoqing - 2.5.2-3 - KYOS-B: Fixed a crash caused by repeatedly calling disConnectDev in resetUkey and destructor to release the same device handle - KYOS-R: Modify the code according to the https://gitee.com/openeuler/kiran-authentication-devices/pulls/17 review opinions -- Gitee From 935ac42fabc43599ac8b13fd9ba3e3d9fba2c348 Mon Sep 17 00:00:00 2001 From: liuxinhao Date: Thu, 3 Apr 2025 11:09:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=8C=87=E7=BA=B9=E4=BB=AA,=E5=88=A0=E9=99=A4=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E7=9A=84link=E7=9B=AE=E5=BD=95,=E7=A7=BB=E9=99=A4rpat?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tication-devices-fix-QUuid-WithoutBr.patch | 0 ...-Fixed-a-crash-caused-by-repeatedly-.patch | 6 +- ...the-code-according-to-the-https-gite.patch | 6 +- ...river-when-the-iris-face-integrated-.patch | 6 +- ...ver-is-enabled-the-device-is-scanned.patch | 6 +- ...ix-build-fix-file-install-path-error.patch | 6 +- ...table-for-zhi-ang-fingerprint-device.patch | 1232 +++++++++++++++++ ...-blank-cmake_target_link_directories.patch | 30 + README.en.md | 36 - README.md | 37 - kiran-authentication-devices.spec | 71 +- kiran-authentication-devices.yaml | 4 - 12 files changed, 1324 insertions(+), 116 deletions(-) rename 0001-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch => 0000-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch (100%) rename 0002-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch => 0001-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch (86%) rename 0003-refactor-Modify-the-code-according-to-the-https-gite.patch => 0002-refactor-Modify-the-code-according-to-the-https-gite.patch (99%) rename 0004-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch => 0003-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch (97%) rename 0005-fix-When-the-driver-is-enabled-the-device-is-scanned.patch => 0004-fix-When-the-driver-is-enabled-the-device-is-scanned.patch (99%) rename 0006-fix-build-fix-file-install-path-error.patch => 0005-fix-build-fix-file-install-path-error.patch (85%) create mode 100644 0006-feature-suitable-for-zhi-ang-fingerprint-device.patch create mode 100644 0007-fix-build-delete-blank-cmake_target_link_directories.patch delete mode 100644 README.en.md delete mode 100644 README.md delete mode 100644 kiran-authentication-devices.yaml diff --git a/0001-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch b/0000-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch similarity index 100% rename from 0001-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch rename to 0000-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch diff --git a/0002-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch b/0001-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch similarity index 86% rename from 0002-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch rename to 0001-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch index 43110c7..e12e39d 100644 --- a/0002-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch +++ b/0001-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch @@ -1,7 +1,7 @@ -From 5b329ca4e7610efb23b7077d5af201290bd3fb61 Mon Sep 17 00:00:00 2001 +From e277652ae0d4912a6ba53b6d834010c90840d452 Mon Sep 17 00:00:00 2001 From: luoqing Date: Mon, 3 Jul 2023 16:41:09 +0800 -Subject: [PATCH 2/6] fix(ukey-manager):Fixed a crash caused by repeatedly +Subject: [PATCH 1/5] fix(ukey-manager):Fixed a crash caused by repeatedly calling disConnectDev in resetUkey and destructor to release the same device handle MIME-Version: 1.0 @@ -26,5 +26,5 @@ index 30cd23a..d815d72 100644 } -- -2.33.0 +2.27.0 diff --git a/0003-refactor-Modify-the-code-according-to-the-https-gite.patch b/0002-refactor-Modify-the-code-according-to-the-https-gite.patch similarity index 99% rename from 0003-refactor-Modify-the-code-according-to-the-https-gite.patch rename to 0002-refactor-Modify-the-code-according-to-the-https-gite.patch index f0a0164..ca0059e 100644 --- a/0003-refactor-Modify-the-code-according-to-the-https-gite.patch +++ b/0002-refactor-Modify-the-code-according-to-the-https-gite.patch @@ -1,7 +1,7 @@ -From fe1104186ef3fe8978b75b01960cd147c99665bf Mon Sep 17 00:00:00 2001 +From c52e7df03524248d5c31d858aca54cf47709eee4 Mon Sep 17 00:00:00 2001 From: luoqing Date: Thu, 6 Jul 2023 14:41:24 +0800 -Subject: [PATCH 3/6] refactor(*):Modify the code according to the +Subject: [PATCH 2/5] refactor(*):Modify the code according to the https://gitee.com/openeuler/kiran-authentication-devices/pulls/17 review opinions MIME-Version: 1.0 @@ -1748,5 +1748,5 @@ index d815d72..8a4e86e 100644 #define DEFAULT_USER_PINCODE "12345678" -- -2.33.0 +2.27.0 diff --git a/0004-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch b/0003-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch similarity index 97% rename from 0004-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch rename to 0003-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch index e089fe9..ef88dc4 100644 --- a/0004-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch +++ b/0003-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch @@ -1,7 +1,7 @@ -From 444f3d097fa42fbfde53004ffe0404bb31313bac Mon Sep 17 00:00:00 2001 +From f63319629dabb6c8eb827726003b41ca105fe7f4 Mon Sep 17 00:00:00 2001 From: luoqing Date: Tue, 16 Jan 2024 11:57:08 +0800 -Subject: [PATCH 4/6] fix(mf-iristar-driver):when the iris face integrated +Subject: [PATCH 3/5] fix(mf-iristar-driver):when the iris face integrated device is removed, the memory cannot be released and the process is blocked.When the face iris device object is removed, restart the service to release resources @@ -96,5 +96,5 @@ index 7c11d43..f65af2d 100644 bool MFIriStarDriver::initDriver(const QString &libPath) -- -2.33.0 +2.27.0 diff --git a/0005-fix-When-the-driver-is-enabled-the-device-is-scanned.patch b/0004-fix-When-the-driver-is-enabled-the-device-is-scanned.patch similarity index 99% rename from 0005-fix-When-the-driver-is-enabled-the-device-is-scanned.patch rename to 0004-fix-When-the-driver-is-enabled-the-device-is-scanned.patch index 9d81dbb..5c93a8f 100644 --- a/0005-fix-When-the-driver-is-enabled-the-device-is-scanned.patch +++ b/0004-fix-When-the-driver-is-enabled-the-device-is-scanned.patch @@ -1,7 +1,7 @@ -From eb1053adb52785aa02992690d5444d4068e0e780 Mon Sep 17 00:00:00 2001 +From 19a5b7d787bf31acdc1b62fa1c0ac3e1ffb7d1e7 Mon Sep 17 00:00:00 2001 From: luoqing Date: Wed, 17 Jan 2024 16:32:34 +0800 -Subject: [PATCH 5/6] fix(*):When the driver is enabled, the device is scanned +Subject: [PATCH 4/5] fix(*):When the driver is enabled, the device is scanned and the corresponding device object is created.When the driver is disabled,the corresponding device object is released. MIME-Version: 1.0 @@ -382,5 +382,5 @@ index 1c28065..9ba5598 100644 } // namespace Utils } // namespace Kiran -- -2.33.0 +2.27.0 diff --git a/0006-fix-build-fix-file-install-path-error.patch b/0005-fix-build-fix-file-install-path-error.patch similarity index 85% rename from 0006-fix-build-fix-file-install-path-error.patch rename to 0005-fix-build-fix-file-install-path-error.patch index 06239db..c0ba734 100644 --- a/0006-fix-build-fix-file-install-path-error.patch +++ b/0005-fix-build-fix-file-install-path-error.patch @@ -1,7 +1,7 @@ -From a0488124de99b326d9abc38228251146ed6cdc6d Mon Sep 17 00:00:00 2001 +From 01f6c341615f5f28f8d058e78431d5fe13c221a3 Mon Sep 17 00:00:00 2001 From: luoqing Date: Thu, 18 Jan 2024 11:25:40 +0800 -Subject: [PATCH 6/6] fix(build):fix file install path error +Subject: [PATCH 5/5] fix(build):fix file install path error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -25,5 +25,5 @@ index 617cd14..a6ae20b 100644 configure_file(kiran-authentication-devices.service.in -- -2.33.0 +2.27.0 diff --git a/0006-feature-suitable-for-zhi-ang-fingerprint-device.patch b/0006-feature-suitable-for-zhi-ang-fingerprint-device.patch new file mode 100644 index 0000000..492ec3e --- /dev/null +++ b/0006-feature-suitable-for-zhi-ang-fingerprint-device.patch @@ -0,0 +1,1232 @@ +From 6baa35646e49f42e39c3952467860a8c87720b6c Mon Sep 17 00:00:00 2001 +From: luoqing +Date: Fri, 2 Feb 2024 15:17:08 +0800 +Subject: [PATCH] feature(*):suitable for zhi ang fingerprint device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 适配深圳指昂指纹仪设备 + +Close #24532 +--- + data/device.conf | 8 +- + data/driver.conf | 6 +- + include/SYProtocol.h | 85 +++++ + include/auth-enum.h | 1 + + src/CMakeLists.txt | 3 +- + src/device/bio-device.cpp | 49 ++- + src/device/bio-device.h | 9 +- + src/device/finger-vein/fv-sd-device.cpp | 8 +- + src/device/finger-vein/fv-sd-device.h | 4 +- + src/device/fingerprint/fp-za-device.cpp | 251 +++++++++++++++ + src/device/fingerprint/fp-za-device.h | 53 ++++ + src/device/fingerprint/fp-zk-device.cpp | 21 +- + src/device/fingerprint/fp-zk-device.h | 6 +- + src/driver/fingerprint/fp-za-driver.cpp | 402 ++++++++++++++++++++++++ + src/driver/fingerprint/fp-za-driver.h | 53 ++++ + 15 files changed, 912 insertions(+), 47 deletions(-) + create mode 100644 include/SYProtocol.h + create mode 100644 src/device/fingerprint/fp-za-device.cpp + create mode 100644 src/device/fingerprint/fp-za-device.h + create mode 100644 src/driver/fingerprint/fp-za-driver.cpp + create mode 100644 src/driver/fingerprint/fp-za-driver.h + +diff --git a/data/device.conf b/data/device.conf +index 6d7d83b..7e15744 100644 +--- a/data/device.conf ++++ b/data/device.conf +@@ -39,4 +39,10 @@ Driver=ukey-skf-ft + Name=YuWeng UKey + Type=5 + Id=4612:04b4 +-Driver=ukey-skf-fish +\ No newline at end of file ++Driver=ukey-skf-fish ++ ++[ZhiAng] ++Name=ZhiAng ++Type=0 ++Id=2109:7638 ++Driver=zaz +\ No newline at end of file +diff --git a/data/driver.conf b/data/driver.conf +index 135d592..5bf0719 100644 +--- a/data/driver.conf ++++ b/data/driver.conf +@@ -26,4 +26,8 @@ LibPath=/usr/lib64/kiran-authentication-devices-sdk/ukey/skf/libes_3000gm.so + [ukey-skf-fish] + Enable=true + Type=5 +-LibPath=/usr/lib64/kiran-authentication-devices-sdk/ukey/skf/libGDBapi.so +\ No newline at end of file ++LibPath=/usr/lib64/kiran-authentication-devices-sdk/ukey/skf/libGDBapi.so ++ ++[zaz] ++Enable=true ++Type=0 +\ No newline at end of file +diff --git a/include/SYProtocol.h b/include/SYProtocol.h +new file mode 100644 +index 0000000..0a9f9f6 +--- /dev/null ++++ b/include/SYProtocol.h +@@ -0,0 +1,85 @@ ++#ifndef _SYPROTOCOL_H_ ++#define _SYPROTOCOL_H_ ++ ++#define HANDLE int ++ ++ ++////////////////////////////////////// ++#define ZAZ_OK 0x00 // 执行成功 ++#define ZAZ_COMM_ERR 0x01 // 数据包接收错误 ++#define ZAZ_NO_FINGER 0x02 // 传感器上没有手指 ++#define ZAZ_GET_IMG_ERR 0x03 // 录入指纹图象失败 ++#define ZAZ_FP_TOO_DRY 0x04 // 指纹太淡 ++#define ZAZ_FP_TOO_WET 0x05 // 指纹太糊 ++#define ZAZ_FP_DISORDER 0x06 // 指纹太乱 ++#define ZAZ_LITTLE_FEATURE 0x07 // 指纹特征点太少 ++#define ZAZ_NOT_MATCH 0x08 // 指纹不匹配 ++#define ZAZ_NOT_SEARCHED 0x09 // 没搜索到指纹 ++#define ZAZ_MERGE_ERR 0x0a // 特征合并失败 ++#define ZAZ_ADDRESS_OVER 0x0b // 地址号超出指纹库范围 ++#define ZAZ_READ_ERR 0x0c // 从指纹库读模板出错 ++#define ZAZ_UP_TEMP_ERR 0x0d // 上传特征失败 ++#define ZAZ_RECV_ERR 0x0e // 模块不能接收后续数据包 ++#define ZAZ_UP_IMG_ERR 0x0f // 上传图象失败 ++#define ZAZ_DEL_TEMP_ERR 0x10 // 删除模板失败 ++#define ZAZ_CLEAR_TEMP_ERR 0x11 // 清空指纹库失败 ++#define ZAZ_SLEEP_ERR 0x12 // 不能进入休眠 ++#define ZAZ_INVALID_PASSWORD 0x13 // 口令不正确 ++#define ZAZ_RESET_ERR 0x14 // 系统复位失败 ++#define ZAZ_INVALID_IMAGE 0x15 // 无效指纹图象 ++#define ZAZ_HANGOVER_UNREMOVE 0X17 ++ ++ ++///////////////////////////////////////////// ++#define CHAR_BUFFER_A 0x01 ++#define CHAR_BUFFER_B 0x02 ++#define MODEL_BUFFER 0x03 ++ ++///////////////// ++#define COM1 0x01 ++#define COM2 0x02 ++#define COM3 0x03 ++ ++///////////////////////////////////////// ++#define BAUD_RATE_9600 0x00 ++#define BAUD_RATE_19200 0x01 ++#define BAUD_RATE_38400 0x02 ++#define BAUD_RATE_57600 0x03 //default ++#define BAUD_RATE_115200 0x04 ++ ++ ++typedef unsigned char BYTE; ++ ++///////////////////////////////////////// ++ ++//参数fptype ++#define fp_602 1 ++#define fp_606 2 ++#define fp_608 3 ++#define fp_xbt 4 ++#define fp_fl 5 ++#define fp_kvm 6 ++ ++ ++//参数path ++#define path_proc 0 //表示usb路径:/proc/bus/usb ++#define path_dev 1 //表示usb路径:/dev/bus/usb ++ ++#define path_pc 1 ++#define path_arm 0 ++ ++ ++#define FP_ZA_DRIVER_LIB "libzaz.so" ++#define FP_ZA_DRIVER_LIB_MATCH "libzamatch.so" ++#define FP_ZA_MEGER_TEMPLATE_COUNT 2 ++ ++#define DEVICE_USB 0 ++#define DEVICE_COM 1 ++#define DEVICE_UDisk 2 ++ ++#define IMAGE_X 256 ++#define IMAGE_Y 360 ++ ++#define DEV_ADDR 0xffffffff ++#endif ++ +diff --git a/include/auth-enum.h b/include/auth-enum.h +index 1b663cd..61667b6 100644 +--- a/include/auth-enum.h ++++ b/include/auth-enum.h +@@ -29,6 +29,7 @@ namespace Kiran + #define IRISTAR_DRIVER_NAME "irs_sdk2" + #define FINGERPRINT_ZK_DRIVER_NAME "zkfp" + #define FINGER_VEIN_SD_DRIVER_NAME "sdfv" ++#define FINGERPRINT_ZA_DRIVER_NAME "zaz" + + struct DeviceInfo + { +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a7cc8b7..b5729e5 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -24,7 +24,8 @@ qt5_add_dbus_adaptor( + set(DEVICE_SDK ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}-sdk) + + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +-set(CMAKE_INSTALL_RPATH ${DEVICE_SDK}/finger-vein/sd:${DEVICE_SDK}/fingerprint/zk:${DEVICE_SDK}/ukey/skf:${DEVICE_SDK}/multi-function/iristar) ++set(CMAKE_INSTALL_RPATH ${DEVICE_SDK}/finger-vein/sd:${DEVICE_SDK}/fingerprint/zk:${DEVICE_SDK}/ukey/skf:${DEVICE_SDK}/multi-function/iristar ++ :${DEVICE_SDK}/fingerprint/zhiang) + + + set(TS_FILES "${PROJECT_SOURCE_DIR}/translations/${PROJECT_NAME}.zh_CN.ts") +diff --git a/src/device/bio-device.cpp b/src/device/bio-device.cpp +index 841d48c..3190211 100644 +--- a/src/device/bio-device.cpp ++++ b/src/device/bio-device.cpp +@@ -46,6 +46,8 @@ void BioDevice::doingEnrollStart(const QString &extraInfo) + return; + } + m_doAcquire = true; ++ openBioDevice(); ++ + auto future = QtConcurrent::run(this, &BioDevice::acquireFeature); + m_futureWatcher->setFuture(future); + +@@ -69,6 +71,7 @@ void BioDevice::doingIdentifyStart(const QString &value) + { + KLOG_DEBUG() << "biological information identify start"; + m_doAcquire = true; ++ openBioDevice(); + auto future = QtConcurrent::run(this, &BioDevice::acquireFeature); + m_futureWatcher->setFuture(future); + +@@ -104,26 +107,29 @@ void BioDevice::doingEnrollProcess(QByteArray feature) + notifyEnrollProcess(ENROLL_PROCESS_REPEATED_ENROLL, featureID); + internalStopEnroll(); + } ++ return; + } +- else if (templatesCount < mergeTemplateCount()) ++ ++ // 判断录入时是否录的是同一根手指 ++ int matchResult = templateMatch(m_enrollTemplates.value(0), feature); ++ ++ if (matchResult != GENERAL_RESULT_OK) + { +- // 判断录入时是否录的是同一根手指 +- int matchResult = enrollTemplateMatch(m_enrollTemplates.value(0), feature); +- if (matchResult == GENERAL_RESULT_OK) +- { +- saveEnrollTemplateToCache(feature); +- } +- else +- { +- notifyEnrollProcess(ENROLL_PROCESS_INCONSISTENT_FEATURE); +- } ++ notifyEnrollProcess(ENROLL_PROCESS_INCONSISTENT_FEATURE); + enrollProcessRetry(); ++ return; + } +- else if (enrollTemplatesFromCache().count() == mergeTemplateCount()) ++ ++ saveEnrollTemplateToCache(feature); ++ ++ if (enrollTemplatesFromCache().count() != mergeTemplateCount()) + { +- enrollTemplateMerge(); +- internalStopEnroll(); ++ enrollProcessRetry(); ++ return; + } ++ ++ templateMerge(); ++ internalStopEnroll(); + } + + void BioDevice::doingIdentifyProcess(QByteArray feature) +@@ -185,9 +191,24 @@ void BioDevice::saveEnrollTemplateToCache(QByteArray enrollTemplate) + } + } + ++int BioDevice::openBioDevice() ++{ ++ return 0; ++} ++ ++bool BioDevice::saveTemplate(QByteArray &featureTemplate, const QString &featureID) ++{ ++ bool save = FeatureDB::getInstance()->addFeature(featureID, featureTemplate, deviceInfo(), deviceType()); ++ return save; ++} ++ + void BioDevice::deviceStopEnroll() + { + acquireFeatureStop(); ++ if (!m_futureWatcher.isNull()) ++ { ++ m_futureWatcher->waitForFinished(); ++ } + m_enrollTemplates.clear(); + } + +diff --git a/src/device/bio-device.h b/src/device/bio-device.h +index 4c05923..b43f7c3 100644 +--- a/src/device/bio-device.h ++++ b/src/device/bio-device.h +@@ -31,8 +31,9 @@ protected: + virtual void acquireFeatureFail() = 0; + virtual QString identifyFeature(QByteArray feature, QList existedfeatures) = 0; + +- virtual void enrollTemplateMerge(){}; +- virtual int enrollTemplateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) { return GENERAL_RESULT_OK; }; ++ virtual void templateMerge(){}; ++ // 特征/模板一对一匹配 ++ virtual int templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) { return GENERAL_RESULT_OK; }; + + virtual void deviceStopEnroll() override; + virtual void deviceStopIdentify() override; +@@ -45,6 +46,10 @@ protected: + QByteArrayList enrollTemplatesFromCache(); + virtual void saveEnrollTemplateToCache(QByteArray enrollTemplate); + ++ // TODO:名称不太合适,需要优化 ++ virtual int openBioDevice(); ++ bool saveTemplate(QByteArray &featureTemplate, const QString &featureID); ++ + private Q_SLOTS: + void handleAcquiredFeature(); + +diff --git a/src/device/finger-vein/fv-sd-device.cpp b/src/device/finger-vein/fv-sd-device.cpp +index 80ca4be..8c0454a 100644 +--- a/src/device/finger-vein/fv-sd-device.cpp ++++ b/src/device/finger-vein/fv-sd-device.cpp +@@ -152,10 +152,6 @@ QByteArray FVSDDevice::acquireFeature() + void FVSDDevice::acquireFeatureStop() + { + m_driver->TGCancelGetImage(); +- if (!m_futureWatcher.isNull()) +- { +- m_futureWatcher->waitForFinished(); +- } + } + + void FVSDDevice::acquireFeatureFail() +@@ -199,7 +195,7 @@ void FVSDDevice::saveEnrollTemplateToCache(QByteArray image) + * NOTE:短时间内播放两次声音,前一次未结束的话,会被后面的声音覆盖 + * 重复录入的声音 会被 下一次录入的播放声音覆盖 + */ +-void FVSDDevice::enrollTemplateMerge() ++void FVSDDevice::templateMerge() + { + QByteArray multiFeature; + Q_FOREACH (auto enrollTemplate, m_enrollTemplates) +@@ -316,7 +312,7 @@ QByteArray FVSDDevice::getFeatureFromImage(QByteArray image, ExtractFeatureMode + return QByteArray(); + } + +-int FVSDDevice::enrollTemplateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) ++int FVSDDevice::templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) + { + /** + * NOTE: +diff --git a/src/device/finger-vein/fv-sd-device.h b/src/device/finger-vein/fv-sd-device.h +index 0a82055..6898892 100644 +--- a/src/device/finger-vein/fv-sd-device.h ++++ b/src/device/finger-vein/fv-sd-device.h +@@ -40,8 +40,8 @@ private: + void acquireFeatureStop() override; + void acquireFeatureFail() override; + +- int enrollTemplateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) override; +- void enrollTemplateMerge() override; ++ int templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) override; ++ void templateMerge() override; + void saveEnrollTemplateToCache(QByteArray enrollTemplate) override; + void enrollProcessRetry() override; + +diff --git a/src/device/fingerprint/fp-za-device.cpp b/src/device/fingerprint/fp-za-device.cpp +new file mode 100644 +index 0000000..7b10bcd +--- /dev/null ++++ b/src/device/fingerprint/fp-za-device.cpp +@@ -0,0 +1,251 @@ ++/** ++ * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd. ++ * kiran-authentication-devices is licensed under Mulan PSL v2. ++ * You can use this software according to the terms and conditions of the Mulan PSL v2. ++ * You may obtain a copy of Mulan PSL v2 at: ++ * http://license.coscl.org.cn/MulanPSL2 ++ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, ++ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, ++ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. ++ * See the Mulan PSL v2 for more details. ++ * ++ * Author: luoqing ++ */ ++ ++#include "fp-za-device.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "SYProtocol.h" ++#include "auth_device_adaptor.h" ++#include "device/device-creator.h" ++#include "driver/fingerprint/fp-za-driver.h" ++#include "feature-db.h" ++#include "utils.h" ++ ++namespace Kiran ++{ ++ ++REGISTER_DEVICE(FINGERPRINT_ZA_DRIVER_NAME, FPZADevice); ++ ++FPZADevice::FPZADevice(const QString& vid, const QString& pid, DriverPtr driver, QObject* parent) ++ : BioDevice{vid, pid, driver, parent} ++{ ++ setDeviceType(DEVICE_TYPE_FingerPrint); ++ setDriverName(FINGERPRINT_ZA_DRIVER_NAME); ++ setMergeTemplateCount(FP_ZA_MEGER_TEMPLATE_COUNT); ++ m_driver = driver.dynamicCast(); ++} ++ ++// 析构时对设备进行资源回收 ++FPZADevice::~FPZADevice() ++{ ++ KLOG_DEBUG() << "destroy FPZA Device"; ++ if (m_driver->isLoaded()) ++ { ++ m_driver->closeDevice(); ++ } ++} ++ ++bool FPZADevice::initDevice() ++{ ++ return true; ++} ++ ++/** ++ * 该ZhiAng指纹设备,生成的特征数据是存在buffer1和buffer2两个缓存区 ++ */ ++QByteArray FPZADevice::acquireFeature() ++{ ++ int ret = 0; ++ QByteArray feature; ++ // buffer ID 只能是1或者2,代表两个缓冲区 ++ int bufferID = (enrollTemplatesFromCache().count() == 0) ? 1 : 2; ++ ++ ret = m_driver->acquireFeature(bufferID, feature); ++ if (ret != ZAZ_OK) ++ { ++ return QByteArray(); ++ } ++ ++ return feature; ++} ++ ++void FPZADevice::acquireFeatureStop() ++{ ++ m_driver->closeDevice(); ++} ++ ++void FPZADevice::acquireFeatureFail() ++{ ++ KLOG_DEBUG() << "acquire Feature Fail"; ++ if (deviceStatus() == DEVICE_STATUS_DOING_ENROLL) ++ { ++ notifyEnrollProcess(ENROLL_PROCESS_ACQUIRE_FEATURE_FAIL); ++ internalStopEnroll(); ++ } ++ else if (deviceStatus() == DEVICE_STATUS_DOING_IDENTIFY) ++ { ++ notifyIdentifyProcess(IDENTIFY_PROCESS_ACQUIRE_FEATURE_FAIL); ++ internalStopIdentify(); ++ } ++} ++ ++void FPZADevice::templateMerge() ++{ ++ KLOG_DEBUG() << "start enroll template merge"; ++ QByteArray mergedTemplate; ++ int ret = m_driver->templateMerge(mergedTemplate); ++ if (ret != ZAZ_OK || mergedTemplate.isEmpty()) ++ { ++ // 合成模板失败,判定为录入失败,需要重新录入 ++ notifyEnrollProcess(ENROLL_PROCESS_MEGER_FAIL); ++ return; ++ } ++ ++ QString featureID = QCryptographicHash::hash(mergedTemplate, QCryptographicHash::Md5).toHex(); ++ if (saveTemplate(mergedTemplate, featureID)) ++ { ++ notifyEnrollProcess(ENROLL_PROCESS_SUCCESS, featureID); ++ } ++ else ++ { ++ notifyEnrollProcess(ENROLL_PROCESS_SAVE_FAIL); ++ } ++} ++ ++// TODO:优化 ++void FPZADevice::notifyEnrollProcess(EnrollProcess process, const QString& featureID) ++{ ++ QString message; ++ switch (process) ++ { ++ case ENROLL_PROCESS_ACQUIRE_FEATURE_FAIL: ++ message = tr("acquire fingerprint fail!"); ++ Q_EMIT m_dbusAdaptor->EnrollStatus("", 0, ENROLL_STATUS_FAIL, message); ++ break; ++ case ENROLL_PROCESS_PASS: ++ message = tr("Partial fingerprint feature entry,please continue to press your fingers"); ++ Q_EMIT m_dbusAdaptor->EnrollStatus("", enrollTemplatesFromCache().count() * 33, ENROLL_STATUS_PASS, message); ++ break; ++ case ENROLL_PROCESS_REPEATED_ENROLL: ++ message = tr("The fingerprint has been enrolled"); ++ Q_EMIT m_dbusAdaptor->EnrollStatus(featureID, 0, ENROLL_STATUS_FAIL, message); ++ break; ++ case ENROLL_PROCESS_INCONSISTENT_FEATURE: ++ message = tr("Please place the same finger!"); ++ KLOG_DEBUG() << message; ++ Q_EMIT m_dbusAdaptor->EnrollStatus("", enrollTemplatesFromCache().count() * 33, ENROLL_STATUS_RETRY, message); ++ break; ++ case ENROLL_PROCESS_MEGER_FAIL: ++ message = tr("Failed to enroll fingerprint, please enroll again"); ++ Q_EMIT m_dbusAdaptor->EnrollStatus("", 0, ENROLL_STATUS_FAIL, message); ++ break; ++ case ENROLL_PROCESS_SUCCESS: ++ message = tr("Successed save finger"); ++ Q_EMIT m_dbusAdaptor->EnrollStatus(featureID, 100, ENROLL_STATUS_COMPLETE, message); ++ break; ++ case ENROLL_PROCESS_SAVE_FAIL: ++ message = tr("Save Finger Failed!"); ++ Q_EMIT m_dbusAdaptor->EnrollStatus("", 0, ENROLL_STATUS_FAIL, message); ++ break; ++ case ENROLL_PROCESS_INCONSISTENT_FEATURE_AFTER_MERGED: ++ message = tr("Failed to enroll fingerprint, please enroll again"); ++ Q_EMIT m_dbusAdaptor->EnrollStatus("", 0, ENROLL_STATUS_FAIL, message); ++ break; ++ default: ++ break; ++ } ++ if (!message.isEmpty()) ++ { ++ if (!featureID.isEmpty()) ++ { ++ KLOG_DEBUG() << QString("%1, feature id:%2").arg(message).arg(featureID); ++ } ++ else ++ { ++ KLOG_DEBUG() << message; ++ } ++ } ++} ++ ++// TODO:优化 ++void FPZADevice::notifyIdentifyProcess(IdentifyProcess process, const QString& featureID) ++{ ++ QString message; ++ switch (process) ++ { ++ case IDENTIFY_PROCESS_TIME_OUT: ++ break; ++ case IDENTIFY_PROCESS_ACQUIRE_FEATURE_FAIL: ++ message = tr("acquire fingerprint fail!"); ++ Q_EMIT m_dbusAdaptor->IdentifyStatus("", IDENTIFY_STATUS_NOT_MATCH, message); ++ break; ++ case IDENTIFY_PROCESS_MACTCH: ++ message = tr("Fingerprint match"); ++ Q_EMIT m_dbusAdaptor->IdentifyStatus(featureID, IDENTIFY_STATUS_MATCH, message); ++ break; ++ case IDENTIFY_PROCESS_NO_MATCH: ++ message = tr("Fingerprint not match, place again"); ++ Q_EMIT m_dbusAdaptor->IdentifyStatus(featureID, IDENTIFY_STATUS_NOT_MATCH, message); ++ break; ++ default: ++ break; ++ } ++ if (!message.isEmpty()) ++ { ++ if (!featureID.isEmpty()) ++ { ++ KLOG_DEBUG() << QString("%1, feature id:%2").arg(message).arg(featureID); ++ } ++ else ++ { ++ KLOG_DEBUG() << message; ++ } ++ } ++} ++ ++int FPZADevice::templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) ++{ ++ int score = m_driver->matchFeature(fpTemplate1, fpTemplate2); ++ ++ return score >= 50 ? GENERAL_RESULT_OK : GENERAL_RESULT_FAIL; ++} ++ ++QString FPZADevice::identifyFeature(QByteArray fpTemplate, QList existedfeatures) ++{ ++ QString featureID; ++ for (int j = 0; j < existedfeatures.count(); j++) ++ { ++ auto saveTemplate = existedfeatures.value(j); ++ int ret = templateMatch(fpTemplate, saveTemplate); ++ if (ret == GENERAL_RESULT_OK) ++ { ++ featureID = FeatureDB::getInstance()->getFeatureID(saveTemplate); ++ break; ++ } ++ } ++ return featureID; ++} ++ ++int FPZADevice::openBioDevice() ++{ ++ int ret = 0; ++ ret = m_driver->openDevice(); ++ if (ret != ZAZ_OK) ++ { ++ KLOG_ERROR() << "open device Fail! id:" << deviceID(); ++ return GENERAL_RESULT_OPEN_DEVICE_FAIL; ++ } ++ return GENERAL_RESULT_OK; ++} ++ ++} // namespace Kiran +diff --git a/src/device/fingerprint/fp-za-device.h b/src/device/fingerprint/fp-za-device.h +new file mode 100644 +index 0000000..7e47cd6 +--- /dev/null ++++ b/src/device/fingerprint/fp-za-device.h +@@ -0,0 +1,53 @@ ++/** ++ * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd. ++ * kiran-authentication-devices is licensed under Mulan PSL v2. ++ * You can use this software according to the terms and conditions of the Mulan PSL v2. ++ * You may obtain a copy of Mulan PSL v2 at: ++ * http://license.coscl.org.cn/MulanPSL2 ++ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, ++ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, ++ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. ++ * See the Mulan PSL v2 for more details. ++ * ++ * Author: luoqing ++ */ ++#pragma once ++ ++#include ++#include ++#include "auth-enum.h" ++#include "device/bio-device.h" ++ ++namespace Kiran ++{ ++class FPZADriver; ++ ++class FPZADevice : public BioDevice ++{ ++ Q_OBJECT ++public: ++ explicit FPZADevice(const QString& vid, const QString& pid, DriverPtr driver, QObject* parent = nullptr); ++ ~FPZADevice(); ++ ++private: ++ bool initDevice() override; ++ QByteArray acquireFeature() override; ++ // 停止采集指纹模板 ++ void acquireFeatureStop() override; ++ void acquireFeatureFail() override; ++ void templateMerge() override; ++ ++ void notifyEnrollProcess(EnrollProcess process, const QString& featureID = QString()) override; ++ void notifyIdentifyProcess(IdentifyProcess process, const QString& featureID = QString()) override; ++ ++ // 对比两枚指纹是否匹配 ++ int templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) override; ++ ++ QString identifyFeature(QByteArray fpTemplate, QList existedfeatures) override; ++ ++ int openBioDevice() override; ++ ++private: ++ QSharedPointer m_driver; ++}; ++} // namespace Kiran +diff --git a/src/device/fingerprint/fp-zk-device.cpp b/src/device/fingerprint/fp-zk-device.cpp +index 659e9ab..01580bb 100644 +--- a/src/device/fingerprint/fp-zk-device.cpp ++++ b/src/device/fingerprint/fp-zk-device.cpp +@@ -183,10 +183,6 @@ QByteArray FPZKDevice::acquireFeature() + void FPZKDevice::acquireFeatureStop() + { + m_doAcquire = false; +- if (!m_futureWatcher.isNull()) +- { +- m_futureWatcher->waitForFinished(); +- } + } + + void FPZKDevice::acquireFeatureFail() +@@ -224,7 +220,7 @@ QByteArray FPZKDevice::templateMerge(QByteArray fpTemplate1, + return regTemplate; + } + +-int FPZKDevice::enrollTemplateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) ++int FPZKDevice::templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) + { + int score = 0; + score = m_driver->ZKFPM_DBMatch(m_hDBCache, +@@ -240,7 +236,7 @@ QString FPZKDevice::identifyFeature(QByteArray fpTemplate, QList exi + for (int j = 0; j < existedfeatures.count(); j++) + { + auto saveTemplate = existedfeatures.value(j); +- int ret = enrollTemplateMatch(fpTemplate, saveTemplate); ++ int ret = templateMatch(fpTemplate, saveTemplate); + // 指纹已经存在,直接返回该指纹 + if (ret == GENERAL_RESULT_OK) + { +@@ -252,19 +248,12 @@ QString FPZKDevice::identifyFeature(QByteArray fpTemplate, QList exi + return featureID; + } + +-bool FPZKDevice::saveFPrintTemplate(QByteArray fpTemplate, const QString& featureID) +-{ +- DeviceInfo deviceInfo = this->deviceInfo(); +- bool save = FeatureDB::getInstance()->addFeature(featureID, fpTemplate, deviceInfo, deviceType()); +- return save; +-} +- + int FPZKDevice::getDevCount() + { + return m_driver->ZKFPM_GetDeviceCount(); + } + +-void FPZKDevice::enrollTemplateMerge() ++void FPZKDevice::templateMerge() + { + QString message; + // 将三个模板merge +@@ -277,12 +266,12 @@ void FPZKDevice::enrollTemplateMerge() + } + + // 合成后的指纹与先前录入的指纹进行匹配 +- int matchResult = enrollTemplateMatch(m_enrollTemplates.value(0), regTemplate); ++ int matchResult = templateMatch(m_enrollTemplates.value(0), regTemplate); + if (matchResult == GENERAL_RESULT_OK) + { + QString featureID = QCryptographicHash::hash(regTemplate, QCryptographicHash::Md5).toHex(); + // 该指纹没有录入过,进行指纹保存 +- if (saveFPrintTemplate(regTemplate, featureID)) ++ if (saveTemplate(regTemplate, featureID)) + { + notifyEnrollProcess(ENROLL_PROCESS_SUCCESS, featureID); + } +diff --git a/src/device/fingerprint/fp-zk-device.h b/src/device/fingerprint/fp-zk-device.h +index d9a6b2c..0f11199 100644 +--- a/src/device/fingerprint/fp-zk-device.h ++++ b/src/device/fingerprint/fp-zk-device.h +@@ -37,7 +37,7 @@ private: + // 停止采集指纹模板 + void acquireFeatureStop() override; + void acquireFeatureFail() override; +- void enrollTemplateMerge() override; ++ void templateMerge() override; + + void notifyEnrollProcess(EnrollProcess process, const QString& featureID = QString()) override; + void notifyIdentifyProcess(IdentifyProcess process, const QString& featureID = QString()) override; +@@ -50,12 +50,10 @@ private: + QByteArray fpTemplate3); + + // 对比两枚指纹是否匹配 +- int enrollTemplateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) override; ++ int templateMatch(QByteArray fpTemplate1, QByteArray fpTemplate2) override; + + QString identifyFeature(QByteArray fpTemplate, QList existedfeatures) override; + +- bool saveFPrintTemplate(QByteArray fpTemplate, const QString& featureID); +- + int getDevCount(); + + private: +diff --git a/src/driver/fingerprint/fp-za-driver.cpp b/src/driver/fingerprint/fp-za-driver.cpp +new file mode 100644 +index 0000000..8951ec2 +--- /dev/null ++++ b/src/driver/fingerprint/fp-za-driver.cpp +@@ -0,0 +1,402 @@ ++/** ++ * Copyright (c) 2020 ~ 2023 KylinSec Co., Ltd. ++ * kiran-authentication-devices is licensed under Mulan PSL v2. ++ * You can use this software according to the terms and conditions of the Mulan PSL v2. ++ * You may obtain a copy of Mulan PSL v2 at: ++ * http://license.coscl.org.cn/MulanPSL2 ++ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, ++ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, ++ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. ++ * See the Mulan PSL v2 for more details. ++ * ++ * Author: luoqing ++ */ ++ ++#include "fp-za-driver.h" ++#include ++#include ++#include ++#include "SYProtocol.h" ++#include "auth-enum.h" ++#include "driver/driver-factory.h" ++ ++namespace Kiran ++{ ++extern "C" ++{ ++ // libzaz.so ++ typedef int (*T_ZAZ_MODE)(int mode); ++ typedef int (*T_ZAZ_SETPATH)(int fptype, int path); ++ typedef void (*T_ZAZ_Delaytime)(int times); ++ typedef int (*T_ZAZOpenDeviceEx)(HANDLE* hHandle, int nDeviceType, const char* nPortNum, int nPortPara, int nPackageSize); ++ typedef int (*T_ZAZCloseDeviceEx)(HANDLE hHandle); ++ typedef int (*T_ZAZVfyPwd)(HANDLE hHandle, int nAddr, unsigned char* pPassword); ++ typedef int (*T_ZAZGetImage)(HANDLE hHandle, int nAddr); ++ typedef int (*T_ZAZGenChar)(HANDLE hHandle, int nAddr, int iBufferID); ++ typedef int (*T_ZAZMatch)(HANDLE hHandle, int nAddr, int* iScore); ++ typedef int (*T_ZAZSearch)(HANDLE hHandle, int nAddr, int iBufferID, int iStartPage, int iPageNum, int* iMbAddress, int* iscore); ++ ++ typedef int (*T_ZAZRegModule)(HANDLE hHandle, int nAddr); ++ typedef int (*T_ZAZStoreChar)(HANDLE hHandle, int nAddr, int iBufferID, int iPageID); ++ typedef int (*T_ZAZDelChar)(HANDLE hHandle, int nAddr, int iStartPageID, int nDelPageNum); ++ typedef int (*T_ZAZEmpty)(HANDLE hHandle, int nAddr); ++ typedef int (*T_ZAZReadParTable)(HANDLE hHandle, int nAddr, unsigned char* pParTable); ++ ++ typedef int (*T_ZAZTemplateNum)(HANDLE hHandle, int nAddr, int* iMbNum); ++ typedef int (*T_ZAZGetRandomData)(HANDLE hHandle, int nAddr, unsigned char* pRandom); ++ typedef int (*T_ZAZReadIndexTable)(HANDLE hHandle, int nAddr, int nPage, unsigned char* UserContent); ++ typedef int (*T_ZAZDoUserDefine)(HANDLE hHandle, int nAddr, int GPIO, int STATE); ++ typedef int (*T_ZAZSetCharLen)(int nLen); ++ typedef int (*T_ZAZSetImgLen)(int w, int h); ++ typedef int (*T_ZAZGetCharLen)(int* pnLen); ++ typedef int (*T_ZAZLoadChar)(HANDLE hHandle, int nAddr, int iBufferID, int iPageID); ++ typedef int (*T_ZAZUpChar)(HANDLE hHandle, int nAddr, int iBufferID, unsigned char* pTemplet, int* iTempletLength); ++ typedef int (*T_ZAZDownChar)(HANDLE hHandle, int nAddr, int iBufferID, unsigned char* pTemplet, int iTempletLength); ++ typedef int (*T_ZAZUpImage)(HANDLE hHandle, int nAddr, unsigned char* pImageData, int* iImageLength); ++ typedef int (*T_ZAZDownImage)(HANDLE hHandle, int nAddr, unsigned char* pImageData, int iLength); ++ typedef int (*T_ZAZImgData2BMP)(unsigned char* pImgData, const char* pImageFile); ++ typedef int (*T_ZAZGetImgDataFromBMP)(const char* pImageFile, unsigned char* pImageData, int* pnImageLen); ++ typedef int (*T_ZAZReadInfo)(HANDLE hHandle, int nAddr, int nPage, unsigned char* UserContent); ++ typedef int (*T_ZAZWriteInfo)(HANDLE hHandle, int nAddr, int nPage, unsigned char* UserContent); ++ typedef int (*T_ZAZSetPwd)(HANDLE hHandle, int nAddr, unsigned char* pPassword); ++ typedef int (*T_ZAZReadInfPage)(HANDLE hHandle, int nAddr, unsigned char* pInf); ++ typedef int (*T_ZAZGetImgQuality)(int width, int height, unsigned char* p_pbImage); ++ typedef int (*T_ZAZRaw2BMP)(unsigned char* prawData, int w, int h, unsigned char* pbmpData); ++ ++ typedef void (*T_ZAZSetlog)(int val); ++ typedef int (*T_ZAZAutoStore)(int* fingerid); ++ typedef int (*T_ZAZGetFpList)(int imbnum, int* fplist); ++ typedef int (*T_ZAZSetBaud)(HANDLE hHandle, int nAddr, int nBaudNum); ++ typedef int (*T_ZAZSetSecurLevel)(HANDLE hHandle, int nAddr, int nLevel); ++ typedef int (*T_ZAZSetPacketSize)(HANDLE hHandle, int nAddr, int nSize); ++ typedef int (*T_ZAZUpChar2File)(HANDLE hHandle, int nAddr, int iBufferID, const char* pFileName); ++ typedef int (*T_ZAZDownCharFromFile)(HANDLE hHandle, int nAddr, int iBufferID, const char* pFileName); ++ typedef int (*T_ZAZSetChipAddr)(HANDLE hHandle, int nAddr, unsigned char* pChipAddr); ++ typedef int (*T_ZAZBurnCode)(HANDLE hHandle, int nAddr, int nType, unsigned char* pImageData, int iLength); ++ typedef int (*T_ZAZIdentify)(HANDLE hHandle, int nAddr, int* iMbAddress); ++ typedef int (*T_ZAZEnroll)(HANDLE hHandle, int nAddr, int* nID); ++ typedef void (*T_Delay)(int nTimes); ++ ++ typedef int (*T_FingerImgSorce)(unsigned char* pImage); ++ typedef char* (*T_ZAZErr2Str)(int nErrCode); ++ ++ // libzamatch.so ++ typedef short (*T_Match2Fp)(unsigned char* piFeatureA, unsigned char* piFeatureB); ++ typedef short (*T_MatchScore)(unsigned char* piFeatureA, unsigned char* piFeatureB); ++ typedef void (*T_AlgVersion)(char* postrVersion); ++}; ++ ++struct FPZADriverLib ++{ ++ // libzaz.so ++ T_ZAZ_MODE ZAZ_MODE; ++ T_ZAZ_SETPATH ZAZ_SETPATH; ++ T_ZAZ_Delaytime ZAZ_Delaytime; ++ T_ZAZOpenDeviceEx ZAZOpenDeviceEx; ++ T_ZAZCloseDeviceEx ZAZCloseDeviceEx; ++ T_ZAZVfyPwd ZAZVfyPwd; ++ T_ZAZGetImage ZAZGetImage; ++ T_ZAZGenChar ZAZGenChar; ++ T_ZAZMatch ZAZMatch; ++ T_ZAZSearch ZAZSearch; ++ ++ T_ZAZRegModule ZAZRegModule; ++ T_ZAZStoreChar ZAZStoreChar; ++ T_ZAZDelChar ZAZDelChar; ++ T_ZAZEmpty ZAZEmpty; ++ T_ZAZReadParTable ZAZReadParTable; ++ ++ T_ZAZTemplateNum ZAZTemplateNum; ++ T_ZAZGetRandomData ZAZGetRandomData; ++ T_ZAZReadIndexTable ZAZReadIndexTable; ++ T_ZAZDoUserDefine ZAZDoUserDefine; ++ T_ZAZSetCharLen ZAZSetCharLen; ++ T_ZAZSetImgLen ZAZSetImgLen; ++ T_ZAZGetCharLen ZAZGetCharLen; ++ T_ZAZLoadChar ZAZLoadChar; ++ T_ZAZUpChar ZAZUpChar; ++ T_ZAZDownChar ZAZDownChar; ++ T_ZAZUpImage ZAZUpImage; ++ T_ZAZDownImage ZAZDownImage; ++ T_ZAZImgData2BMP ZAZImgData2BMP; ++ T_ZAZGetImgDataFromBMP ZAZGetImgDataFromBMP; ++ T_ZAZReadInfo ZAZReadInfo; ++ T_ZAZWriteInfo ZAZWriteInfo; ++ T_ZAZSetPwd ZAZSetPwd; ++ T_ZAZReadInfPage ZAZReadInfPage; ++ T_ZAZGetImgQuality ZAZGetImgQuality; ++ T_ZAZRaw2BMP ZAZRaw2BMP; ++ ++ T_ZAZSetlog ZAZSetlog; ++ T_ZAZAutoStore ZAZAutoStore; ++ T_ZAZGetFpList ZAZGetFpList; ++ T_ZAZSetBaud ZAZSetBaud; ++ T_ZAZSetSecurLevel ZAZSetSecurLevel; ++ T_ZAZSetPacketSize ZAZSetPacketSize; ++ T_ZAZUpChar2File ZAZUpChar2File; ++ T_ZAZDownCharFromFile ZAZDownCharFromFile; ++ T_ZAZSetChipAddr ZAZSetChipAddr; ++ T_ZAZBurnCode ZAZBurnCode; ++ T_ZAZIdentify ZAZIdentify; ++ T_ZAZEnroll ZAZEnroll; ++ T_Delay Delay; ++ ++ T_FingerImgSorce FingerImgSorce; ++ T_ZAZErr2Str ZAZErr2Str; ++ ++ // libzamatch.so ++ T_Match2Fp Match2Fp; ++ T_MatchScore MatchScore; ++ T_AlgVersion AlgVersion; ++ ++ void loadSym(LIB_HANDLE libHandle, LIB_HANDLE m_libMatchHandle) ++ { ++ this->ZAZ_MODE = (T_ZAZ_MODE)dlsym(libHandle, "ZAZ_MODE"); ++ this->ZAZ_SETPATH = (T_ZAZ_SETPATH)dlsym(libHandle, "ZAZ_SETPATH"); ++ this->ZAZ_Delaytime = (T_ZAZ_Delaytime)dlsym(libHandle, "ZAZ_Delaytime"); ++ this->ZAZOpenDeviceEx = (T_ZAZOpenDeviceEx)dlsym(libHandle, "ZAZOpenDeviceEx"); ++ this->ZAZCloseDeviceEx = (T_ZAZCloseDeviceEx)dlsym(libHandle, "ZAZCloseDeviceEx"); ++ this->ZAZVfyPwd = (T_ZAZVfyPwd)dlsym(libHandle, "ZAZVfyPwd"); ++ this->ZAZGetImage = (T_ZAZGetImage)dlsym(libHandle, "ZAZGetImage"); ++ this->ZAZGenChar = (T_ZAZGenChar)dlsym(libHandle, "ZAZGenChar"); ++ this->ZAZMatch = (T_ZAZMatch)dlsym(libHandle, "ZAZMatch"); ++ this->ZAZSearch = (T_ZAZSearch)dlsym(libHandle, "ZAZSearch"); ++ this->ZAZRegModule = (T_ZAZRegModule)dlsym(libHandle, "ZAZRegModule"); ++ this->ZAZStoreChar = (T_ZAZStoreChar)dlsym(libHandle, "ZAZStoreChar"); ++ this->ZAZDelChar = (T_ZAZDelChar)dlsym(libHandle, "ZAZDelChar"); ++ this->ZAZEmpty = (T_ZAZEmpty)dlsym(libHandle, "ZAZEmpty"); ++ this->ZAZReadParTable = (T_ZAZReadParTable)dlsym(libHandle, "ZAZReadParTable"); ++ this->ZAZTemplateNum = (T_ZAZTemplateNum)dlsym(libHandle, "ZAZTemplateNum"); ++ this->ZAZGetRandomData = (T_ZAZGetRandomData)dlsym(libHandle, "ZAZGetRandomData"); ++ this->ZAZReadIndexTable = (T_ZAZReadIndexTable)dlsym(libHandle, "ZAZReadIndexTable"); ++ this->ZAZDoUserDefine = (T_ZAZDoUserDefine)dlsym(libHandle, "ZAZDoUserDefine"); ++ this->ZAZSetCharLen = (T_ZAZSetCharLen)dlsym(libHandle, "ZAZSetCharLen"); ++ this->ZAZSetImgLen = (T_ZAZSetImgLen)dlsym(libHandle, "ZAZSetImgLen"); ++ this->ZAZGetCharLen = (T_ZAZGetCharLen)dlsym(libHandle, "ZAZGetCharLen"); ++ this->ZAZLoadChar = (T_ZAZLoadChar)dlsym(libHandle, "ZAZLoadChar"); ++ this->ZAZUpChar = (T_ZAZUpChar)dlsym(libHandle, "ZAZUpChar"); ++ this->ZAZDownChar = (T_ZAZDownChar)dlsym(libHandle, "ZAZDownChar"); ++ this->ZAZUpImage = (T_ZAZUpImage)dlsym(libHandle, "ZAZUpImage"); ++ this->ZAZDownImage = (T_ZAZDownImage)dlsym(libHandle, "ZAZDownImage"); ++ this->ZAZImgData2BMP = (T_ZAZImgData2BMP)dlsym(libHandle, "ZAZImgData2BMP"); ++ this->ZAZGetImgDataFromBMP = (T_ZAZGetImgDataFromBMP)dlsym(libHandle, "ZAZGetImgDataFromBMP"); ++ this->ZAZReadInfo = (T_ZAZReadInfo)dlsym(libHandle, "ZAZReadInfo"); ++ this->ZAZWriteInfo = (T_ZAZWriteInfo)dlsym(libHandle, "ZAZWriteInfo"); ++ this->ZAZSetPwd = (T_ZAZSetPwd)dlsym(libHandle, "ZAZSetPwd"); ++ this->ZAZReadInfPage = (T_ZAZReadInfPage)dlsym(libHandle, "ZAZReadInfPage"); ++ this->ZAZGetImgQuality = (T_ZAZGetImgQuality)dlsym(libHandle, "ZAZGetImgQuality"); ++ this->ZAZRaw2BMP = (T_ZAZRaw2BMP)dlsym(libHandle, "ZAZRaw2BMP"); ++ this->ZAZSetlog = (T_ZAZSetlog)dlsym(libHandle, "ZAZSetlog"); ++ this->ZAZAutoStore = (T_ZAZAutoStore)dlsym(libHandle, "ZAZAutoStore"); ++ this->ZAZGetFpList = (T_ZAZGetFpList)dlsym(libHandle, "ZAZGetFpList"); ++ this->ZAZSetBaud = (T_ZAZSetBaud)dlsym(libHandle, "ZAZSetBaud"); ++ this->ZAZSetSecurLevel = (T_ZAZSetSecurLevel)dlsym(libHandle, "ZAZSetSecurLevel"); ++ this->ZAZSetPacketSize = (T_ZAZSetPacketSize)dlsym(libHandle, "ZAZSetPacketSize"); ++ this->ZAZUpChar2File = (T_ZAZUpChar2File)dlsym(libHandle, "ZAZUpChar2File"); ++ this->ZAZDownCharFromFile = (T_ZAZDownCharFromFile)dlsym(libHandle, "ZAZDownCharFromFile"); ++ this->ZAZSetChipAddr = (T_ZAZSetChipAddr)dlsym(libHandle, "ZAZSetChipAddr"); ++ this->ZAZBurnCode = (T_ZAZBurnCode)dlsym(libHandle, "ZAZBurnCode"); ++ this->ZAZIdentify = (T_ZAZIdentify)dlsym(libHandle, "ZAZIdentify"); ++ this->ZAZEnroll = (T_ZAZEnroll)dlsym(libHandle, "ZAZEnroll"); ++ this->Delay = (T_Delay)dlsym(libHandle, "Delay"); ++ this->FingerImgSorce = (T_FingerImgSorce)dlsym(libHandle, "FingerImgSorce"); ++ this->ZAZErr2Str = (T_ZAZErr2Str)dlsym(libHandle, "ZAZErr2Str"); ++ ++ this->Match2Fp = (T_Match2Fp)dlsym(m_libMatchHandle, "Match2Fp"); ++ this->MatchScore = (T_MatchScore)dlsym(m_libMatchHandle, "MatchScore"); ++ this->AlgVersion = (T_AlgVersion)dlsym(m_libMatchHandle, "AlgVersion"); ++ ++ this->isLoaded = true; ++ }; ++ bool isLoaded = false; ++}; ++ ++REGISTER_DRIVER(FINGERPRINT_ZA_DRIVER_NAME, FPZADriver); ++ ++#define TEMPLATE_LEN 512 ++ ++#define RETURN_IF_THERE_IS_ERROR_CODE(code, msg) \ ++ if (code != ZAZ_OK) \ ++ { \ ++ KLOG_INFO() << msg << "error code: " << code << error2Str(code); \ ++ return code; \ ++ } ++ ++FPZADriver::FPZADriver(QObject* parent) : Driver(parent), ++ m_libHandle(nullptr), ++ m_libMatchHandle(nullptr) ++ ++{ ++ m_driverLib.reset(new FPZADriverLib); ++ setName(FINGERPRINT_ZA_DRIVER_NAME); ++} ++ ++FPZADriver::~FPZADriver() ++{ ++ if (m_libHandle) ++ { ++ dlclose(m_libHandle); ++ m_libHandle = NULL; ++ } ++ ++ if (m_libMatchHandle) ++ { ++ dlclose(m_libMatchHandle); ++ m_libMatchHandle = NULL; ++ } ++} ++ ++bool FPZADriver::initDriver(const QString& libPath) ++{ ++ QString loadLibPath; ++ libPath.isEmpty() ? (loadLibPath = FP_ZA_DRIVER_LIB) : (loadLibPath = libPath); ++ return loadLibrary(FP_ZA_DRIVER_LIB); ++} ++ ++bool FPZADriver::loadLibrary(const QString& libPath) ++{ ++ // 打开指定的动态链接库文件;立刻决定返回前接触所有未决定的符号。若打开错误返回NULL,成功则返回库引用 ++ m_libHandle = dlopen(libPath.toStdString().c_str(), RTLD_NOW); ++ if (m_libHandle == nullptr) ++ { ++ KLOG_ERROR() << "Load libzaz failed,error:" << dlerror(); ++ ++ return false; ++ } ++ ++ m_libMatchHandle = dlopen(FP_ZA_DRIVER_LIB_MATCH, RTLD_NOW); ++ if (m_libMatchHandle == NULL) ++ { ++ KLOG_ERROR() << "Load libzamatch failed,error:" << dlerror(); ++ return false; ++ } ++ ++ m_driverLib->loadSym(m_libHandle, m_libMatchHandle); ++ return true; ++} ++ ++bool FPZADriver::isLoaded() ++{ ++ return m_driverLib->isLoaded; ++} ++ ++/** ++ * NOTE: ++ * 注意,ZAZOpenDeviceEx 参数里的句柄,实际上是无效的,只是为了跟Windows兼容,真正的句柄在设备底层,因此,该参数传空 ++ */ ++int FPZADriver::openDevice() ++{ ++ int nRet, iType = 0; ++ HANDLE nhanle = 0; ++ // 1.设置指纹协议 ++ m_driverLib->ZAZ_MODE(0); ++ m_driverLib->ZAZSetlog(1); // 开日志 日志在执行文件目录中 zazlog.txt ++ ++ // 2.设置指纹工作模式(PC||ARM) ++ m_driverLib->ZAZ_SETPATH(fp_606, path_pc); ++ nRet = m_driverLib->ZAZOpenDeviceEx(&nhanle, DEVICE_UDisk, 0, 2, 0); ++ ++ if (nRet != ZAZ_OK) ++ { ++ return nRet; ++ } ++ ++ unsigned char pPassword[4] = {0, 0, 0, 0}; ++ nRet = m_driverLib->ZAZVfyPwd(nhanle, DEV_ADDR, pPassword); ++ if (nRet == 0) ++ { ++ KLOG_INFO() << "open za device success: fp_606 "; ++ iType = DEVICE_UDisk; ++ } ++ ++ return nRet; ++} ++ ++int FPZADriver::closeDevice() ++{ ++ int ret = m_driverLib->ZAZCloseDeviceEx(0); ++ return ret; ++} ++ ++int FPZADriver::acquireFeature(int iBufferID, QByteArray& feature) ++{ ++ int nRet = ZAZ_NO_FINGER; ++ int counts = 0; ++ ++ HANDLE handle = 0; ++ while (nRet == ZAZ_NO_FINGER) ++ { ++ nRet = m_driverLib->ZAZGetImage(handle, DEV_ADDR); ++ counts++; ++ KLOG_DEBUG() << "get fingerprint image:" << nRet << "count:" << counts; ++ } ++ RETURN_IF_THERE_IS_ERROR_CODE(nRet, "get fingerprint image fail"); ++ KLOG_DEBUG() << "get fingerprint image success"; ++ ++ // 生成特征 ++ nRet = m_driverLib->ZAZGenChar(handle, DEV_ADDR, iBufferID); ++ RETURN_IF_THERE_IS_ERROR_CODE(nRet, "gen feature fail"); ++ KLOG_DEBUG() << "gen feature success, buffer:" << iBufferID; ++ ++ // 从缓冲区拿出特征 ++ unsigned char pTemplet[2048]; ++ int iTempletLength = 0; ++ m_driverLib->ZAZSetCharLen(TEMPLATE_LEN); ++ ++ nRet = m_driverLib->ZAZUpChar(handle, DEV_ADDR, iBufferID, pTemplet, &iTempletLength); ++ RETURN_IF_THERE_IS_ERROR_CODE(nRet, "get feature failed"); ++ KLOG_DEBUG() << "get feature success : " << iTempletLength; ++ ++ QByteArray bufferFeature((char*)pTemplet, TEMPLATE_LEN); ++ feature = bufferFeature; ++ ++ return nRet; ++} ++ ++QString FPZADriver::error2Str(int nErrCode) ++{ ++ return QString(m_driverLib->ZAZErr2Str(nErrCode)); ++} ++ ++int FPZADriver::matchFeature(QByteArray& feature1, QByteArray& feature2) ++{ ++ unsigned char charTableA[512]; ++ unsigned char charTableB[512]; ++ ++ const char* byteArrayData = feature1.data(); ++ std::memcpy(charTableA, byteArrayData, feature1.size()); ++ ++ const char* byteArrayData2 = feature2.data(); ++ std::memcpy(charTableB, byteArrayData2, feature2.size()); ++ ++ int score = m_driverLib->MatchScore(charTableA, charTableB); ++ KLOG_DEBUG() << "match score:" << score; ++ ++ return score; ++} ++ ++int FPZADriver::templateMerge(QByteArray& mergedTemplate) ++{ ++ int handle = 0; ++ int ret; ++ ret = m_driverLib->ZAZRegModule(handle, DEV_ADDR); ++ RETURN_IF_THERE_IS_ERROR_CODE(ret, "template merge is Fail"); ++ ++ unsigned char pTemplet[2048]; ++ int iTempletLength = 0; ++ m_driverLib->ZAZSetCharLen(TEMPLATE_LEN); ++ ret = m_driverLib->ZAZUpChar(handle, DEV_ADDR, 1, pTemplet, &iTempletLength); ++ ++ if (ret != ZAZ_OK) ++ { ++ KLOG_INFO() << "get template failed, error code: " << ret << error2Str(ret); ++ } ++ else ++ { ++ QByteArray templateByte((char*)pTemplet, TEMPLATE_LEN); ++ KLOG_DEBUG() << "get template success, len:" << iTempletLength << " merged Template:" << templateByte; ++ mergedTemplate = templateByte; ++ } ++ return ret; ++} ++} // namespace Kiran +diff --git a/src/driver/fingerprint/fp-za-driver.h b/src/driver/fingerprint/fp-za-driver.h +new file mode 100644 +index 0000000..0df06ff +--- /dev/null ++++ b/src/driver/fingerprint/fp-za-driver.h +@@ -0,0 +1,53 @@ ++/** ++ * Copyright (c) 2020 ~ 2023 KylinSec Co., Ltd. ++ * kiran-authentication-devices is licensed under Mulan PSL v2. ++ * You can use this software according to the terms and conditions of the Mulan PSL v2. ++ * You may obtain a copy of Mulan PSL v2 at: ++ * http://license.coscl.org.cn/MulanPSL2 ++ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, ++ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, ++ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. ++ * See the Mulan PSL v2 for more details. ++ * ++ * Author: luoqing ++ */ ++#pragma once ++ ++#include ++#include "driver/driver.h" ++ ++namespace Kiran ++{ ++struct FPZADriverLib; ++typedef void* LIB_HANDLE; ++ ++class FPZADriver : public Driver ++{ ++ Q_OBJECT ++public: ++ FPZADriver(QObject* parent = nullptr); ++ ~FPZADriver(); ++ ++ bool initDriver(const QString& libPath = QString()) override; ++ bool loadLibrary(const QString& libPath) override; ++ bool isLoaded() override; ++ ++ int openDevice(); ++ int closeDevice(); ++ ++ int acquireFeature(int iBufferID, QByteArray& feature); ++ ++ QString error2Str(int nErrCode); ++ ++ // 1:1 对两个特征进行匹配 ++ int matchFeature(QByteArray& feature1,QByteArray& feature2); ++ ++ // 该函数不需要传入特征参数,直接将缓冲区Buffer1和Buffer2的特征,进行合成 ++ int templateMerge(QByteArray& mergedTemplate); ++ ++private: ++ QScopedPointer m_driverLib; ++ LIB_HANDLE m_libHandle; ++ LIB_HANDLE m_libMatchHandle; ++}; ++} // namespace Kiran +-- +2.27.0 + diff --git a/0007-fix-build-delete-blank-cmake_target_link_directories.patch b/0007-fix-build-delete-blank-cmake_target_link_directories.patch new file mode 100644 index 0000000..3a51227 --- /dev/null +++ b/0007-fix-build-delete-blank-cmake_target_link_directories.patch @@ -0,0 +1,30 @@ +From 084f2cd237cb678efbe14d4895099591c211a3ef Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Mon, 20 May 2024 10:08:26 +0800 +Subject: [PATCH] fix(build): delete blank cmake_target_link_directories +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 删除空白的cmake_target_link_directorires的应用 +--- + src/CMakeLists.txt | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index b5729e5..28f4990 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -60,9 +60,6 @@ target_link_libraries(${PROJECT_NAME} + ${CMAKE_DL_LIBS} + ) + +-target_link_directories(${PROJECT_NAME} PRIVATE +- ) +- + install(TARGETS ${PROJECT_NAME} + DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}) + +-- +2.27.0 + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index a7a4937..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# kiran-authentication-devices - -#### Description -Kiran authentication services Management Device Compatibility layer - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 28f1f83..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# kiran-authentication-devices - -#### 介绍 -Kiran authentication services Management Device Compatibility layer - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/kiran-authentication-devices.spec b/kiran-authentication-devices.spec index c5a2b5e..d3168e5 100644 --- a/kiran-authentication-devices.spec +++ b/kiran-authentication-devices.spec @@ -1,18 +1,20 @@ -Name: kiran-authentication-devices +Name: kiran-authentication-devices -Version: 2.5.2 -Release: 4 -Summary: Kiran Authentication Devices +Version: 2.5.2 +Release: 5%{?dist} +Summary: Kiran Authentication Devices -License: MulanPSL-2.0 -Source0: %{name}-%{version}.tar.gz +License: MulanPSL-2.0 +Source0: %{name}-%{version}.tar.gz -Patch0001: 0001-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch -Patch0002: 0002-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch -Patch0003: 0003-refactor-Modify-the-code-according-to-the-https-gite.patch -Patch0004: 0004-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch -Patch0005: 0005-fix-When-the-driver-is-enabled-the-device-is-scanned.patch -Patch0006: 0006-fix-build-fix-file-install-path-error.patch +Patch0000: 0000-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch +Patch0001: 0001-fix-ukey-manager-Fixed-a-crash-caused-by-repeatedly-.patch +Patch0002: 0002-refactor-Modify-the-code-according-to-the-https-gite.patch +Patch0003: 0003-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch +Patch0004: 0004-fix-When-the-driver-is-enabled-the-device-is-scanned.patch +Patch0005: 0005-fix-build-fix-file-install-path-error.patch +Patch0006: 0006-feature-suitable-for-zhi-ang-fingerprint-device.patch +Patch0007: 0007-fix-build-delete-blank-cmake_target_link_directories.patch BuildRequires: cmake BuildRequires: gcc-c++ @@ -20,36 +22,51 @@ BuildRequires: qt5-qtbase-devel BuildRequires: qt5-linguist BuildRequires: kiran-log-qt5-devel BuildRequires: systemd-devel +BuildRequires: chrpath + Requires: qt5-qtbase Requires: kiran-log-qt5 -Requires: libusb -%{?systemd_requires} +Requires: systemd +Requires: libusb %description Manage authentication devices %package devel -Summary: Development files for kiran authentication devices -Requires: %{name} = %{version}-%{release} +Summary: Development files for kiran authentication devices +Requires: %{name} = %{version}-%{release} %description devel -Development files for kiran authentication devices +Development files for kiran authentication devices %prep %autosetup -p1 %build %cmake -%cmake_build +%make_build %install -%cmake_install - -%post +%make_install + +# remove rpath +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d +echo "" > $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf +for file in $(find $RPM_BUILD_ROOT%{_bindir} -type f -exec file {} ';' | grep -w ELF | awk -F':' '{print $1}') +do + libpath=$(chrpath -l $file | grep -o 'RPATH=[^[:space:]]*' | cut -d= -f2 | sed 's/:/\\n/g') + echo -e $libpath >> $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf + chrpath -d $file +done + +sort -u $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf | grep -v '^$'> $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf.tmp && \ +mv $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf.tmp $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf + +%post %systemd_post kiran-authentication-devices.service systemctl enable kiran-authentication-devices.service -%preun +%preun %systemd_preun kiran-authentication-devices.service %files @@ -63,13 +80,19 @@ systemctl enable kiran-authentication-devices.service %{_sysconfdir}/kiran-authentication-devices/device.conf %{_sysconfdir}/kiran-authentication-devices/ukey-manager.conf %{_usr}/lib/systemd/system/kiran-authentication-devices.service +%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf %files devel %{_includedir}/kiran-authentication-devices/kiran-auth-device-i.h +%clean +rm -rf ${buildroot} + %changelog -* Wed Nov 20 2024 Funda Wang - 2.5.2-4 -- adopt to new cmake macro +* Thu Apr 03 2025 liuxinhao - 2.5.2-5 +- KYOS-B: delete blank cmake_target_link_directories +- KYOS-B: remove rpath (#37243) +- KYOS-F: suitable for zhi ang fingerprint device (#24532) * Thu Jan 18 2024 luoqing - 2.5.2-3 - KYOS-B: Fixed a crash caused by repeatedly calling disConnectDev in resetUkey and destructor to release the same device handle diff --git a/kiran-authentication-devices.yaml b/kiran-authentication-devices.yaml deleted file mode 100644 index 41f974b..0000000 --- a/kiran-authentication-devices.yaml +++ /dev/null @@ -1,4 +0,0 @@ -version_control: gitee -src_repo: https://gitee.com/openeuler/kiran-authentication-devices.git -tag_prefix: "v" -seperator: "." -- Gitee