From: Alex Tereschenko Date: Sun, 19 Jul 2015 19:50:52 +0000 (+0200) Subject: uart.c: Fixed UART initialization, now we set and apply defaults X-Git-Tag: v0.7.4~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d39902a8a780c831bb79e6163734d003b5add20;p=contrib%2Fmraa.git uart.c: Fixed UART initialization, now we set and apply defaults Closes #221. Signed-off-by: Alex Tereschenko Signed-off-by: Brendan Le Foll --- diff --git a/src/uart/uart.c b/src/uart/uart.c index 22868a5..82e1252 100644 --- a/src/uart/uart.c +++ b/src/uart/uart.c @@ -211,6 +211,12 @@ mraa_uart_init_raw(const char* path) // handling, such as flow control or line editing semantics. // cfmakeraw is not POSIX! cfmakeraw(&termio); + if (tcsetattr(dev->fd, TCSAFLUSH, &termio) < 0) { + syslog(LOG_ERR, "uart: tcsetattr() failed after cfmakeraw()"); + close(dev->fd); + free(dev); + return NULL; + } if (mraa_uart_set_baudrate(dev, 9600) != MRAA_SUCCESS) { close(dev->fd);