diff --git a/common/include/constants_dinput.h b/common/include/constants_dinput.h index af2e06c..f4b2a44 100644 --- a/common/include/constants_dinput.h +++ b/common/include/constants_dinput.h @@ -136,8 +136,9 @@ namespace DistributedInput { const std::string DINPUT_SPLIT_COMMA = ", "; - const char VIR_NODE_SPLIT = '|'; - const char VIR_NODE_PID_SPLIT = '/'; + const char VIR_NODE_SPLIT_CHAR = '|'; + const std::string VIR_NODE_SPLIT = "|"; + const std::string VIR_NODE_PID_SPLIT = "/"; const uint32_t VIR_NODE_PHY_LEN = 3; const uint32_t VIR_NODE_PHY_DEVID_IDX = 1; const uint32_t VIR_NODE_PHY_DHID_IDX = 2; diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index c9e6c76..1250881 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -250,7 +250,7 @@ bool DistributedInputNodeManager::GetDevDhUniqueIdByFd(int fd, DhUniqueID &dhUnq DHLOGD("GetDevDhUniqueIdByFd physicalPath %s.", physicalPath.c_str()); std::vector phyPathVec; - SplitStringToVector(physicalPath, VIR_NODE_SPLIT, phyPathVec); + SplitStringToVector(physicalPath, VIR_NODE_SPLIT_CHAR, phyPathVec); if (phyPathVec.size() != VIR_NODE_PHY_LEN) { DHLOGE("The physical path is invalid"); return false; @@ -405,18 +405,18 @@ void DistributedInputNodeManager::AddDeviceLocked(const std::string &networkId, int32_t DistributedInputNodeManager::CloseDeviceLocked(const std::string &devId, const std::string &dhId) { DHLOGI("CloseDeviceLocked called, deviceId=%s, dhId=%s", - GetAnonyString(networkId).c_str(), GetAnonyString(dhId).c_str()); + GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::lock_guard lock(virtualDeviceMapMutex_); DhUniqueID dhUniqueId = {devId, dhId}; std::map>::iterator iter = virtualDeviceMap_.find(dhUniqueId); if (iter != virtualDeviceMap_.end()) { DHLOGI("CloseDeviceLocked called success, deviceId=%s, dhId=%s", - GetAnonyString(networkId).c_str(), GetAnonyString(dhId).c_str()); + GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); virtualDeviceMap_.erase(iter); return DH_SUCCESS; } DHLOGE("CloseDeviceLocked called failure, deviceId=%s, dhId=%s", - GetAnonyString(networkId).c_str(), GetAnonyString(dhId).c_str()); + GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_CLOSE_DEVICE_FAIL; }