mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
avrdude: Fix GPIO path building
%ud is a GNU extension. It's not really supported elsewhere.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
(cherry-picked from 536c6b8be7)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
--- a/linuxgpio.c
|
||||
+++ b/linuxgpio.c
|
||||
@@ -66,7 +66,7 @@ static int linuxgpio_export(unsigned int gpio)
|
||||
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 @@ static int linuxgpio_unexport(unsigned int gpio)
|
||||
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 @@ static int linuxgpio_openfd(unsigned int gpio)
|
||||
{
|
||||
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 @@ static int linuxgpio_dir(unsigned int gpio, unsigned int dir)
|
||||
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) {
|
||||
Reference in New Issue
Block a user