diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index b87bc9a..6c8c75c 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -1174,7 +1174,7 @@ bool InputHub::CheckTouchPointRegion(struct input_event readBuffer[], const AbsI InputHub::Device::Device(int fd, int32_t id, const std::string& path, const InputDevice& identifier) : next(nullptr), fd(fd), id(id), path(path), identifier(identifier), - classes(0), enabled(true), isVirtual(fd < 0) { + classes(0), enabled(false), isShare(false), isVirtual(fd < 0) { memset_s(keyBitmask, sizeof(keyBitmask), 0, sizeof(keyBitmask)); memset_s(absBitmask, sizeof(absBitmask), 0, sizeof(absBitmask)); memset_s(relBitmask, sizeof(relBitmask), 0, sizeof(relBitmask)); diff --git a/interfaces/ipc/src/simulation_event_listener_proxy.cpp b/interfaces/ipc/src/simulation_event_listener_proxy.cpp index ff4b7c3..fad571b 100644 --- a/interfaces/ipc/src/simulation_event_listener_proxy.cpp +++ b/interfaces/ipc/src/simulation_event_listener_proxy.cpp @@ -46,11 +46,11 @@ int32_t SimulationEventListenerProxy::OnSimulationEvent(uint32_t type, uint32_t DHLOGE("SimulationEventListenerProxy write token valid failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } - if (!data.WriteInt32(type)) { + if (!data.WriteUint32(type)) { DHLOGE("SimulationEventListenerProxy write type failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } - if (!data.WriteInt32(code)) { + if (!data.WriteUint32(code)) { DHLOGE("SimulationEventListenerProxy write code failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } diff --git a/interfaces/ipc/src/simulation_event_listener_stub.cpp b/interfaces/ipc/src/simulation_event_listener_stub.cpp index 2a208dc..3fba1b5 100644 --- a/interfaces/ipc/src/simulation_event_listener_stub.cpp +++ b/interfaces/ipc/src/simulation_event_listener_stub.cpp @@ -38,8 +38,8 @@ int32_t SimulationEventListenerStub::OnRemoteRequest( ISimulationEventListener::Message msgCode = static_cast(code); switch (msgCode) { case ISimulationEventListener::Message::RESULT_ON: { - uint32_t eventType = data.ReadInt32(); - uint32_t eventCode = data.ReadInt32(); + uint32_t eventType = data.ReadUint32(); + uint32_t eventCode = data.ReadUint32(); int32_t eventValue = data.ReadInt32(); int32_t ret = OnSimulationEvent(eventType, eventCode, eventValue); if (!reply.WriteInt32(ret)) { diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index 2416c78..d93e35e 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -311,12 +311,15 @@ void DistributedInputSinkManager::DInputSinkListener::CheckKeyState(const int32_ std::string mouseNodePath; std::string dhid; DistributedInputCollector::GetInstance().GetMouseNodePath(vecStr, mouseNodePath, dhid); - if (mouseNodePath.empty()) { - DHLOGE("mouse Node Path is empty."); + + char canonicalPath[PATH_MAX + 1] = {0x00}; + if (mouseNodePath.length() == 0 || mouseNodePath.length() > PATH_MAX || + realpath(mouseNodePath.c_str(), canonicalPath) == nullptr) { + DHLOGE("mouse Nodepath check fail, error path: %s", mouseNodePath.c_str()); return; } - int fd = open(mouseNodePath.c_str(), O_RDONLY | O_NONBLOCK); + int fd = open(canonicalPath, O_RDONLY | O_NONBLOCK); if (fd < 0) { DHLOGE("open mouse Node Path error:", errno); return; diff --git a/services/source/inputinject/include/distributed_input_node_manager.h b/services/source/inputinject/include/distributed_input_node_manager.h index 5df7787..5644541 100644 --- a/services/source/inputinject/include/distributed_input_node_manager.h +++ b/services/source/inputinject/include/distributed_input_node_manager.h @@ -50,7 +50,7 @@ public: int32_t GetVirtualTouchScreenFd(); int32_t GetDeviceInfo(std::string &deviceId); - void GetDevicesInfoByType(const std::string &networkId, int32_t inputTypes, std::map &datas); + void GetDevicesInfoByType(const std::string &networkId, uint32_t inputTypes, std::map &datas); void GetDevicesInfoByDhId(std::vector dhidsVec, std::map &datas); void ProcessInjectEvent(const std::shared_ptr &rawEvent); diff --git a/services/source/inputinject/include/virtual_device.h b/services/source/inputinject/include/virtual_device.h index 6864d3e..d7dba66 100644 --- a/services/source/inputinject/include/virtual_device.h +++ b/services/source/inputinject/include/virtual_device.h @@ -45,7 +45,7 @@ public: std::string GetNetWorkId(); int32_t GetDeviceFd(); - int32_t GetDeviceType(); + uint16_t GetDeviceType(); protected: VirtualDevice(); diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index 50bc573..f14629f 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -274,7 +274,7 @@ int32_t DistributedInputNodeManager::GetDeviceInfo(std::string &deviceId) return DH_SUCCESS; } -void DistributedInputNodeManager::GetDevicesInfoByType(const std::string &networkId, int32_t inputTypes, +void DistributedInputNodeManager::GetDevicesInfoByType(const std::string &networkId, uint32_t inputTypes, std::map &datas) { uint32_t input_types_ = 0; diff --git a/services/source/inputinject/src/virtual_device.cpp b/services/source/inputinject/src/virtual_device.cpp index 13f7140..44df5e8 100644 --- a/services/source/inputinject/src/virtual_device.cpp +++ b/services/source/inputinject/src/virtual_device.cpp @@ -195,7 +195,7 @@ int32_t VirtualDevice::GetDeviceFd() return fd_; } -int32_t VirtualDevice::GetDeviceType() +uint16_t VirtualDevice::GetDeviceType() { return classes_; }