Move the consumer string after the active_low property.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
/**
* @brief Wait for events on a single GPIO line.
- * @param consumer Name of the consumer.
* @param device Name, path or number of the gpiochip.
* @param offset GPIO line offset to monitor.
* @param active_low The active state of this line - true if low.
+ * @param consumer Name of the consumer.
* @param timeout Maximum wait time for each iteration.
* @param poll_cb Callback function to call when waiting for events.
* @param event_cb Callback function to call on event occurrence.
* The poll callback can be NULL in which case the routine will fall back to
* a basic, ppoll() based callback.
*/
-int gpiod_simple_event_loop(const char *consumer, const char *device,
- unsigned int offset, bool active_low,
+int gpiod_simple_event_loop(const char *device, unsigned int offset,
+ bool active_low, const char *consumer,
const struct timespec *timeout,
gpiod_simple_event_poll_cb poll_cb,
gpiod_simple_event_handle_cb event_cb,
/**
* @brief Wait for events on multiple GPIO lines.
- * @param consumer Name of the consumer.
* @param device Name, path or number of the gpiochip.
* @param offsets Array of GPIO line offsets to monitor.
* @param num_lines Number of lines to monitor.
* @param active_low The active state of this line - true if low.
+ * @param consumer Name of the consumer.
* @param timeout Maximum wait time for each iteration.
* @param poll_cb Callback function to call when waiting for events.
* @param event_cb Callback function to call on event occurrence.
*
* The callback functions work just like in the single line variant.
*/
-int gpiod_simple_event_loop_multiple(const char *consumer, const char *device,
+int gpiod_simple_event_loop_multiple(const char *device,
const unsigned int *offsets,
unsigned int num_lines, bool active_low,
+ const char *consumer,
const struct timespec *timeout,
gpiod_simple_event_poll_cb poll_cb,
gpiod_simple_event_handle_cb event_cb,
return ret;
}
-int gpiod_simple_event_loop(const char *consumer, const char *device,
- unsigned int offset, bool active_low,
+int gpiod_simple_event_loop(const char *device, unsigned int offset,
+ bool active_low, const char *consumer,
const struct timespec *timeout,
gpiod_simple_event_poll_cb poll_cb,
- gpiod_simple_event_handle_cb event_cb,
- void *data)
+ gpiod_simple_event_handle_cb event_cb, void *data)
{
- return gpiod_simple_event_loop_multiple(consumer, device, &offset, 1,
- active_low, timeout, poll_cb,
+ return gpiod_simple_event_loop_multiple(device, &offset, 1, active_low,
+ consumer, timeout, poll_cb,
event_cb, data);
}
-int gpiod_simple_event_loop_multiple(const char *consumer, const char *device,
+int gpiod_simple_event_loop_multiple(const char *device,
const unsigned int *offsets,
unsigned int num_lines, bool active_low,
+ const char *consumer,
const struct timespec *timeout,
gpiod_simple_event_poll_cb poll_cb,
gpiod_simple_event_handle_cb event_cb,
ctx.sigfd = make_signalfd();
- ret = gpiod_simple_event_loop_multiple("gpiomon", argv[0], offsets,
- num_lines, active_low, &timeout,
+ ret = gpiod_simple_event_loop_multiple(argv[0], offsets, num_lines,
+ active_low, "gpiomon", &timeout,
poll_callback,
event_callback, &ctx);
if (ret)
test_set_event(0, 3, TEST_EVENT_ALTERNATING, 100);
- status = gpiod_simple_event_loop(TEST_CONSUMER, test_chip_name(0), 3,
- false, &ts, NULL, simple_event_cb,
- &evdata);
+ status = gpiod_simple_event_loop(test_chip_name(0), 3, false,
+ TEST_CONSUMER, &ts, NULL,
+ simple_event_cb, &evdata);
TEST_ASSERT_RET_OK(status);
TEST_ASSERT(evdata.got_rising_edge);
test_set_event(0, 3, TEST_EVENT_ALTERNATING, 100);
- status = gpiod_simple_event_loop_multiple(TEST_CONSUMER,
- test_chip_name(0), offsets,
- 4, false, &ts, NULL,
- simple_event_cb, &evdata);
+ status = gpiod_simple_event_loop_multiple(test_chip_name(0), offsets,
+ 4, false, TEST_CONSUMER, &ts,
+ NULL, simple_event_cb,
+ &evdata);
TEST_ASSERT_RET_OK(status);
TEST_ASSERT(evdata.got_rising_edge);
test_set_event(0, 3, TEST_EVENT_ALTERNATING, 100);
- rv = gpiod_simple_event_loop(TEST_CONSUMER, test_chip_name(0), 3,
- false, &ts, NULL, error_event_cb, NULL);
+ rv = gpiod_simple_event_loop(test_chip_name(0), 3, false,
+ TEST_CONSUMER, &ts, NULL,
+ error_event_cb, NULL);
TEST_ASSERT_EQ(rv, -1);
TEST_ASSERT_ERRNO_IS(ENOTBLK);
struct timespec ts = { 0, 100000 };
int rv;
- rv = gpiod_simple_event_loop(TEST_CONSUMER, test_chip_name(0), 3,
- false, &ts, NULL, error_event_cb, NULL);
+ rv = gpiod_simple_event_loop(test_chip_name(0), 3, false,
+ TEST_CONSUMER, &ts, NULL,
+ error_event_cb, NULL);
TEST_ASSERT_EQ(rv, -1);
TEST_ASSERT_ERRNO_IS(ENOTBLK);