diff --git a/framework/model/input/driver/hdf_hid_adapter.c b/framework/model/input/driver/hdf_hid_adapter.c index 35f80e173e0c9ce72a345c0edad402c79c739872..26171509f5833ddcb7923efe5e47c8c09f03b6d8 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_LOGE("%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 adapter 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 ab23841107d7ecc610e5c69d5511656c48777449..e1ed415402c58b654c73fc831984c680533e3ceb 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);