From 84dd6d1a800196bd8feb2dd300b9fa7635dc669b Mon Sep 17 00:00:00 2001 From: lixinsheng2 Date: Thu, 11 Jul 2024 12:34:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dinput=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lixinsheng2 --- framework/model/input/driver/hdf_hid_adapter.c | 17 ++++++++++++----- .../input/driver/hdf_input_device_manager.c | 9 +-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/framework/model/input/driver/hdf_hid_adapter.c b/framework/model/input/driver/hdf_hid_adapter.c index 35f80e173..419747e93 100644 --- a/framework/model/input/driver/hdf_hid_adapter.c +++ b/framework/model/input/driver/hdf_hid_adapter.c @@ -52,8 +52,15 @@ static bool HaveHidCache(void) static void LoadCachedHid(void) { + HDF_LOGI("%s: start", __func__); int32_t i = 0; int32_t ret; + static bool repeatLoadCache = false; + if (repeatLoadCache) { + HDF_LOGW("%s: no need repeat load cache", __func__); + return; + } + repeatLoadCache = true; if (!HaveHidCache()) { HDF_LOGI("%s: exit", __func__); return; @@ -221,6 +228,7 @@ static void DoRegisterInputDev(InputDevice* inputDev) void CacheHid(InputDevice* inputDev) { + HDF_LOGI("%s: Cache hid device", __func__); int32_t i = 0; while ((i < MAX_INPUT_DEV_NUM) && (cachedHid[i] != NULL)) { i++; @@ -241,7 +249,9 @@ void* HidRegisterHdfInputDev(HidInfo *info) return NULL; } + HDF_LOGI("%s: enter devName=%s, devType=%u", __func__, info->devName, info->devType); if (InputDriverLoaded()) { + LoadCachedHid(); DoRegisterInputDev(inputDev); } else { CacheHid(inputDev); @@ -312,12 +322,9 @@ void HidReportEvent(const void *inputDev, uint32_t type, uint32_t code, int32_t static int32_t HdfHIDDriverInit(struct HdfDeviceObject *device) { + HDF_LOGI("%s: Hid Driver Init", __func__); (void)device; - static bool cachedHidRegistered = false; - if (!cachedHidRegistered) { - cachedHidRegistered = true; - LoadCachedHid(); - } + LoadCachedHid(); return HDF_SUCCESS; } diff --git a/framework/model/input/driver/hdf_input_device_manager.c b/framework/model/input/driver/hdf_input_device_manager.c index ab2384110..e1ed41540 100644 --- a/framework/model/input/driver/hdf_input_device_manager.c +++ b/framework/model/input/driver/hdf_input_device_manager.c @@ -108,21 +108,13 @@ static void HotPlugNotify(const InputDevice *inputDev, uint32_t status) static int32_t CreateDeviceNode(InputDevice *inputDev) { - static bool existNonHid = false ; if (IsHidDevice(inputDev)) { - if (!existNonHid) { - CacheHid(inputDev); - HDF_LOGI("%s: is first hid dev add cache, devId is %d ", __func__, inputDev->devId); - return HDF_SUCCESS; - } HDF_LOGI("%s: prepare to register hdf device", __func__); inputDev->hdfDevObj = HidRegisterHdfDevice(inputDev); if (inputDev->hdfDevObj == NULL) { return HDF_DEV_ERR_NO_DEVICE; } inputDev->hdfDevObj->priv = (void *)inputDev; - } else { - existNonHid = true ; } HDF_LOGI("%s: create node succ, devId is %d ", __func__, inputDev->devId); @@ -334,6 +326,7 @@ int32_t RegisterInputDevice(InputDevice *inputDev) HDF_LOGE("%s: dev manager is null or initialized failed", __func__); return HDF_FAILURE; } + HDF_LOGI("%s: enter devName=%s, devType=%u", __func__, inputDev->devName, inputDev->devType); OsalMutexLock(&g_inputManager->mutex); ret = AllocDeviceID(inputDev); -- Gitee