@@ -1258,7 +1258,7 @@ int gpiod_line_request_get_fd(struct gpiod_line_request *request);
* @return 0 if wait timed out, -1 if an error occurred, 1 if an event is
* pending.
*/
-int gpiod_line_request_edge_event_wait(struct gpiod_line_request *request,
+int gpiod_line_request_wait_edge_event(struct gpiod_line_request *request,
uint64_t timeout_ns);
/**
@@ -1270,7 +1270,7 @@ int gpiod_line_request_edge_event_wait(struct gpiod_line_request *request,
* descriptor, on failure return -1.
* @note This function will block if no event was queued for this line.
*/
-int gpiod_line_request_edge_event_read(struct gpiod_line_request *request,
+int gpiod_line_request_read_edge_event(struct gpiod_line_request *request,
struct gpiod_edge_event_buffer *buffer,
size_t max_events);
@@ -201,14 +201,14 @@ GPIOD_API int gpiod_line_request_get_fd(struct gpiod_line_request *request)
}
GPIOD_API int
-gpiod_line_request_edge_event_wait(struct gpiod_line_request *request,
+gpiod_line_request_wait_edge_event(struct gpiod_line_request *request,
uint64_t timeout_ns)
{
return gpiod_poll_fd(request->fd, timeout_ns);
}
GPIOD_API int
-gpiod_line_request_edge_event_read(struct gpiod_line_request *request,
+gpiod_line_request_read_edge_event(struct gpiod_line_request *request,
struct gpiod_edge_event_buffer *buffer,
size_t max_events)
{
@@ -51,7 +51,7 @@ GPIOD_TEST_CASE(edge_event_wait_timeout)
request = gpiod_test_request_lines_or_fail(chip, req_cfg, line_cfg);
- ret = gpiod_line_request_edge_event_wait(request, 1000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000);
g_assert_cmpint(ret, ==, 0);
}
@@ -129,11 +129,11 @@ GPIOD_TEST_CASE(read_both_events)
/* First event. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000000);
g_assert_cmpint(ret, >, 0);
gpiod_test_join_thread_and_return_if_failed(thread);
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_join_thread_and_return_if_failed(thread);
@@ -149,11 +149,11 @@ GPIOD_TEST_CASE(read_both_events)
/* Second event. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000000);
g_assert_cmpint(ret, >, 0);
gpiod_test_join_thread_and_return_if_failed(thread);
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_join_thread_and_return_if_failed(thread);
@@ -205,11 +205,11 @@ GPIOD_TEST_CASE(read_rising_edge_event)
/* First event. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000000);
g_assert_cmpint(ret, >, 0);
gpiod_test_join_thread_and_return_if_failed(thread);
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_join_thread_and_return_if_failed(thread);
@@ -224,7 +224,7 @@ GPIOD_TEST_CASE(read_rising_edge_event)
/* Second event. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000);
g_assert_cmpint(ret, ==, 0); /* Time-out. */
g_thread_join(thread);
@@ -263,11 +263,11 @@ GPIOD_TEST_CASE(read_falling_edge_event)
/* First event is the second generated. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000000);
g_assert_cmpint(ret, >, 0);
gpiod_test_join_thread_and_return_if_failed(thread);
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_join_thread_and_return_if_failed(thread);
@@ -282,7 +282,7 @@ GPIOD_TEST_CASE(read_falling_edge_event)
/* No more events. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000);
g_assert_cmpint(ret, ==, 0); /* Time-out. */
g_thread_join(thread);
@@ -336,7 +336,7 @@ GPIOD_TEST_CASE(read_rising_edge_event_polled)
g_assert_cmpint(ret, >, 0);
gpiod_test_join_thread_and_return_if_failed(thread);
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_join_thread_and_return_if_failed(thread);
@@ -351,7 +351,7 @@ GPIOD_TEST_CASE(read_rising_edge_event_polled)
/* Second event. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000);
g_assert_cmpint(ret, ==, 0); /* Time-out. */
g_thread_join(thread);
@@ -405,11 +405,11 @@ GPIOD_TEST_CASE(seqno)
/* First event. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000000);
g_assert_cmpint(ret, >, 0);
gpiod_test_join_thread_and_return_if_failed(thread);
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_join_thread_and_return_if_failed(thread);
@@ -424,11 +424,11 @@ GPIOD_TEST_CASE(seqno)
/* Second event. */
- ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000000);
g_assert_cmpint(ret, >, 0);
gpiod_test_join_thread_and_return_if_failed(thread);
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_join_thread_and_return_if_failed(thread);
@@ -472,11 +472,11 @@ GPIOD_TEST_CASE(event_copy)
g_gpiosim_chip_set_pull(sim, 2, G_GPIOSIM_PULL_UP);
- ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+ ret = gpiod_line_request_wait_edge_event(request, 1000000000);
g_assert_cmpint(ret, >, 0);
gpiod_test_return_if_failed();
- ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+ ret = gpiod_line_request_read_edge_event(request, buffer, 1);
g_assert_cmpint(ret, ==, 1);
gpiod_test_return_if_failed();
@@ -280,13 +280,13 @@ int main(int argc, char **argv)
die_perror("unable to allocate the line event buffer");
for (;;) {
- ret = gpiod_line_request_edge_event_wait(request, timeout);
+ ret = gpiod_line_request_wait_edge_event(request, timeout);
if (ret < 0)
die_perror("error waiting for events");
if (ret == 0)
continue;
- ret = gpiod_line_request_edge_event_read(request, event_buffer,
+ ret = gpiod_line_request_read_edge_event(request, event_buffer,
EVENT_BUF_SIZE);
if (ret < 0)
die_perror("error reading line events");
Most libgpiod function names follow the gpiod_<object>_<action>_<object> convention. gpiod_line_request_edge_event_wait() and gpiod_line_request_edge_event_read() don't, so rename them gpiod_line_request_wait_edge_event() and gpiod_line_request_read_edge_event(), respectively. Signed-off-by: Kent Gibson <warthog618@gmail.com> --- include/gpiod.h | 4 ++-- lib/line-request.c | 4 ++-- tests/tests-edge-event.c | 38 +++++++++++++++++++------------------- tools/gpiomon.c | 4 ++-- 4 files changed, 25 insertions(+), 25 deletions(-)