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>
This commit is contained in:
Gary Bisson 2018-12-07 17:14:52 +01:00
parent 0ae6d74436
commit 8cbf6bb535

View file

@ -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");