libftdi Archives

Subject: 1.0/examples/eeprom.c: Abort if no EEPROM is found

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 20 Jun 2011 14:51:49 +0200
Abort if no EEPROM is found
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From e75504b55e42d6e2967d2d717c4f3a9d0ed404e6 Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 20 Jun 2011 14:39:56 +0200
Subject: Abort if no EEPROM is found

---
 examples/eeprom.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/examples/eeprom.c b/examples/eeprom.c
index 8d74d2c..3b8d3a6 100644
--- a/examples/eeprom.c
+++ b/examples/eeprom.c
@@ -188,6 +188,12 @@ int main(int argc, char **argv)
 
 
     ftdi_get_eeprom_value(ftdi, CHIP_SIZE, & value);
+    if (value <0)
+    {
+        fprintf(stderr, "No EEPROM found\n");
+        return -1;
+
+    }
     fprintf(stderr, "Chip type %d ftdi_eeprom_size: %d\n", ftdi->type, value);
     if (ftdi->type == TYPE_R)
         size = 0xa0;
-- 
1.7.3.4


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • 1.0/examples/eeprom.c: Abort if no EEPROM is found, Uwe Bonnes <=