Change printf() to avrdude_message() in linuxgio.c

This commit is contained in:
Stefan Rueger 2022-09-23 23:28:47 +01:00
parent 3dc1e4e72b
commit 097c78098d
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
1 changed files with 9 additions and 6 deletions

View File

@ -299,24 +299,27 @@ static int linuxgpio_open(PROGRAMMER *pgm, char *port)
/* Write direction, looping in case of EACCES errors due to delayed /* Write direction, looping in case of EACCES errors due to delayed
* udev permission rule application after export */ * udev permission rule application after export */
for (retry_count = GPIO_SYSFS_OPEN_RETRIES; retry_count > 0; retry_count--) { for (retry_count = 0; retry_count < GPIO_SYSFS_OPEN_RETRIES; retry_count++) {
usleep(GPIO_SYSFS_OPEN_DELAY); usleep(GPIO_SYSFS_OPEN_DELAY);
if (i == PIN_AVR_MISO) if (i == PIN_AVR_MISO)
r=linuxgpio_dir_in(pin); r=linuxgpio_dir_in(pin);
else else
r=linuxgpio_dir_out(pin); r=linuxgpio_dir_out(pin);
if (r >= 0) { if (r >= 0)
break; break;
} else if (errno != EACCES) {
if (errno != EACCES) {
linuxgpio_unexport(pin); linuxgpio_unexport(pin);
return r; return r;
} }
if (retry_count > 1) {
printf("Retrying...\n");
}
} }
if (retry_count)
avrdude_message(MSG_NOTICE2, "%s: needed %d retr%s for linuxgpio_dir_%s(%s)\n",
progname, retry_count, retry_count > 1? "ies": "y",
i == PIN_AVR_MISO? "in": "out", avr_pin_name(pin));
if (r < 0) { if (r < 0) {
linuxgpio_unexport(pin); linuxgpio_unexport(pin);
return r; return r;