From f3637ade7908be8a7e44b029d2a4d54e830a809a Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 3 Jan 2019 11:46:25 +0100 Subject: [PATCH] gpioset: extend help text There's a common misconception about the way the character device works. Some users expect line states to be driven as desired even after gpioset exits. Add a note about that to the help text to avoid further confusion. Signed-off-by: Bartosz Golaszewski --- src/tools/gpioset.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tools/gpioset.c b/src/tools/gpioset.c index 0678373..bbd9fd1 100644 --- a/src/tools/gpioset.c +++ b/src/tools/gpioset.c @@ -36,7 +36,7 @@ static void print_help(void) { printf("Usage: %s [OPTIONS] = = ...\n", get_progname()); - printf("Set GPIO line values of a GPIO chip\n"); + printf("Set GPIO line values of a GPIO chip and maintain the state until the process exits\n"); printf("\n"); printf("Options:\n"); printf(" -h, --help:\t\tdisplay this message and exit\n"); @@ -53,6 +53,12 @@ static void print_help(void) printf(" wait:\t\tset values and wait for user to press ENTER\n"); printf(" time:\t\tset values and sleep for a specified amount of time\n"); printf(" signal:\tset values and wait for SIGINT or SIGTERM\n"); + printf("\n"); + printf("Note: the state of a GPIO line controlled over the character device reverts to default\n"); + printf("when the last process referencing the file descriptor representing the device file exits.\n"); + printf("This means that it's wrong to run gpioset, have it exit and expect the line to continue\n"); + printf("being driven high or low. It may happen if given pin is floating but it must be interpreted\n"); + printf("as undefined behavior.\n"); } struct callback_data { -- 2.30.2