From 8cbf6bb535138125756c049021145c9a0a10c437 Mon Sep 17 00:00:00 2001 From: Gary Bisson Date: Fri, 7 Dec 2018 17:14:52 +0100 Subject: [PATCH] toolbox: getevent: disable stdout buffering So that the getevent output can be redirected and still be responsive when events occur. A good example is when using 'adb shell getevent' command, this latter would only display the events when the buffer is full. With this patch as soon as an event is received/printed, it is flushed to stdout. Change-Id: I77eee96ed1aa59bf8d82f17eab666976ce966def Signed-off-by: Gary Bisson --- toolbox/getevent.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolbox/getevent.c b/toolbox/getevent.c index 39033ad4d..e2c77c37f 100644 --- a/toolbox/getevent.c +++ b/toolbox/getevent.c @@ -530,6 +530,9 @@ int getevent_main(int argc, char *argv[]) const char *device = NULL; const char *device_path = "/dev/input"; + /* disable buffering on stdout */ + setbuf(stdout, NULL); + opterr = 0; do { c = getopt(argc, argv, "tns:Sv::dpilqc:rh");