int gpiod_line_event_wait_bulk(struct gpiod_line_bulk *bulk,
const struct timespec *timeout,
- unsigned int *index)
+ struct gpiod_line **line)
{
struct pollfd fds[GPIOD_REQUEST_MAX_LINES];
- struct gpiod_line *line;
+ struct gpiod_line *linetmp;
unsigned int i;
int status;
memset(fds, 0, sizeof(fds));
for (i = 0; i < bulk->num_lines; i++) {
- line = bulk->lines[i];
+ linetmp = bulk->lines[i];
- fds[i].fd = line->event.fd;
+ fds[i].fd = linetmp->event.fd;
fds[i].events = POLLIN | POLLPRI;
}
}
for (i = 0; !fds[i].revents; i++);
- if (index)
- *index = i;
+ if (line)
+ *line = bulk->lines[i];
return 1;
}
* @brief Wait for the first event on a set of lines.
* @param bulk Set of GPIO lines to monitor.
* @param timeout Wait time limit.
- * @param index The position of the line on which an event occured is stored
- * in this variable. Can be NULL, in which case the index will
- * not be stored.
+ * @param line The handle of the line on which an event occurs is stored
+ * in this variable. Can be NULL.
* @return 0 if wait timed out, -1 if an error occurred, 1 if an event
* occurred.
*/
int gpiod_line_event_wait_bulk(struct gpiod_line_bulk *bulk,
const struct timespec *timeout,
- unsigned int *index) GPIOD_API;
+ struct gpiod_line **line) GPIOD_API;
/**
* @brief Read the last event from the GPIO line.