mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/open_uart_non_blocking' into 'master'
Make UART non-blocking when the file descriptor was opened with the O_NONBLOCK flag See merge request idf/esp-idf!2153
This commit is contained in:
commit
1a302cbac1
@ -91,15 +91,22 @@ static int uart_open(const char * path, int flags, int mode)
|
||||
{
|
||||
// this is fairly primitive, we should check if file is opened read only,
|
||||
// and error out if write is requested
|
||||
int fd = -1;
|
||||
|
||||
if (strcmp(path, "/0") == 0) {
|
||||
return 0;
|
||||
fd = 0;
|
||||
} else if (strcmp(path, "/1") == 0) {
|
||||
return 1;
|
||||
fd = 1;
|
||||
} else if (strcmp(path, "/2") == 0) {
|
||||
return 2;
|
||||
fd = 2;
|
||||
} else {
|
||||
errno = ENOENT;
|
||||
return fd;
|
||||
}
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
|
||||
s_non_blocking[fd] = ((flags & O_NONBLOCK) == O_NONBLOCK);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void uart_tx_char(int fd, int c)
|
||||
|
Loading…
x
Reference in New Issue
Block a user