mirror of
https://github.com/vsergeev/c-periphery.git
synced 2026-02-06 23:42:24 +08:00
gpio: remove dummy read from gpio_poll()
resolves #15. Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
This commit is contained in:
committed by
Vanya A. Sergeev
parent
2409e0c2ce
commit
d880ef7d1e
@@ -192,17 +192,8 @@ int gpio_write(gpio_t *gpio, bool value) {
|
||||
|
||||
int gpio_poll(gpio_t *gpio, int timeout_ms) {
|
||||
struct pollfd fds[1];
|
||||
char buf[1];
|
||||
int ret;
|
||||
|
||||
/* Dummy read before poll */
|
||||
if (read(gpio->fd, buf, 1) < 0)
|
||||
return _gpio_error(gpio, GPIO_ERROR_IO, errno, "Reading GPIO 'value'");
|
||||
|
||||
/* Seek to end */
|
||||
if (lseek(gpio->fd, 0, SEEK_END) < 0)
|
||||
return _gpio_error(gpio, GPIO_ERROR_IO, errno, "Seeking to end of GPIO 'value'");
|
||||
|
||||
/* Poll */
|
||||
fds[0].fd = gpio->fd;
|
||||
fds[0].events = POLLPRI | POLLERR;
|
||||
|
||||
Reference in New Issue
Block a user