add trackball

Signed-off-by: YOUR_NAME <huangkai71@huawei.com>
This commit is contained in:
YOUR_NAME
2021-09-06 09:32:45 +00:00
parent c699e67f08
commit 89ec00f009
+14 -5
View File
@@ -114,12 +114,10 @@ static int32_t SetInputDevAbsAttr(InputDevice *inputDev, HidInfo *info)
return HDF_SUCCESS;
}
static void SetInputDevAbility(InputDevice *inputDev)
static int32_t GetInfoFromCache(HidInfo *info)
{
HidInfo *info = NULL;
int32_t id = 0;
uint32_t len;
int32_t ret;
int32_t id = 0;
while (id < MAX_INPUT_DEV_NUM) {
if(g_cachedInfo[id] != NULL && !strcmp(inputDev->devName, g_cachedInfo[id]->devName)) {
info = g_cachedInfo[id];
@@ -129,8 +127,19 @@ static void SetInputDevAbility(InputDevice *inputDev)
}
if (id == MAX_INPUT_DEV_NUM || info == NULL) {
HDF_LOGE("%s: match cached info failed", __func__);
return;
return HDF_FAILURE;
}
return HDF_SUCCESS;
}
static void SetInputDevAbility(InputDevice *inputDev)
{
HidInfo *info = NULL;
uint32_t len;
int32_t ret;
ret = GetInfoFromCache(info);
MEMCPY_CHECK_RETURN(ret);
len = sizeof(unsigned long);
ret = memcpy_s(inputDev->abilitySet.devProp, len * BITS_TO_LONG(INPUT_PROP_CNT),
info->devProp, len * BITS_TO_LONG(INPUT_PROP_CNT));