mirror of
https://github.com/openharmony/drivers_framework.git
synced 2026-08-27 20:49:55 -04:00
@@ -31,7 +31,7 @@ void PushOnePackage(InputDevice *inputDev, uint32_t type, uint32_t code, int32_t
|
||||
HDF_LOGE("%s: parm is null", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
OsalMutexLock(&inputDev->mutex);
|
||||
package.type = type;
|
||||
package.code = code;
|
||||
package.value = value;
|
||||
@@ -65,4 +65,5 @@ void PushOnePackage(InputDevice *inputDev, uint32_t type, uint32_t code, int32_t
|
||||
HdfSbufFlush(inputDev->pkgBuf);
|
||||
inputDev->errFrameFlag = false;
|
||||
}
|
||||
OsalMutexUnlock(&inputDev->mutex);
|
||||
}
|
||||
@@ -167,6 +167,13 @@ static InputDevice* HidConstructInputDev(HidInfo *info)
|
||||
}
|
||||
(void)memset_s(inputDev, sizeof(InputDevice), 0, sizeof(InputDevice));
|
||||
|
||||
int32_t ret = OsalMutexInit(&inputDev->mutex);
|
||||
if (ret != HDF_SUCCESS) {
|
||||
HDF_LOGE("%s: Init mutex error", __func__);
|
||||
OsalMemFree(inputDev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inputDev->devType = info->devType;
|
||||
inputDev->devName = info->devName;
|
||||
SetInputDevAbility(inputDev);
|
||||
|
||||
@@ -335,8 +335,8 @@ void UnregisterInputDevice(InputDevice *inputDev)
|
||||
}
|
||||
HdfSBufRecycle(inputDev->eventBuf);
|
||||
inputDev->eventBuf = NULL;
|
||||
OsalMutexDestroy(&inputDev->mutex);
|
||||
OsalMemFree(inputDev);
|
||||
inputDev = NULL;
|
||||
OsalMutexUnlock(&g_inputManager->mutex);
|
||||
HDF_LOGI("%s: exit succ, devCount is %d", __func__, g_inputManager->devCount);
|
||||
return;
|
||||
|
||||
@@ -112,6 +112,7 @@ typedef struct InputDeviceInfo {
|
||||
void *pvtData;
|
||||
DevAttr attrSet;
|
||||
DevAbility abilitySet;
|
||||
struct OsalMutex mutex;
|
||||
struct InputDeviceInfo *next;
|
||||
} InputDevice;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
int32_t KeyIrqHandle(uint16_t intGpioNum, void *data)
|
||||
{
|
||||
uint16_t gpioValue;
|
||||
uint16_t gpioValue = 0;
|
||||
KeyDriver *driver = (KeyDriver *)data;
|
||||
if (driver == NULL) {
|
||||
return HDF_FAILURE;
|
||||
|
||||
@@ -294,7 +294,12 @@ static InputDevice *InputDeviceInstance(ChipDevice *chipDev)
|
||||
inputDev->devType = chipDev->driver->boardCfg->attr.devType;
|
||||
inputDev->devName = chipDev->driver->devName;
|
||||
|
||||
HDF_LOGI("%s: inputDev->devName = %s", __func__, inputDev->devName);
|
||||
int32_t ret = OsalMutexInit(&inputDev->mutex);
|
||||
if (ret != HDF_SUCCESS) {
|
||||
HDF_LOGE("%s: Init mutex error", __func__);
|
||||
OsalMemFree(inputDev);
|
||||
return NULL;
|
||||
}
|
||||
return inputDev;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user