!28 从master同步到openEuler-22.03-LTS-Next
From: @luoqing_kylinsec Reviewed-by: @liubuguiii Signed-off-by: @liubuguiii
This commit is contained in:
commit
6d4d2c79c9
@ -1,78 +0,0 @@
|
||||
From bdb3eb90ad2ab0f08365b71fefb33c76b96c4359 Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Fri, 2 Jun 2023 19:09:11 +0800
|
||||
Subject: [PATCH] fix(feature-db):Fix the issue of not obtaining features from
|
||||
the database when deviceSerialNumber is empty
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复deviceSerialNumber为空时,从数据库获取不到feature的问题
|
||||
---
|
||||
src/device/fingerprint/fp-zk-device.cpp | 1 +
|
||||
src/feature-db.cpp | 18 +++++++++++++++---
|
||||
2 files changed, 16 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/device/fingerprint/fp-zk-device.cpp b/src/device/fingerprint/fp-zk-device.cpp
|
||||
index 4d8abc0..16ceb37 100644
|
||||
--- a/src/device/fingerprint/fp-zk-device.cpp
|
||||
+++ b/src/device/fingerprint/fp-zk-device.cpp
|
||||
@@ -398,6 +398,7 @@ QString FPZKDevice::identifyFeature(QByteArray fpTemplate, QStringList featureID
|
||||
|
||||
if (saveList.count() == 0)
|
||||
{
|
||||
+ KLOG_DEBUG() << "no found feature";
|
||||
return QString();
|
||||
}
|
||||
|
||||
diff --git a/src/feature-db.cpp b/src/feature-db.cpp
|
||||
index ee0a4bd..a8aa883 100644
|
||||
--- a/src/feature-db.cpp
|
||||
+++ b/src/feature-db.cpp
|
||||
@@ -92,7 +92,7 @@ bool FeatureDB::addFeature(const QString &featureID, QByteArray feature, DeviceI
|
||||
query.bindValue(":idVendor", deviceInfo.idVendor);
|
||||
query.bindValue(":idProduct", deviceInfo.idProduct);
|
||||
query.bindValue(":deviceType", (int)deviceType);
|
||||
- query.bindValue(":deviceSerialNumber", deviceSerialNumber);
|
||||
+ query.bindValue(":deviceSerialNumber", deviceSerialNumber.isEmpty() ? QVariant(QVariant::String) : deviceSerialNumber);
|
||||
return query.exec();
|
||||
}
|
||||
|
||||
@@ -121,12 +121,19 @@ QByteArray FeatureDB::getFeature(const QString &featureID)
|
||||
QList<QByteArray> FeatureDB::getFeatures(const QString &idVendor, const QString &idProduct, DeviceType deviceType, const QString &deviceSerialNumber)
|
||||
{
|
||||
QSqlQuery query(m_database);
|
||||
- query.prepare("SELECT feature FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType AND deviceSerialNumber = :serialNumber");
|
||||
+ QString sql = "SELECT feature FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType";
|
||||
+ if (!deviceSerialNumber.isEmpty())
|
||||
+ {
|
||||
+ sql.append(" AND deviceSerialNumber = :serialNumber");
|
||||
+ }
|
||||
+
|
||||
+ query.prepare(sql);
|
||||
query.bindValue(":Vid", idVendor);
|
||||
query.bindValue(":Pid", idProduct);
|
||||
query.bindValue(":devType", (int)deviceType);
|
||||
query.bindValue(":serialNumber", deviceSerialNumber);
|
||||
query.exec();
|
||||
+
|
||||
QByteArrayList featuresList;
|
||||
while (query.next())
|
||||
{
|
||||
@@ -153,7 +160,12 @@ QList<QByteArray> FeatureDB::getAllFeatures()
|
||||
QStringList FeatureDB::getFeatureIDs(const QString &idVendor, const QString &idProduct, DeviceType deviceType, const QString &deviceSerialNumber)
|
||||
{
|
||||
QSqlQuery query(m_database);
|
||||
- query.prepare("SELECT featureID FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType AND deviceSerialNumber = :serialNumber");
|
||||
+ QString sql = "SELECT featureID FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType";
|
||||
+ if (!deviceSerialNumber.isEmpty())
|
||||
+ {
|
||||
+ sql.append(" AND deviceSerialNumber = :serialNumber");
|
||||
+ }
|
||||
+
|
||||
query.bindValue(":Vid", idVendor);
|
||||
query.bindValue(":Pid", idProduct);
|
||||
query.bindValue(":devType", (int)deviceType);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From 3fe0189b4bb5cd0d8fb3698dcdf136d5f1a64e8e Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Wed, 24 May 2023 17:40:53 +0800
|
||||
Subject: [PATCH] fix(mf-iristar-driver):Fix compilation issues with std::
|
||||
function in lower versions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复std::function在低版本的编译问题
|
||||
---
|
||||
src/driver/multi-function/mf-iristar-driver.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/driver/multi-function/mf-iristar-driver.cpp b/src/driver/multi-function/mf-iristar-driver.cpp
|
||||
index 4af8cff..298a0e8 100644
|
||||
--- a/src/driver/multi-function/mf-iristar-driver.cpp
|
||||
+++ b/src/driver/multi-function/mf-iristar-driver.cpp
|
||||
@@ -12,6 +12,7 @@
|
||||
* Author: luoqing <luoqing@kylinsec.com.cn>
|
||||
*/
|
||||
|
||||
+#include <functional>
|
||||
#include "mf-iristar-driver.h"
|
||||
#include <dlfcn.h>
|
||||
#include <qt5-log-i.h>
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
From aab75172b1f174daf68c401b6e350f994f14fad1 Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Mon, 12 Jun 2023 15:23:30 +0800
|
||||
Subject: [PATCH] fix(ukey):Fix the issue of duplicate binding of the same UKey
|
||||
device
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复同一个UKey设备可以重复绑定的问题
|
||||
|
||||
Related #I78P3F
|
||||
---
|
||||
src/device/ukey/ukey-ft-device.cpp | 1 +
|
||||
src/feature-db.cpp | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/device/ukey/ukey-ft-device.cpp b/src/device/ukey/ukey-ft-device.cpp
|
||||
index e8f5070..14f09ef 100644
|
||||
--- a/src/device/ukey/ukey-ft-device.cpp
|
||||
+++ b/src/device/ukey/ukey-ft-device.cpp
|
||||
@@ -210,6 +210,7 @@ ULONG UKeyFTDevice::createContainer(const QString &pin, DEVHANDLE devHandle, HAP
|
||||
bool UKeyFTDevice::isExistBinding()
|
||||
{
|
||||
QStringList featureIDs = FeatureDB::getInstance()->getFeatureIDs(deviceInfo().idVendor, deviceInfo().idProduct, deviceType(), deviceSerialNumber());
|
||||
+ KLOG_DEBUG() << "Existing Binding featureIDs:" << featureIDs;
|
||||
for (auto id : featureIDs)
|
||||
{
|
||||
FeatureInfo info = FeatureDB::getInstance()->getFeatureInfo(id);
|
||||
diff --git a/src/feature-db.cpp b/src/feature-db.cpp
|
||||
index a8aa883..6cf8735 100644
|
||||
--- a/src/feature-db.cpp
|
||||
+++ b/src/feature-db.cpp
|
||||
@@ -166,6 +166,7 @@ QStringList FeatureDB::getFeatureIDs(const QString &idVendor, const QString &idP
|
||||
sql.append(" AND deviceSerialNumber = :serialNumber");
|
||||
}
|
||||
|
||||
+ query.prepare(sql);
|
||||
query.bindValue(":Vid", idVendor);
|
||||
query.bindValue(":Pid", idProduct);
|
||||
query.bindValue(":devType", (int)deviceType);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
From 5b329ca4e7610efb23b7077d5af201290bd3fb61 Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Mon, 3 Jul 2023 16:41:09 +0800
|
||||
Subject: [PATCH 2/6] 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
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复在resetUkey和析构函数中重复调用disConnectDev释放相同的设备句柄从而导致崩溃的问题
|
||||
---
|
||||
ukey-manager/ukey-manager.cpp | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/ukey-manager/ukey-manager.cpp b/ukey-manager/ukey-manager.cpp
|
||||
index 30cd23a..d815d72 100644
|
||||
--- a/ukey-manager/ukey-manager.cpp
|
||||
+++ b/ukey-manager/ukey-manager.cpp
|
||||
@@ -62,7 +62,6 @@ bool UkeyManager::initDriver()
|
||||
ULONG UkeyManager::resetUkey()
|
||||
{
|
||||
ULONG ulReval = m_driver->resetUkey(m_devHandle);
|
||||
- m_driver->disConnectDev(m_devHandle);
|
||||
return ulReval;
|
||||
}
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
1752
0003-refactor-Modify-the-code-according-to-the-https-gite.patch
Normal file
1752
0003-refactor-Modify-the-code-according-to-the-https-gite.patch
Normal file
File diff suppressed because it is too large
Load Diff
100
0004-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch
Normal file
100
0004-fix-mf-iristar-driver-when-the-iris-face-integrated-.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From 444f3d097fa42fbfde53004ffe0404bb31313bac Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Tue, 16 Jan 2024 11:57:08 +0800
|
||||
Subject: [PATCH 4/6] 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
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 虹膜人脸一体设备在拔出时无法释放内存并且会阻塞进程,当释放人脸虹膜设备对象时,如果当前设备已经被拔出了,就重启服务,释放资源。
|
||||
|
||||
Related #25243
|
||||
---
|
||||
.../multi-function/mf-iristar-driver.cpp | 41 +++++++++++++++----
|
||||
1 file changed, 34 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/driver/multi-function/mf-iristar-driver.cpp b/src/driver/multi-function/mf-iristar-driver.cpp
|
||||
index 7c11d43..f65af2d 100644
|
||||
--- a/src/driver/multi-function/mf-iristar-driver.cpp
|
||||
+++ b/src/driver/multi-function/mf-iristar-driver.cpp
|
||||
@@ -17,12 +17,14 @@
|
||||
#include <qt5-log-i.h>
|
||||
#include <sys/time.h>
|
||||
#include <QCryptographicHash>
|
||||
+#include <QProcess>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include "auth-enum.h"
|
||||
#include "auth_device_adaptor.h"
|
||||
#include "driver/driver-factory.h"
|
||||
#include "feature-db.h"
|
||||
+#include "utils.h"
|
||||
|
||||
namespace Kiran
|
||||
{
|
||||
@@ -46,6 +48,7 @@ std::function<Ret(Params...)> Callback<Ret(Params...)>::func;
|
||||
|
||||
#define IRIS_IS_DRIVER_LIB "libirs_sdk2.so"
|
||||
#define IRIS_IS_STARTUP_CONFIG_PATH "/etc/kiran-authentication-devices-sdk/iristar/config/sdkcfg.ini"
|
||||
+#define SYSTEMCTL_RESTART_SERVICE "systemctl restart kiran-authentication-devices.service"
|
||||
|
||||
#define IRIS_FEATURE_LEN 512 // 单个虹膜特征数据长度
|
||||
#define FACE_FEATURE_LEN 2048 // 单个人脸特征数据长度
|
||||
@@ -122,13 +125,18 @@ MFIriStarDriver::MFIriStarDriver(QObject *parent) : Driver{parent}
|
||||
|
||||
MFIriStarDriver::~MFIriStarDriver()
|
||||
{
|
||||
- if (m_driverLib->isLoaded && m_irsHandle)
|
||||
- {
|
||||
- bool enable = false;
|
||||
- m_driverLib->IRS_control(m_irsHandle, IRS_CONTROL_IRIS_LIGHT, &enable, sizeof(enable));
|
||||
- m_driverLib->IRS_control(m_irsHandle, IRS_CONTROL_CANCEL_OPR, NULL, 0); // 停止当前正在进行的流程
|
||||
- m_driverLib->IRS_releaseInstance(m_irsHandle);
|
||||
- }
|
||||
+ KLOG_DEBUG() << "destroy IriStar driver";
|
||||
+ /*
|
||||
+ if (m_driverLib->isLoaded && m_irsHandle )
|
||||
+ {
|
||||
+ KLOG_DEBUG() << "start release IriStar Instance";
|
||||
+ bool enable = false;
|
||||
+ m_driverLib->IRS_control(m_irsHandle, IRS_CONTROL_IRIS_LIGHT, &enable, sizeof(enable));
|
||||
+ m_driverLib->IRS_control(m_irsHandle, IRS_CONTROL_CANCEL_OPR, NULL, 0); // 停止当前正在进行的流程
|
||||
+ m_driverLib->IRS_releaseInstance(m_irsHandle);
|
||||
+ KLOG_DEBUG() << "release IriStar Instance end";
|
||||
+ }
|
||||
+ */
|
||||
|
||||
if (m_libHandle)
|
||||
{
|
||||
@@ -137,6 +145,25 @@ MFIriStarDriver::~MFIriStarDriver()
|
||||
}
|
||||
|
||||
m_driverLib.clear();
|
||||
+
|
||||
+ /**
|
||||
+ * FIXME:
|
||||
+ * 1、IriStart 设备不支持热插拔
|
||||
+ * 当设备拔出后,调用SDK中的IRS_releaseInstance释放资源,IRS_releaseInstance会搜索设备,如果没有搜索到设备,将一直循环搜索设备,导致进程卡死
|
||||
+ * 如果设备突然被拔出,则IRS_releaseInstance函数无效且一直无法释放资源,造成内存泄漏
|
||||
+ *
|
||||
+ * 2、注意,即使在设备存在的情况下,调用IRS_releaseInstance 释放资源,也会失败
|
||||
+ * 注意,即使在设备存在的情况下,调用IRS_releaseInstance 释放资源,也会失败,在IRS_releaseInstance函数中阻塞
|
||||
+ * 查看堆栈,调用关系为 IRS_releaseInstance -> pthread_cond_destroy ,发现最终阻塞在pthread_cond_destroy中
|
||||
+ * 查阅资料,pthread_cond_destroy 用来销毁条件变量,但是销毁其他线程正在等待的cond将导致不确定行为,并阻塞。
|
||||
+ * 该设备驱动在运行过程中会创建非常多的线程,由于设备SDK提供商对线程操作的不合理,导致了阻塞。
|
||||
+ *
|
||||
+ * 由于不知道驱动SDK的源代码和具体线程操作逻辑,此问题无法修复,只能规避
|
||||
+ * 因此,在释放对象时,暂时重启设备管理服务,以释放资源,进行规避
|
||||
+ */
|
||||
+ KLOG_INFO() << "restart the service, because IriStart device cannot release resources";
|
||||
+ QProcess process;
|
||||
+ process.startDetached(SYSTEMCTL_RESTART_SERVICE);
|
||||
}
|
||||
|
||||
bool MFIriStarDriver::initDriver(const QString &libPath)
|
||||
--
|
||||
2.33.0
|
||||
|
||||
386
0005-fix-When-the-driver-is-enabled-the-device-is-scanned.patch
Normal file
386
0005-fix-When-the-driver-is-enabled-the-device-is-scanned.patch
Normal file
@ -0,0 +1,386 @@
|
||||
From eb1053adb52785aa02992690d5444d4068e0e780 Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Wed, 17 Jan 2024 16:32:34 +0800
|
||||
Subject: [PATCH 5/6] 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
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 启用驱动时,扫描当前设备,创建对应的设备对象;禁用驱动时,释放当前对应的设备对象
|
||||
|
||||
Close #25387
|
||||
---
|
||||
include/auth-enum.h | 15 +++-
|
||||
src/auth-device-manager.cpp | 69 +++++++++++++------
|
||||
src/auth-device-manager.h | 1 +
|
||||
src/config-helper.cpp | 48 +++++++++++++
|
||||
src/config-helper.h | 6 +-
|
||||
src/device/device-creator.cpp | 1 +
|
||||
src/device/finger-vein/fv-sd-device.cpp | 1 +
|
||||
src/device/fingerprint/fp-zk-device.cpp | 1 +
|
||||
.../multi-function/mf-iristar-device.cpp | 2 +
|
||||
src/device/ukey/ukey-skf-device.cpp | 1 +
|
||||
src/utils.cpp | 24 +++++++
|
||||
src/utils.h | 4 ++
|
||||
12 files changed, 149 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/include/auth-enum.h b/include/auth-enum.h
|
||||
index b9e9e49..1b663cd 100644
|
||||
--- a/include/auth-enum.h
|
||||
+++ b/include/auth-enum.h
|
||||
@@ -26,7 +26,7 @@ namespace Kiran
|
||||
#define UKEY_CONTAINER_NAME "1003-3001"
|
||||
|
||||
#define UKEY_SKF_DRIVER_NAME "ukey-skf"
|
||||
-#define IRISTAR_DRIVER_NAME "irs_sdk2"
|
||||
+#define IRISTAR_DRIVER_NAME "irs_sdk2"
|
||||
#define FINGERPRINT_ZK_DRIVER_NAME "zkfp"
|
||||
#define FINGER_VEIN_SD_DRIVER_NAME "sdfv"
|
||||
|
||||
@@ -55,6 +55,19 @@ struct DeviceInfo
|
||||
|
||||
return false;
|
||||
};
|
||||
+
|
||||
+ bool operator==(const DeviceInfo& dev) const
|
||||
+ {
|
||||
+ if (this->idVendor == dev.idVendor &&
|
||||
+ this->idProduct == dev.idProduct)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
};
|
||||
|
||||
enum GeneralResult
|
||||
diff --git a/src/auth-device-manager.cpp b/src/auth-device-manager.cpp
|
||||
index a9f5fb0..481caf3 100644
|
||||
--- a/src/auth-device-manager.cpp
|
||||
+++ b/src/auth-device-manager.cpp
|
||||
@@ -183,43 +183,53 @@ void AuthDeviceManager::onRemove(const QDBusMessage& message, const QString& fea
|
||||
// TODO:是否需要监听配置文件的改变
|
||||
void AuthDeviceManager::onSetEnableDriver(const QDBusMessage& message, const QString& driver_name, bool enable)
|
||||
{
|
||||
+ KLOG_DEBUG() << "set driver name:" << driver_name << "enable:" << enable;
|
||||
QStringList driverList = ConfigHelper::getDriverList();
|
||||
QDBusMessage replyMessage;
|
||||
|
||||
- do
|
||||
+ if (!driverList.contains(driver_name))
|
||||
{
|
||||
- if (!driverList.contains(driver_name))
|
||||
- {
|
||||
- replyMessage = message.createErrorReply(QDBusError::Failed, "No driver with the corresponding name was found.");
|
||||
- break;
|
||||
- }
|
||||
- ConfigHelper::setDriverEnabled(driver_name, enable);
|
||||
- replyMessage = message.createReply();
|
||||
+ replyMessage = message.createErrorReply(QDBusError::Failed, "No driver with the corresponding name was found.");
|
||||
+ QDBusConnection::systemBus().send(replyMessage);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bool oldDriverStatus = ConfigHelper::driverEnabled(driver_name);
|
||||
|
||||
- if (enable)
|
||||
+ ConfigHelper::setDriverEnabled(driver_name, enable);
|
||||
+ replyMessage = message.createReply();
|
||||
+ QDBusConnection::systemBus().send(replyMessage);
|
||||
+
|
||||
+ // 若之前驱动已经关闭,启用驱动后,遍历设备,加载可用的设备
|
||||
+ if (enable && !oldDriverStatus)
|
||||
+ {
|
||||
+ //NOTE:注意,此处是从配置文件中读出所支持的Vid和Pid,获取不到所支持的设备的BusPath,因此这里返回的DeviceInfo的BusPath为空
|
||||
+ QList<DeviceInfo> devices = ConfigHelper::getDeviceIDsSupportedByDriver(driver_name);
|
||||
+ for (auto device : devices)
|
||||
{
|
||||
- break;
|
||||
+ if(!Utils::isExistDevice(device.idVendor,device.idProduct))
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ device.busPath = Utils::getBusPath(device.idVendor,device.idProduct);
|
||||
+ handleDeviceAdded(device);
|
||||
}
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- // 驱动被禁用,将当前正在使用的设备释放掉
|
||||
+ // 若之前驱动开启,现在关闭驱动,将当前正在使用的设备释放掉
|
||||
+ if (!enable && oldDriverStatus)
|
||||
+ {
|
||||
auto devices = m_deviceMap.values();
|
||||
- Q_FOREACH (AuthDevicePtr device, devices)
|
||||
+ for (AuthDevicePtr device : devices)
|
||||
{
|
||||
if (device->driverName() != driver_name)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
- QString deviceID = device->deviceID();
|
||||
- int deviceType = device->deviceType();
|
||||
- device->deleteLater();
|
||||
- QString key = m_deviceMap.key(device);
|
||||
- m_deviceMap.remove(key);
|
||||
- Q_EMIT m_dbusAdaptor->DeviceDeleted(deviceType, deviceID);
|
||||
- KLOG_INFO() << QString("destroyed deviceType: %1, deviceID:%2").arg(deviceType).arg(deviceID);
|
||||
+ removeDevice(device);
|
||||
}
|
||||
- } while (false);
|
||||
-
|
||||
- QDBusConnection::systemBus().send(replyMessage);
|
||||
+ }
|
||||
}
|
||||
|
||||
AuthDeviceList AuthDeviceManager::createDevices(const DeviceInfo& deviceInfo)
|
||||
@@ -258,6 +268,21 @@ AuthDeviceList AuthDeviceManager::createDevices(const DeviceInfo& deviceInfo)
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
+void AuthDeviceManager::removeDevice(QSharedPointer<AuthDevice> device)
|
||||
+{
|
||||
+ QString deviceID = device->deviceID();
|
||||
+ int deviceType = device->deviceType();
|
||||
+ QString deviceName = device->driverName();
|
||||
+
|
||||
+ QString key = m_deviceMap.key(device);
|
||||
+ int count = m_deviceMap.remove(key);
|
||||
+ KLOG_DEBUG() << "remove device count:" << count;
|
||||
+
|
||||
+ device->deleteLater();
|
||||
+ Q_EMIT m_dbusAdaptor->DeviceDeleted(deviceType, deviceID);
|
||||
+ KLOG_INFO() << QString("destroyed deviceName: %1 , bus path : %2 , deviceType: %3, deviceID:%4").arg(deviceName).arg(key).arg(deviceType).arg(deviceID);
|
||||
+}
|
||||
+
|
||||
CHECK_AUTH_WITH_1ARGS(AuthDeviceManager, Remove, onRemove, AUTH_USER_ADMIN, const QString&)
|
||||
CHECK_AUTH_WITH_2ARGS(AuthDeviceManager, SetEnableDriver, onSetEnableDriver, AUTH_USER_ADMIN, const QString&, bool)
|
||||
|
||||
diff --git a/src/auth-device-manager.h b/src/auth-device-manager.h
|
||||
index 95e68e9..150a372 100644
|
||||
--- a/src/auth-device-manager.h
|
||||
+++ b/src/auth-device-manager.h
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
void onRemove(const QDBusMessage &message, const QString &feature_id);
|
||||
void onSetEnableDriver(const QDBusMessage &message, const QString &driver_name, bool enable);
|
||||
QList<QSharedPointer<AuthDevice>> createDevices(const DeviceInfo &deviceInfo);
|
||||
+ void removeDevice(QSharedPointer<AuthDevice> device);
|
||||
|
||||
private:
|
||||
static AuthDeviceManager *m_instance;
|
||||
diff --git a/src/config-helper.cpp b/src/config-helper.cpp
|
||||
index 8fc5a47..880296b 100644
|
||||
--- a/src/config-helper.cpp
|
||||
+++ b/src/config-helper.cpp
|
||||
@@ -113,6 +113,18 @@ bool ConfigHelper::driverEnabled(const QString &vid, const QString &pid)
|
||||
return enable;
|
||||
}
|
||||
|
||||
+bool ConfigHelper::driverEnabled(const QString &driverName)
|
||||
+{
|
||||
+ bool enable = false;
|
||||
+ QSettings confSettings(DRIVER_CONF, QSettings::NativeFormat);
|
||||
+ QStringList driverList = confSettings.childGroups();
|
||||
+ if (driverList.contains(driverName))
|
||||
+ {
|
||||
+ enable = confSettings.value(QString("%1/Enable").arg(driverName)).toBool();
|
||||
+ }
|
||||
+ return enable;
|
||||
+}
|
||||
+
|
||||
void ConfigHelper::setDriverEnabled(const QString &driverName, bool enable)
|
||||
{
|
||||
QSettings confSettings(DRIVER_CONF, QSettings::NativeFormat);
|
||||
@@ -147,4 +159,40 @@ bool ConfigHelper::isDeviceSupported(const QString &vid, const QString &pid)
|
||||
return false;
|
||||
}
|
||||
|
||||
+QList<DeviceInfo> ConfigHelper::getDeviceIDsSupportedByDriver(const QString &driverName)
|
||||
+{
|
||||
+ QList<DeviceInfo> deviceInfos;
|
||||
+
|
||||
+ QSettings confSettings(DEVICE_CONF, QSettings::NativeFormat);
|
||||
+ QStringList deviceList = confSettings.childGroups();
|
||||
+ for (auto deviceConf : deviceList)
|
||||
+ {
|
||||
+ confSettings.beginGroup(deviceConf);
|
||||
+ if (confSettings.value("Driver").toString() != driverName)
|
||||
+ {
|
||||
+ confSettings.endGroup();
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ QStringList idList = confSettings.value("Id").toStringList();
|
||||
+ for (const QString &id : idList)
|
||||
+ {
|
||||
+ QStringList idItems = id.split(":");
|
||||
+ if (idItems.count() != 2)
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ DeviceInfo deviceinfo;
|
||||
+ deviceinfo.idVendor = idItems.value(0);
|
||||
+ deviceinfo.idProduct = idItems.value(1);
|
||||
+
|
||||
+ deviceInfos << deviceinfo;
|
||||
+ }
|
||||
+ confSettings.endGroup();
|
||||
+ }
|
||||
+
|
||||
+ return deviceInfos;
|
||||
+}
|
||||
+
|
||||
} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
diff --git a/src/config-helper.h b/src/config-helper.h
|
||||
index 91cf895..0e1a5f5 100644
|
||||
--- a/src/config-helper.h
|
||||
+++ b/src/config-helper.h
|
||||
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
#include <QString>
|
||||
+#include "auth-enum.h"
|
||||
|
||||
namespace Kiran
|
||||
{
|
||||
@@ -50,9 +51,12 @@ public:
|
||||
static QStringList getDriverList();
|
||||
|
||||
static bool driverEnabled(const QString &vid, const QString &pid);
|
||||
+ static bool driverEnabled(const QString & driverName);
|
||||
+
|
||||
static void setDriverEnabled(const QString& driverName, bool enable);
|
||||
static bool isDeviceSupported(const QString &vid, const QString &pid);
|
||||
-
|
||||
+
|
||||
+ static QList<DeviceInfo> getDeviceIDsSupportedByDriver(const QString& driverName);
|
||||
private:
|
||||
};
|
||||
|
||||
diff --git a/src/device/device-creator.cpp b/src/device/device-creator.cpp
|
||||
index 1fb760f..90ea201 100644
|
||||
--- a/src/device/device-creator.cpp
|
||||
+++ b/src/device/device-creator.cpp
|
||||
@@ -45,6 +45,7 @@ DeviceCereator::~DeviceCereator()
|
||||
{
|
||||
}
|
||||
|
||||
+//TODO:将设备的BusPath作为入參创建设备,处理存在多个一模一样(vid和pid相同)的设备同时存在的场景
|
||||
AuthDeviceList DeviceCereator::createDevices(const QString &vid, const QString &pid, DriverPtr driver)
|
||||
{
|
||||
AuthDeviceList deviceList;
|
||||
diff --git a/src/device/finger-vein/fv-sd-device.cpp b/src/device/finger-vein/fv-sd-device.cpp
|
||||
index 442f227..80ca4be 100644
|
||||
--- a/src/device/finger-vein/fv-sd-device.cpp
|
||||
+++ b/src/device/finger-vein/fv-sd-device.cpp
|
||||
@@ -42,6 +42,7 @@ FVSDDevice::FVSDDevice(const QString &vid, const QString &pid, DriverPtr driver,
|
||||
|
||||
FVSDDevice::~FVSDDevice()
|
||||
{
|
||||
+ KLOG_DEBUG() << "destroy FVSD Device";
|
||||
if (m_driver->isLoaded())
|
||||
{
|
||||
acquireFeatureStop();
|
||||
diff --git a/src/device/fingerprint/fp-zk-device.cpp b/src/device/fingerprint/fp-zk-device.cpp
|
||||
index 3a818f3..659e9ab 100644
|
||||
--- a/src/device/fingerprint/fp-zk-device.cpp
|
||||
+++ b/src/device/fingerprint/fp-zk-device.cpp
|
||||
@@ -49,6 +49,7 @@ FPZKDevice::FPZKDevice(const QString& vid, const QString& pid, DriverPtr driver,
|
||||
// 析构时对设备进行资源回收
|
||||
FPZKDevice::~FPZKDevice()
|
||||
{
|
||||
+ KLOG_DEBUG() << "destroy FPZK Device";
|
||||
acquireFeatureStop();
|
||||
|
||||
if (m_driver->isLoaded())
|
||||
diff --git a/src/device/multi-function/mf-iristar-device.cpp b/src/device/multi-function/mf-iristar-device.cpp
|
||||
index 27e1809..58ed89c 100644
|
||||
--- a/src/device/multi-function/mf-iristar-device.cpp
|
||||
+++ b/src/device/multi-function/mf-iristar-device.cpp
|
||||
@@ -33,6 +33,7 @@ MFIriStarDevice::MFIriStarDevice(const QString &vid, const QString &pid, DriverP
|
||||
m_driver = driver.dynamicCast<MFIriStarDriver>();
|
||||
m_driver->ref();
|
||||
m_driver->setDeviceInfo(vid,pid);
|
||||
+ setDriverName(IRISTAR_DRIVER_NAME);
|
||||
|
||||
qRegisterMetaType<EnrollProcess>("EnrollProcess");
|
||||
qRegisterMetaType<IdentifyProcess>("IdentifyProcess");
|
||||
@@ -44,6 +45,7 @@ MFIriStarDevice::MFIriStarDevice(const QString &vid, const QString &pid, DriverP
|
||||
|
||||
MFIriStarDevice::~MFIriStarDevice()
|
||||
{
|
||||
+ KLOG_DEBUG() << "destroy MFIriStar Device";
|
||||
m_driver->unref();
|
||||
if (m_driver->refCount() <= 0)
|
||||
{
|
||||
diff --git a/src/device/ukey/ukey-skf-device.cpp b/src/device/ukey/ukey-skf-device.cpp
|
||||
index 82bd13d..c8feb7b 100644
|
||||
--- a/src/device/ukey/ukey-skf-device.cpp
|
||||
+++ b/src/device/ukey/ukey-skf-device.cpp
|
||||
@@ -51,6 +51,7 @@ UKeySKFDevice::UKeySKFDevice(const QString &vid, const QString &pid, DriverPtr d
|
||||
|
||||
UKeySKFDevice::~UKeySKFDevice()
|
||||
{
|
||||
+ KLOG_DEBUG() << "destroy UKey SKF Device";
|
||||
int index = m_existingSerialNumber.indexOf(deviceSerialNumber());
|
||||
m_existingSerialNumber.removeAt(index);
|
||||
KLOG_DEBUG() << "destory device, serialNumber:" << deviceSerialNumber();
|
||||
diff --git a/src/utils.cpp b/src/utils.cpp
|
||||
index 3061263..0e11b04 100644
|
||||
--- a/src/utils.cpp
|
||||
+++ b/src/utils.cpp
|
||||
@@ -101,5 +101,29 @@ QJsonValue getValueFromJsonString(const QString& json, const QString& key)
|
||||
return jsonObject.value(key);
|
||||
}
|
||||
|
||||
+bool isExistDevice(const QString& idVendor, const QString& idProduct)
|
||||
+{
|
||||
+ DeviceInfo deviceInfo;
|
||||
+ deviceInfo.idVendor = idVendor;
|
||||
+ deviceInfo.idProduct = idProduct;
|
||||
+ deviceInfo.busPath = "";
|
||||
+ QList<DeviceInfo> devices = enumerateDevices();
|
||||
+ return devices.contains(deviceInfo);
|
||||
+}
|
||||
+
|
||||
+QString getBusPath(const QString& idVendor, const QString& idProduct)
|
||||
+{
|
||||
+ QList<DeviceInfo> devices = enumerateDevices();
|
||||
+ for (auto device : devices)
|
||||
+ {
|
||||
+ if (device.idVendor == idVendor &&
|
||||
+ device.idProduct == idProduct)
|
||||
+ {
|
||||
+ return device.busPath;
|
||||
+ }
|
||||
+ }
|
||||
+ return QString();
|
||||
+}
|
||||
+
|
||||
} // namespace Utils
|
||||
} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
diff --git a/src/utils.h b/src/utils.h
|
||||
index 1c28065..9ba5598 100644
|
||||
--- a/src/utils.h
|
||||
+++ b/src/utils.h
|
||||
@@ -28,5 +28,9 @@ QString getDeviceName(const QString& idVendor, const QString& idProduct);
|
||||
|
||||
QJsonValue getValueFromJsonString(const QString& json, const QString& key);
|
||||
|
||||
+bool isExistDevice(const QString& idVendor, const QString& idProduct);
|
||||
+
|
||||
+QString getBusPath(const QString& idVendor, const QString& idProduct);
|
||||
+
|
||||
} // namespace Utils
|
||||
} // namespace Kiran
|
||||
--
|
||||
2.33.0
|
||||
|
||||
29
0006-fix-build-fix-file-install-path-error.patch
Normal file
29
0006-fix-build-fix-file-install-path-error.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From a0488124de99b326d9abc38228251146ed6cdc6d Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Thu, 18 Jan 2024 11:25:40 +0800
|
||||
Subject: [PATCH 6/6] fix(build):fix file install path error
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复文件安装路径错误
|
||||
---
|
||||
data/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
|
||||
index 617cd14..a6ae20b 100644
|
||||
--- a/data/CMakeLists.txt
|
||||
+++ b/data/CMakeLists.txt
|
||||
@@ -11,7 +11,7 @@ endif()
|
||||
file(GLOB CONF_FILES ${PROJECT_SOURCE_DIR}/data/com*.conf)
|
||||
|
||||
foreach(CONF_FILE IN LISTS CONF_FILES)
|
||||
- install(FILES ${CONF_FILE} DESTINATION ${SYSCONFDIR}/dbus-1/system.d)
|
||||
+ install(FILES ${CONF_FILE} DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/dbus-1/system.d)
|
||||
endforeach()
|
||||
|
||||
configure_file(kiran-authentication-devices.service.in
|
||||
--
|
||||
2.33.0
|
||||
|
||||
Binary file not shown.
BIN
kiran-authentication-devices-2.5.2.tar.gz
Normal file
BIN
kiran-authentication-devices-2.5.2.tar.gz
Normal file
Binary file not shown.
@ -1,18 +1,18 @@
|
||||
Name: kiran-authentication-devices
|
||||
|
||||
Version: 2.5.1
|
||||
Release: 6
|
||||
Version: 2.5.2
|
||||
Release: 3
|
||||
Summary: Kiran Authentication Devices
|
||||
|
||||
License: MulanPSL-2.0
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
Patch0001: 0001-fix-mf-iristar-driver-Fix-compilation-issues-with-st.patch
|
||||
Patch0002: 0001-fix-ukey-Fix-the-issue-where-only-one-ukey-can-be-bo.patch
|
||||
Patch0003: 0001-fix-feature-db-Fix-the-issue-of-not-obtaining-featur.patch
|
||||
Patch0004: 0001-fix-ukey-Fix-the-issue-of-duplicate-binding-of-the-s.patch
|
||||
Patch0005: 0001-fix-kiran-authentication-devices-fix-QUuid-WithoutBr.patch
|
||||
|
||||
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
|
||||
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc-c++
|
||||
@ -59,8 +59,9 @@ systemctl enable kiran-authentication-devices.service
|
||||
%{_datadir}/dbus-1/system-services/com.kylinsec.Kiran.AuthDevice.service
|
||||
%{_sysconfdir}/dbus-1/system.d/com.kylinsec.Kiran.AuthDevice.Device.conf
|
||||
%{_sysconfdir}/dbus-1/system.d/com.kylinsec.Kiran.AuthDevice.conf
|
||||
%{_sysconfdir}/kiran-authentication-devices/drivers.conf
|
||||
%{_sysconfdir}/kiran-authentication-devices/third-party-devices.conf
|
||||
%{_sysconfdir}/kiran-authentication-devices/driver.conf
|
||||
%{_sysconfdir}/kiran-authentication-devices/device.conf
|
||||
%{_sysconfdir}/kiran-authentication-devices/ukey-manager.conf
|
||||
%{_usr}/lib/systemd/system/kiran-authentication-devices.service
|
||||
|
||||
%files devel
|
||||
@ -70,9 +71,22 @@ systemctl enable kiran-authentication-devices.service
|
||||
rm -rf ${buildroot}
|
||||
|
||||
%changelog
|
||||
* Thu Sep 7 2023 yinhongchang <yinhongchang@kylinsec.com.cn> - 2.5.1-6
|
||||
* Thu Jan 18 2024 luoqing <luoqing@kylinsec.com.cn> - 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
|
||||
- KYOS-B: 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 (#25243)
|
||||
- KYOS-B: 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. (#25387)
|
||||
- KYOS-B: fix file install path error
|
||||
|
||||
* Thu Sep 7 2023 yinhongchang <yinhongchang@kylinsec.com.cn> - 2.5.2-2
|
||||
- KYOS-F: fix QUuid::WithoutBraces for qt low version
|
||||
|
||||
* Wed Jun 28 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.2-1
|
||||
- KYOS-F: Fixed an issue where fish's UKey device could not Verify on arm machines
|
||||
- KYOS-F: Remove the context class;
|
||||
- KYOS-F: ConfigHelper is responsible for obtaining device configuration information based on the id, and DeviceCreator is responsible for creating the device;
|
||||
- KYOS-F: After the vid and pid are obtained, the configuration file is read. The driver name in the configuration file can generate the specific driver object and device object
|
||||
|
||||
* Fri Jun 16 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.1-5
|
||||
- KYOS-F: Fix the issue of duplicate binding of the same UKey device (#I78P3F)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user