summaryrefslogtreecommitdiffstats
path: root/toolbox
diff options
context:
space:
mode:
authorGary Bisson <gbisson@essential.com>2018-12-07 17:14:52 +0100
committerGary Bisson <gbisson@essential.com>2019-01-15 16:42:59 +0100
commit8cbf6bb535138125756c049021145c9a0a10c437 (patch)
treeb98b5ceece733b137fe53041da3f206d5d7d9528 /toolbox
parent0ae6d74436eaa7d539d350414c1c74527bbf1ce4 (diff)
downloadsystem_core-8cbf6bb535138125756c049021145c9a0a10c437.tar.gz
system_core-8cbf6bb535138125756c049021145c9a0a10c437.tar.bz2
system_core-8cbf6bb535138125756c049021145c9a0a10c437.zip
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 <gbisson@essential.com>
Diffstat (limited to 'toolbox')
-rw-r--r--toolbox/getevent.c3
1 files changed, 3 insertions, 0 deletions
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");