From d43ec191439c17c765ee09bf901112e119893120 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 17 Jan 2017 17:25:00 +0100 Subject: [PATCH] gpiomon: modify the output format Drop unnecessary strings. Add offset info (if we ever wanted to allow monitoring multiple lines at once while staying backwards compatible). Signed-off-by: Bartosz Golaszewski --- src/tools/gpiomon.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/gpiomon.c b/src/tools/gpiomon.c index 10e7e35..d6c8208 100644 --- a/src/tools/gpiomon.c +++ b/src/tools/gpiomon.c @@ -53,6 +53,7 @@ static void sighandler(int signum UNUSED) } struct callback_data { + unsigned int offset; unsigned int num_events_wanted; unsigned int num_events_done; bool silent; @@ -83,8 +84,8 @@ static int event_callback(int type, const struct timespec *ts, void *data) } if (evname && !cbdata->silent) - printf("GPIO EVENT: %s [%8ld.%09ld]\n", - evname, ts->tv_sec, ts->tv_nsec); + printf("event: %s offset: %u timestamp: [%8ld.%09ld]\n", + evname, cbdata->offset, ts->tv_sec, ts->tv_nsec); if (cbdata->num_events_wanted && cbdata->num_events_done >= cbdata->num_events_wanted) @@ -162,6 +163,8 @@ int main(int argc, char **argv) if (*end != '\0' || offset > INT_MAX) die("invalid GPIO offset: %s", argv[1]); + cbdata.offset = offset; + timeout.tv_sec = 0; timeout.tv_nsec = 500000000; -- 2.30.2