mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 04:43:21 +00:00
Fixed softpwm bug ("disable" code didn't synchronize thread exit)
This commit is contained in:
@ -314,9 +314,13 @@ int gpio_get_direction(int gpio, unsigned int *value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
char direction[4] = { 0 }; /* make sure read is null-terminated */
|
||||
char direction[16] = { 0 }; /* make sure read is null-terminated */
|
||||
ssize_t s = read(fd, &direction, sizeof(direction) - 1); e_no = errno;
|
||||
close(fd);
|
||||
while (s > 0 && direction[s-1] == '\n') { /* strip trailing newlines */
|
||||
direction[s-1] = '\0';
|
||||
s --;
|
||||
}
|
||||
if (s < 0) {
|
||||
char err[256];
|
||||
snprintf(err, sizeof(err), "gpio_set_direction: could not read '%s' (%s)", filename, strerror(e_no));
|
||||
|
Reference in New Issue
Block a user