All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: event_monitor: Flush output on event
@ 2021-12-08 21:48 Zach DeCook
  2021-12-16 12:22 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Zach DeCook @ 2021-12-08 21:48 UTC (permalink / raw)
  To: linux-iio; +Cc: Zach DeCook

By flushing the output, iio_event_monitor can be more useful to programs
chained along with it.

  iio_event_monitor stk3310 | awk '/rising/{system("my_unlockscreen.sh")} /falling/{system("my_lockscreen.sh")}'

Without this flush, the above example would buffer a number of events,
then after a while run the lock/unlock scripts several times.

Signed-off-by: Zach DeCook <zachdecook@librem.one>
---
 tools/iio/iio_event_monitor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
index 0076437f6..b94a16ba5 100644
--- a/tools/iio/iio_event_monitor.c
+++ b/tools/iio/iio_event_monitor.c
@@ -279,6 +279,7 @@ static void print_event(struct iio_event_data *event)
 		printf(", direction: %s", iio_ev_dir_text[dir]);
 
 	printf("\n");
+	fflush(stdout);
 }
 
 /* Enable or disable events in sysfs if the knob is available */
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: event_monitor: Flush output on event
  2021-12-08 21:48 [PATCH] iio: event_monitor: Flush output on event Zach DeCook
@ 2021-12-16 12:22 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2021-12-16 12:22 UTC (permalink / raw)
  To: Zach DeCook; +Cc: linux-iio

On Wed,  8 Dec 2021 16:48:08 -0500
Zach DeCook <zachdecook@librem.one> wrote:

> By flushing the output, iio_event_monitor can be more useful to programs
> chained along with it.
> 
>   iio_event_monitor stk3310 | awk '/rising/{system("my_unlockscreen.sh")} /falling/{system("my_lockscreen.sh")}'
> 
> Without this flush, the above example would buffer a number of events,
> then after a while run the lock/unlock scripts several times.
> 
> Signed-off-by: Zach DeCook <zachdecook@librem.one>
Seems sensible to me.

Applied to the togreg branch of iio.git and pushed out as testing for 0-day to poke at
it (possibly - no idea what it does with tools patches :)

Jonathan

> ---
>  tools/iio/iio_event_monitor.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> index 0076437f6..b94a16ba5 100644
> --- a/tools/iio/iio_event_monitor.c
> +++ b/tools/iio/iio_event_monitor.c
> @@ -279,6 +279,7 @@ static void print_event(struct iio_event_data *event)
>  		printf(", direction: %s", iio_ev_dir_text[dir]);
>  
>  	printf("\n");
> +	fflush(stdout);
>  }
>  
>  /* Enable or disable events in sysfs if the knob is available */


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-16 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 21:48 [PATCH] iio: event_monitor: Flush output on event Zach DeCook
2021-12-16 12:22 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.