From 068905d07b756d7e429f673ff4bcb9c7e56d28b7 Mon Sep 17 00:00:00 2001 From: "chenwen@espressif.com" Date: Tue, 14 Jun 2022 16:36:11 +0800 Subject: [PATCH] testing/irtest: Fix issue of failure to open multiple IR devices Signed-off-by: chenwen@espressif.com --- testing/irtest/cmd.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/testing/irtest/cmd.cxx b/testing/irtest/cmd.cxx index 99bb4938a..c52cb4ff2 100644 --- a/testing/irtest/cmd.cxx +++ b/testing/irtest/cmd.cxx @@ -189,11 +189,13 @@ CMD1(open_device, const char *, file_name) } int index = 0; - for (; index < CONFIG_TESTING_IRTEST_MAX_NIRDEV && - g_irdevs[index] == -1; index++) + for (; index < CONFIG_TESTING_IRTEST_MAX_NIRDEV; index++) { - g_irdevs[index] = irdev; - break; + if (g_irdevs[index] == -1) + { + g_irdevs[index] = irdev; + break; + } } if (index == CONFIG_TESTING_IRTEST_MAX_NIRDEV)