X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=examples%2Feeprom.c;h=247589a2b4caefbae41501634485cf5e79d0f8a5;hp=e947c00cdb9991f6d802e466548f876a457f256f;hb=d160863c527c8a3fdf1e821a64c59192a2fc2150;hpb=8ee8775ed78415e8f7274d92493f63f93e2016b0 diff --git a/examples/eeprom.c b/examples/eeprom.c index e947c00..247589a 100644 --- a/examples/eeprom.c +++ b/examples/eeprom.c @@ -30,7 +30,8 @@ int read_decode_eeprom(struct ftdi_context *ftdi) ftdi_get_eeprom_value(ftdi, CHIP_SIZE, & value); if (value <0) { - fprintf(stderr, "No EEPROM found\n"); + fprintf(stderr, "No EEPROM found or EEPROM empty\n"); + fprintf(stderr, "On empty EEPROM, use -w option to write default values\n"); return -1; } fprintf(stderr, "Chip type %d ftdi_eeprom_size: %d\n", ftdi->type, value); @@ -169,7 +170,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