X-Git-Url: http://developer.intra2net.com/git/?a=blobdiff_plain;f=examples%2Feeprom.c;h=3d03ac373981d12ee6474ac3028cbbfa34a01172;hb=HEAD;hp=247589a2b4caefbae41501634485cf5e79d0f8a5;hpb=2e4e22c4f690d858b3d3a07f49b3ab8ad35b9cff;p=libftdi diff --git a/examples/eeprom.c b/examples/eeprom.c index 247589a..3d03ac3 100644 --- a/examples/eeprom.c +++ b/examples/eeprom.c @@ -90,6 +90,8 @@ int main(int argc, char **argv) return EXIT_FAILURE; } + ftdi->module_detach_mode = AUTO_DETACH_REATACH_SIO_MODULE; + while ((i = getopt(argc, argv, "d::ev:p:l:P:S:w")) != -1) { switch (i) @@ -151,14 +153,14 @@ int main(int argc, char **argv) if (res > 1) { int i = 1; - fprintf(stderr, "%d FTDI devices found: Only Readout on EEPROM done. ",res); + fprintf(stderr, "%d FTDI devices found: Only Readout on EEPROM done. \n",res); fprintf(stderr, "Use VID/PID/desc/serial to select device\n"); for (curdev = devlist; curdev != NULL; curdev= curdev->next, i++) { f = ftdi_usb_open_dev(ftdi, curdev->dev); if (f<0) { - fprintf(stderr, "Unable to open device %d: (%s)", + fprintf(stderr, "Unable to open device %d: (%s)\n", i, ftdi_get_error_string(ftdi)); continue; } @@ -175,7 +177,7 @@ int main(int argc, char **argv) f = ftdi_usb_open_dev(ftdi, devlist[0].dev); if (f<0) { - fprintf(stderr, "Unable to open device %d: (%s)", + fprintf(stderr, "Unable to open device %d: (%s)\n", i, ftdi_get_error_string(ftdi)); } } @@ -200,7 +202,7 @@ int main(int argc, char **argv) fprintf(stderr, "\n"); fprintf(stderr, "unable to open ftdi device: %d (%s)\n", f, ftdi_get_error_string(ftdi)); - + retval = -1; goto done; } @@ -210,7 +212,7 @@ int main(int argc, char **argv) f = ftdi_erase_eeprom(ftdi); /* needed to determine EEPROM chip type */ if (f < 0) { - fprintf(stderr, "Erase failed: %s", + fprintf(stderr, "Erase failed: %s\n", ftdi_get_error_string(ftdi)); retval = -2; goto done; @@ -277,7 +279,7 @@ int main(int argc, char **argv) f=(ftdi_eeprom_build(ftdi)); if (f < 0) { - fprintf(stderr, "Erase failed: %s", + fprintf(stderr, "Erase failed: %s\n", ftdi_get_error_string(ftdi)); retval = -2; goto done;