Replace printf() by fprintf(stderr)

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@939 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2010-03-05 08:28:42 +00:00
parent c891cb15c8
commit c1d1c99753
4 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2010-03-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* buspirate.c: Replace printf() by fprintf(stderr)
* safemode.c: (Dito.)
* usbtiny.c: (Dito.)
2010-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de> 2010-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Cleanup Cygwin builds. Cleanup Cygwin builds.

View File

@ -418,7 +418,7 @@ static void buspirate_reset_from_binmode(struct programmer_t *pgm)
} }
if (verbose) if (verbose)
printf("BusPirate is back in the text mode\n"); fprintf(stderr, "BusPirate is back in the text mode\n");
} }
static int buspirate_start_spi_mode_bin(struct programmer_t *pgm) static int buspirate_start_spi_mode_bin(struct programmer_t *pgm)
@ -437,7 +437,8 @@ static int buspirate_start_spi_mode_bin(struct programmer_t *pgm)
return -1; return -1;
} }
if (verbose) if (verbose)
printf("BusPirate binmode version: %d\n", PDATA(pgm)->binmode_version); fprintf(stderr, "BusPirate binmode version: %d\n",
PDATA(pgm)->binmode_version);
pgm->flag |= BP_FLAG_IN_BINMODE; pgm->flag |= BP_FLAG_IN_BINMODE;
@ -452,7 +453,8 @@ static int buspirate_start_spi_mode_bin(struct programmer_t *pgm)
return -1; return -1;
} }
if (verbose) if (verbose)
printf("BusPirate SPI version: %d\n", PDATA(pgm)->bin_spi_version); fprintf(stderr, "BusPirate SPI version: %d\n",
PDATA(pgm)->bin_spi_version);
/* 0b0100wxyz - Configure peripherals w=power, x=pull-ups/aux2, y=AUX, z=CS /* 0b0100wxyz - Configure peripherals w=power, x=pull-ups/aux2, y=AUX, z=CS
* we want power (0x48) and all reset pins high. */ * we want power (0x48) and all reset pins high. */
@ -517,7 +519,7 @@ static int buspirate_start_spi_mode_ascii(struct programmer_t *pgm)
} }
if (buspirate_is_prompt(rcvd)) { if (buspirate_is_prompt(rcvd)) {
if (strncmp(rcvd, "SPI>", 4) == 0) { if (strncmp(rcvd, "SPI>", 4) == 0) {
printf("BusPirate is now configured for SPI\n"); fprintf(stderr, "BusPirate is now configured for SPI\n");
break; break;
} }
/* Not yet 'SPI>' prompt */ /* Not yet 'SPI>' prompt */
@ -538,7 +540,7 @@ static void buspirate_enable(struct programmer_t *pgm)
int fw_v1 = 0, fw_v2 = 0; int fw_v1 = 0, fw_v2 = 0;
int rc, print_banner = 0; int rc, print_banner = 0;
printf("Detecting BusPirate...\n"); fprintf(stderr, "Detecting BusPirate...\n");
/* Call buspirate_send_bin() instead of buspirate_send() /* Call buspirate_send_bin() instead of buspirate_send()
* because we don't know if BP is in text or bin mode */ * because we don't know if BP is in text or bin mode */
@ -568,7 +570,7 @@ static void buspirate_enable(struct programmer_t *pgm)
sscanf(rcvd, "Bus Pirate %9s", PDATA(pgm)->hw_version); sscanf(rcvd, "Bus Pirate %9s", PDATA(pgm)->hw_version);
sscanf(rcvd, "Firmware v%d.%d", &fw_v1, &fw_v2); sscanf(rcvd, "Firmware v%d.%d", &fw_v1, &fw_v2);
if (print_banner) if (print_banner)
printf("** %s", rcvd); fprintf(stderr, "** %s", rcvd);
} }
PDATA(pgm)->fw_version = 100 * fw_v1 + fw_v2; PDATA(pgm)->fw_version = 100 * fw_v1 + fw_v2;
@ -581,12 +583,12 @@ static void buspirate_enable(struct programmer_t *pgm)
exit(1); exit(1);
if (PDATA(pgm)->fw_version >= FW_BINMODE_VER && !(pgm->flag & BP_FLAG_XPARM_FORCE_ASCII)) { if (PDATA(pgm)->fw_version >= FW_BINMODE_VER && !(pgm->flag & BP_FLAG_XPARM_FORCE_ASCII)) {
printf("BusPirate: using BINARY mode\n"); fprintf(stderr, "BusPirate: using BINARY mode\n");
if (buspirate_start_spi_mode_bin(pgm) < 0) if (buspirate_start_spi_mode_bin(pgm) < 0)
fprintf(stderr, "%s: Failed to start binary SPI mode\n", progname); fprintf(stderr, "%s: Failed to start binary SPI mode\n", progname);
} }
if (!pgm->flag & BP_FLAG_IN_BINMODE) { if (!pgm->flag & BP_FLAG_IN_BINMODE) {
printf("BusPirate: using ASCII mode\n"); fprintf(stderr, "BusPirate: using ASCII mode\n");
if (buspirate_start_spi_mode_ascii(pgm) < 0) { if (buspirate_start_spi_mode_ascii(pgm) < 0) {
fprintf(stderr, "%s: Failed to start ascii SPI mode\n", progname); fprintf(stderr, "%s: Failed to start ascii SPI mode\n", progname);
exit(1); exit(1);

View File

@ -150,7 +150,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
return -1; return -1;
} }
else if ((fusegood == 1) && (verbose > 0)) { else if ((fusegood == 1) && (verbose > 0)) {
printf("%s: safemode: fuse reads as %X\n", progname, safemode_fuse); fprintf(stderr, "%s: safemode: fuse reads as %X\n", progname, safemode_fuse);
} }
@ -205,7 +205,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
return -1; return -1;
} }
else if ((fusegood == 1) && (verbose > 0)) { else if ((fusegood == 1) && (verbose > 0)) {
printf("%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse); fprintf(stderr, "%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse);
} }
/* Read hfuse three times */ /* Read hfuse three times */
@ -258,7 +258,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
return -2; return -2;
} }
else if ((fusegood == 1) && (verbose > 0)){ else if ((fusegood == 1) && (verbose > 0)){
printf("%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse); fprintf(stderr, "%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse);
} }
/* Read efuse three times */ /* Read efuse three times */
@ -311,7 +311,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
return -3; return -3;
} }
else if ((fusegood == 1) && (verbose > 0)) { else if ((fusegood == 1) && (verbose > 0)) {
printf("%s: safemode: efuse reads as %X\n", progname, safemode_efuse); fprintf(stderr, "%s: safemode: efuse reads as %X\n", progname, safemode_efuse);
} }
*lfuse = safemode_lfuse; *lfuse = safemode_lfuse;

