From cb97f24eddd27d34e7a3b492689920f0650c9adf Mon Sep 17 00:00:00 2001 From: Andrei Vasiliu Date: Fri, 21 Aug 2015 11:37:33 +0300 Subject: [PATCH] mraa-gpio.c: Solved issue with getchar() call on Galileo There is a problem with missing symbols __fgetc_unlocked and __stdin in the libc library build for Galileo. Solved this by replacing the getchar() call with fscanf(). Signed-off-by: Andrei Vasiliu Signed-off-by: Brendan Le Foll --- examples/mraa-gpio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/mraa-gpio.c b/examples/mraa-gpio.c index 55c240e..0e4339d 100644 --- a/examples/mraa-gpio.c +++ b/examples/mraa-gpio.c @@ -203,8 +203,11 @@ main(int argc, char** argv) if (gpio_isr_start(&gpio_info) == MRAA_SUCCESS) { fprintf(stdout, "Monitoring level changes to pin %d. Press RETURN to exit.\n", pin); gpio_isr_handler(&gpio_info); - while (getchar() != '\n') - ; + char aux = 0; + do { + fflush(stdin); + fscanf(stdin, "%c", &aux); + } while (aux != '\n'); gpio_isr_stop(&gpio_info); } else { fprintf(stdout, "Failed to register ISR for pin %d\n", pin);