--
Uwe Bonnes bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From 03ffb20e7c8bfda3b2c5efaee6afbdc86e241816 Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Jul 2011 12:19:06 +0200
Subject: examples/eeprom: Only try ftdi_usb_open_dev if devices found
---
examples/eeprom.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/examples/eeprom.c b/examples/eeprom.c
index e947c00..ef789a3 100644
--- a/examples/eeprom.c
+++ b/examples/eeprom.c
@@ -169,7 +169,20 @@ int main(int argc, char **argv)
retval = EXIT_SUCCESS;
goto do_deinit;
}
- f = ftdi_usb_open_dev(ftdi, devlist[0].dev);
+ else if (res == 1)
+ {
+ f = ftdi_usb_open_dev(ftdi, devlist[0].dev);
+ if (f<0)
+ {
+ fprintf(stderr, "Unable to open device %d: (%s)",
+ i, ftdi_get_error_string(ftdi));
+ }
+ }
+ else
+ {
+ fprintf(stderr, "No devices found\n");
+ f = 0;
+ }
ftdi_list_free(&devlist);
}
else
--
1.7.3.4
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|