Hello,

I've tried to use recent 6.3 version with linuxgpio programmer enabled
and have failed with it with messages like "Can't export GPIO 31,
already exported/busy?: Device or resource busy". But it have turned
out, that the problem is with the typo in format string used in
"snprintf()" calls to create gpio pin filename: it specifies "%ud" for
unsigned integer value instead of just "%u", that's why we have likes
"31d" names, which "/sys/class/gpio/export" refuses to export.

The patch is applied. Hope it's helpful.

Best regards,
Alexey Chernov
diff -urB avrdude-6.3/linuxgpio.c avrdude-6.3-patched/linuxgpio.c
--- avrdude-6.3/linuxgpio.c	2016-02-15 23:16:32.000000000 +0300
+++ avrdude-6.3-patched/linuxgpio.c	2016-10-10 00:59:28.000000000 +0300
@@ -66,7 +66,7 @@
     return fd;
   }
 
-  len = snprintf(buf, sizeof(buf), "%ud", gpio);
+  len = snprintf(buf, sizeof(buf), "%u", gpio);
   r = write(fd, buf, len);
   close(fd);
 
@@ -84,7 +84,7 @@
     return fd;
   }
 
-  len = snprintf(buf, sizeof(buf), "%ud", gpio);
+  len = snprintf(buf, sizeof(buf), "%u", gpio);
   r = write(fd, buf, len);
   close(fd);
 
@@ -95,7 +95,7 @@
 {
   char filepath[60];
 
-  snprintf(filepath, sizeof(filepath), "/sys/class/gpio/gpio%ud/value", gpio);
+  snprintf(filepath, sizeof(filepath), "/sys/class/gpio/gpio%u/value", gpio);
   return (open(filepath, O_RDWR));
 }
 
@@ -104,7 +104,7 @@
   int fd, r;
   char buf[60];
 
-  snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%ud/direction", gpio);
+  snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%u/direction", gpio);
 
   fd = open(buf, O_WRONLY);
   if (fd < 0) {
_______________________________________________
avrdude-dev mailing list
avrdude-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avrdude-dev

Reply via email to