From 94de9416feb2dc42bf38dc3311b1b70acb06daf5 Mon Sep 17 00:00:00 2001 From: Staroselskii Georgii Date: Thu, 11 Jun 2015 13:45:02 +0300 Subject: [PATCH] AP_HAL_Linux: use defines instead of hardcoding fd numbers in UARTDriver --- libraries/AP_HAL_Linux/UARTDriver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_HAL_Linux/UARTDriver.cpp b/libraries/AP_HAL_Linux/UARTDriver.cpp index 47bc44596a3..cc6cc87479e 100644 --- a/libraries/AP_HAL_Linux/UARTDriver.cpp +++ b/libraries/AP_HAL_Linux/UARTDriver.cpp @@ -61,8 +61,8 @@ void LinuxUARTDriver::begin(uint32_t b) void LinuxUARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS) { if (device_path == NULL && _console) { - _rd_fd = 0; - _wr_fd = 1; + _rd_fd = STDIN_FILENO; + _wr_fd = STDOUT_FILENO; fcntl(_rd_fd, F_SETFL, fcntl(_rd_fd, F_GETFL, 0) | O_NONBLOCK); fcntl(_wr_fd, F_SETFL, fcntl(_wr_fd, F_GETFL, 0) | O_NONBLOCK); } else if (!_initialised) { @@ -122,8 +122,8 @@ void LinuxUARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS) // Notify that the option is not valid and select standart input and output ::printf("LinuxUARTDriver parsing failed, using default\n"); - _rd_fd = 0; - _wr_fd = 1; + _rd_fd = STDIN_FILENO; + _wr_fd = STDOUT_FILENO; fcntl(_rd_fd, F_SETFL, fcntl(_rd_fd, F_GETFL, 0) | O_NONBLOCK); fcntl(_wr_fd, F_SETFL, fcntl(_wr_fd, F_GETFL, 0) | O_NONBLOCK); break;