From 1855bbe5e8319d569b724ecacb585ca6b89bb490 Mon Sep 17 00:00:00 2001 From: wuqi0105 Date: Fri, 11 Aug 2023 14:24:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E8=80=97=E6=97=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuqi0105 --- utils/src/dinput_utils_tool.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/utils/src/dinput_utils_tool.cpp b/utils/src/dinput_utils_tool.cpp index 51a1b40..0af8f28 100644 --- a/utils/src/dinput_utils_tool.cpp +++ b/utils/src/dinput_utils_tool.cpp @@ -50,8 +50,6 @@ namespace { constexpr unsigned char MASK = 0x0F; constexpr int32_t DOUBLE_TIMES = 2; constexpr int32_t INT32_STRING_LENGTH = 40; - constexpr int32_t MAX_RETRY_COUNT = 10; - constexpr uint32_t SLEEP_TIME_US = 100 * 1000; constexpr uint32_t ERROR_MSG_MAX_LEN = 256; } DevInfo GetLocalDeviceInfo() @@ -339,14 +337,7 @@ int OpenInputDeviceFdByPath(const std::string &devicePath) return -1; } int fd = open(canonicalDevicePath, O_RDWR | O_CLOEXEC | O_NONBLOCK); - int32_t count = 0; - while ((fd < 0) && (count < MAX_RETRY_COUNT)) { - ++count; - usleep(SLEEP_TIME_US); - fd = open(canonicalDevicePath, O_RDWR | O_CLOEXEC | O_NONBLOCK); - DHLOGE("could not open %s, %s; retry %d\n", devicePath.c_str(), ConvertErrNo().c_str(), count); - } - if (count >= MAX_RETRY_COUNT) { + if (fd < 0) { DHLOGE("could not open %s, %s\n", devicePath.c_str(), ConvertErrNo().c_str()); CloseFd(fd); return -1; -- Gitee