sim touchpad up

Signed-off-by: hwzhangchuang <zhangchuang.zhang@huawei.com>
This commit is contained in:
hwzhangchuang
2023-12-08 16:11:58 +08:00
parent 9cd8b99723
commit 9ff347a69c
5 changed files with 76 additions and 2 deletions
+13
View File
@@ -201,6 +201,12 @@ size_t InputHub::GetEvents(RawEvent *buffer, size_t bufferSize)
return event - buffer;
}
bool InputHub::IsTouchPad(Device *device)
{
return ((device->classes & INPUT_DEVICE_CLASS_TOUCH_MT) || (device->classes & INPUT_DEVICE_CLASS_TOUCH)) &&
IsTouchPad(device->identifier));
}
bool InputHub::IsTouchPad(const InputDevice &inputDevice)
{
std::string dhName = inputDevice.name;
@@ -254,6 +260,13 @@ void InputHub::RecordDeviceChangeStates(Device *device, struct input_event readB
if (event.type == EV_ABS && (event.code == ABS_MT_POSITION_Y || event.code == ABS_Y)) {
DInputState::GetInstance().RefreshABSPosition(event.descriptor, -1, event.value);
}
if (IsTouchPad(device) && event.type == EV_KEY && event.code == BTN_MOUSE && event.value == KEY_UP_STATE &&
!DInputState::GetInstance().IsDhIdDown(event.descriptor)) {
DHLOGI("Find touchpad UP state that not down effective at sink side, dhId: %s",
event.descriptor.c_str());
DInputState::GetInstance().SimulateTouchPadUpState(event.descriptor, event);
}
DHLOGD("RecordDeviceChangeStates end.");
}
}
+1
View File
@@ -151,6 +151,7 @@ private:
bool ContainsNonZeroByte(const uint8_t *array, uint32_t startIndex, uint32_t endIndex);
int64_t ProcessEventTimestamp(const input_event &event);
bool IsTouchPad(const InputDevice &inputDevice);
bool IsTouchPad(Device *device);
/*
* this macro is used to tell if "bit" is set in "array"