View File

@ -135,7 +135,7 @@ static int usb_in (PROGRAMMER * pgm,
static void check_retries (PROGRAMMER * pgm, const char* operation) static void check_retries (PROGRAMMER * pgm, const char* operation)
{ {
if (PDATA(pgm)->retries > 0 && quell_progress < 2) { if (PDATA(pgm)->retries > 0 && quell_progress < 2) {
printf("%s: %d retries during %s\n", progname, fprintf(stderr, "%s: %d retries during %s\n", progname,
PDATA(pgm)->retries, operation); PDATA(pgm)->retries, operation);
} }
PDATA(pgm)->retries = 0; PDATA(pgm)->retries = 0;
@ -268,7 +268,7 @@ static int usbtiny_set_sck_period (PROGRAMMER *pgm, double v)
PDATA(pgm)->sck_period = SCK_MAX; PDATA(pgm)->sck_period = SCK_MAX;
if (verbose) { if (verbose) {
printf( "%s: Setting SCK period to %d usec\n", progname, fprintf(stderr, "%s: Setting SCK period to %d usec\n", progname,
PDATA(pgm)->sck_period ); PDATA(pgm)->sck_period );
} }
@ -295,7 +295,7 @@ static int usbtiny_initialize (PROGRAMMER *pgm, AVRPART *p )
// -B option not specified: use default // -B option not specified: use default
PDATA(pgm)->sck_period = SCK_DEFAULT; PDATA(pgm)->sck_period = SCK_DEFAULT;
if (verbose) { if (verbose) {
printf( "%s: Using SCK period of %d usec\n", fprintf(stderr, "%s: Using SCK period of %d usec\n",
progname, PDATA(pgm)->sck_period ); progname, PDATA(pgm)->sck_period );
} }
if (usb_control(pgm, USBTINY_POWERUP, if (usb_control(pgm, USBTINY_POWERUP,
@ -351,7 +351,7 @@ static int usbtiny_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res
check_retries(pgm, "SPI command"); check_retries(pgm, "SPI command");
if (verbose > 1) { if (verbose > 1) {
// print out the data we sent and received // print out the data we sent and received
printf( "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n", fprintf(stderr, "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n",
cmd[0], cmd[1], cmd[2], cmd[3], cmd[0], cmd[1], cmd[2], cmd[3],
res[0], res[1], res[2], res[3] ); res[0], res[1], res[2], res[3] );
} }