changeset 23:2127e6fdeab2

lcdtest: simplify USB device selection by serial string
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 14 Apr 2018 06:32:41 +0000
parents e9df47110181
children 94521a02c33d
files lcdtest/main.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lcdtest/main.c	Sat Apr 14 06:15:24 2018 +0000
+++ b/lcdtest/main.c	Sat Apr 14 06:32:41 2018 +0000
@@ -4,7 +4,7 @@
 #include <unistd.h>
 #include <ftdi.h>
 
-char *device_selector = "i:0x0403:0x7157";
+char *device_serial;
 struct ftdi_context ftdi;
 
 process_cmdline(argc, argv)
@@ -16,7 +16,7 @@
 	while ((c = getopt(argc, argv, "d:")) != EOF) {
 		switch (c) {
 		case 'd':
-			device_selector = optarg;
+			device_serial = optarg;
 			continue;
 		default:
 			/* error msg already printed */
@@ -45,7 +45,7 @@
 
 	process_cmdline(argc, argv);
 	ftdi_init(&ftdi);
-	if (ftdi_usb_open_string(&ftdi, device_selector) < 0) {
+	if (ftdi_usb_open_desc(&ftdi, 0x0403, 0x7157, 0, device_serial) < 0) {
 		fprintf(stderr, "FTDI USB open failed: %s\n", ftdi.error_str);
 		exit(1);
 	}