From 74cc1315b4bc826f3012b38fe10684d5a2c272fe Mon Sep 17 00:00:00 2001 From: Mathieu Rondonneau Date: Tue, 28 May 2013 12:59:46 -0700 Subject: [PATCH] OP-958: only report the number of device we actually open successfully. Limitation: only one (1) or zero (0) for now. --- ground/openpilotgcs/src/plugins/ophid/src/ophid_hidapi.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ground/openpilotgcs/src/plugins/ophid/src/ophid_hidapi.cpp b/ground/openpilotgcs/src/plugins/ophid/src/ophid_hidapi.cpp index 69007d804..c03cb0ba3 100644 --- a/ground/openpilotgcs/src/plugins/ophid/src/ophid_hidapi.cpp +++ b/ground/openpilotgcs/src/plugins/ophid/src/ophid_hidapi.cpp @@ -171,6 +171,8 @@ int opHID_hidapi::open(int max, int vid, int pid, int usage_page, int usage) if (devices_found) { + devices_found = 0; + // Go through the list until we can open one // WARNING: for now this prevent to have device chained tmp_device_ptr = current_device_ptr; @@ -186,7 +188,10 @@ int opHID_hidapi::open(int max, int vid, int pid, int usage_page, int usage) NULL); if (handle) + { + devices_found = 1 ; break; + } tmp_device_ptr = tmp_device_ptr->next; }