summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <jaylink-dev@marcschink.de>2015-12-11 09:32:12 +0100
committerMarc Schink <jaylink-dev@marcschink.de>2015-12-11 09:35:25 +0100
commita7074289fb24c258546dd746c08af0805cf4bfca (patch)
treeec88b20357a72f88c68e41ec9f7bb387a218100a
parent8d7e2d93de87d2c7124d57341fa5bbc6fe65cd78 (diff)
Fix device enumeration
-rw-r--r--device_info.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/device_info.c b/device_info.c
index 6d38397..109c527 100644
--- a/device_info.c
+++ b/device_info.c
@@ -38,6 +38,7 @@ int main(int argc, char **argv)
bool use_serial_number;
uint32_t serial_number;
char *firmware_version;
+ bool device_found;
uint32_t tmp;
size_t i;
@@ -75,6 +76,8 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
+ device_found = false;
+
for (i = 0; devs[i]; i++) {
devh = NULL;
ret = jaylink_device_get_serial_number(devs[i], &tmp);
@@ -92,6 +95,7 @@ int main(int argc, char **argv)
if (ret == JAYLINK_OK) {
serial_number = tmp;
+ device_found = true;
break;
}
@@ -101,7 +105,7 @@ int main(int argc, char **argv)
jaylink_free_device_list(devs, true);
- if (!devh) {
+ if (!device_found) {
printf("No J-Link device found.\n");
jaylink_exit(ctx);
return EXIT_SUCCESS;