diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index b51802b..f6d2ddc 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -613,14 +613,14 @@ int32_t InputHub::QueryLocalTouchScreenInfo(int fd) info.localAbsInfo.absXMax = absInfo.maximum; info.localAbsInfo.absMtPositionXMin = absInfo.minimum; info.localAbsInfo.absMtPositionXMax = absInfo.maximum; - info.sinkPhyWidth = absInfo.maximum + 1; + info.sinkPhyWidth = (uint32_t)(absInfo.maximum + 1); ioctl(fd, EVIOCGABS(ABS_MT_POSITION_Y), &absInfo); info.localAbsInfo.absYMin = absInfo.minimum; info.localAbsInfo.absYMax = absInfo.maximum; info.localAbsInfo.absMtPositionYMin = absInfo.minimum; info.localAbsInfo.absMtPositionYMax = absInfo.maximum; - info.sinkPhyHeight = absInfo.maximum + 1; + info.sinkPhyHeight = (uint32_t)(absInfo.maximum + 1); ioctl(fd, EVIOCGABS(ABS_PRESSURE), &absInfo); info.localAbsInfo.absPressureMin = absInfo.minimum; @@ -1009,12 +1009,12 @@ void InputHub::HandleTouchScreenEvent(struct input_event readBuffer[], const siz for (size_t j = iter.first; j <= iter.second; j++) { struct input_event &iev = readBuffer[j]; if (iev.code == ABS_MT_POSITION_X) { - absX = iev.value; - absXIndex = j; + absX = (uint32_t)iev.value; + absXIndex = (int32_t)j; } if (iev.code == ABS_MT_POSITION_Y) { - absY = iev.value; - absYIndex = j; + absY = (uint32_t)iev.value; + absYIndex = (int32_t)j; } } diff --git a/services/source/inputinject/src/virtual_touchscreen.cpp b/services/source/inputinject/src/virtual_touchscreen.cpp index 4d6e570..49c4e92 100644 --- a/services/source/inputinject/src/virtual_touchscreen.cpp +++ b/services/source/inputinject/src/virtual_touchscreen.cpp @@ -40,12 +40,12 @@ VirtualTouchScreen::VirtualTouchScreen(const InputDevice& event, LocalAbsInfo& a uint32_t phyHeight) : VirtualDevice(event) { dev_.absmin[ABS_X] = 0; - dev_.absmax[ABS_X] = phyWidth; + dev_.absmax[ABS_X] = (int32_t)phyWidth; dev_.absfuzz[ABS_X] = 0; dev_.absflat[ABS_X] = 0; dev_.absmin[ABS_Y] = 0; - dev_.absmax[ABS_Y] = phyHeight; + dev_.absmax[ABS_Y] = (int32_t)phyHeight; dev_.absfuzz[ABS_Y] = 0; dev_.absflat[ABS_Y] = 0; @@ -70,12 +70,12 @@ VirtualTouchScreen::VirtualTouchScreen(const InputDevice& event, LocalAbsInfo& a dev_.absflat[ABS_MT_ORIENTATION] = 0; dev_.absmin[ABS_MT_POSITION_X] = 0; - dev_.absmax[ABS_MT_POSITION_X] = phyWidth; + dev_.absmax[ABS_MT_POSITION_X] = (int32_t)phyWidth; dev_.absfuzz[ABS_MT_POSITION_X] = 0; dev_.absflat[ABS_MT_POSITION_X] = 0; dev_.absmin[ABS_MT_POSITION_Y] = 0; - dev_.absmax[ABS_MT_POSITION_Y] = phyHeight; + dev_.absmax[ABS_MT_POSITION_Y] = (int32_t)phyHeight; dev_.absfuzz[ABS_MT_POSITION_Y] = 0; dev_.absflat[ABS_MT_POSITION_Y] = 0; diff --git a/services/source/transport/src/distributed_input_source_transport.cpp b/services/source/transport/src/distributed_input_source_transport.cpp index 8f5266a..594f721 100644 --- a/services/source/transport/src/distributed_input_source_transport.cpp +++ b/services/source/transport/src/distributed_input_source_transport.cpp @@ -375,8 +375,8 @@ void DistributedInputSourceTransport::StartLatencyCount(const std::string& devic while (isLatencyThreadRunning_.load()) { if (sendNum_ >= INPUT_LATENCY_DELAY_TIMES) { uint64_t latency = (uint64_t)(deltaTimeAll_ / 2 / INPUT_LATENCY_DELAY_TIMES); - DHLOGI("LatencyCount average single-channel latency is %d, send times is %d, recive times is %d,\ - each RTT latency details is %s", latency, sendNum_, recvNum_, eachLatencyDetails_.c_str()); + DHLOGI("LatencyCount average single-channel latency is %d, send times is %d, recive times is %d, " + + "each RTT latency details is %s", latency, sendNum_, recvNum_, eachLatencyDetails_.c_str()); deltaTimeAll_ = 0; sendNum_ = 0; recvNum_ = 0; diff --git a/utils/src/dinput_utils_tool.cpp b/utils/src/dinput_utils_tool.cpp index 02e699d..9ec51b7 100644 --- a/utils/src/dinput_utils_tool.cpp +++ b/utils/src/dinput_utils_tool.cpp @@ -26,7 +26,7 @@ namespace OHOS { namespace DistributedHardware { namespace DistributedInput { namespace { - constexpr int32_t MS_ONE_SECOND = 1000; + constexpr int32_t US_ONE_SECOND = 1000 * 1000; const char *const DESCRIPTOR = "descriptor"; } @@ -51,7 +51,7 @@ uint64_t GetCurrentTime() { struct timeval tv; gettimeofday(&tv, nullptr); - return tv.tv_sec * MS_ONE_SECOND + tv.tv_usec / MS_ONE_SECOND; + return tv.tv_sec * US_ONE_SECOND + tv.tv_usec; } std::string SetAnonyId(const std::string &message)