From b7ea6e44b293d515e616c383ff3910012c4cea6c Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Thu, 21 Jul 2022 16:16:44 +0800 Subject: [PATCH] vfs: uart/cdcacm/usb_serial_jtag fcntl return read/write state --- components/vfs/vfs_cdcacm.c | 2 +- components/vfs/vfs_uart.c | 1 + components/vfs/vfs_usb_serial_jtag.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/vfs/vfs_cdcacm.c b/components/vfs/vfs_cdcacm.c index fb590a445df2..357e67277f34 100644 --- a/components/vfs/vfs_cdcacm.c +++ b/components/vfs/vfs_cdcacm.c @@ -271,7 +271,7 @@ static int cdcacm_fcntl(int fd, int cmd, int arg) assert(fd == 0); int result; if (cmd == F_GETFL) { - result = 0; + result = O_RDWR; if (!s_blocking) { result |= O_NONBLOCK; } diff --git a/components/vfs/vfs_uart.c b/components/vfs/vfs_uart.c index 1f3e0df68334..74c308f32652 100644 --- a/components/vfs/vfs_uart.c +++ b/components/vfs/vfs_uart.c @@ -299,6 +299,7 @@ static int uart_fcntl(int fd, int cmd, int arg) assert(fd >=0 && fd < 3); int result = 0; if (cmd == F_GETFL) { + result |= O_RDWR; if (s_ctx[fd]->non_blocking) { result |= O_NONBLOCK; } diff --git a/components/vfs/vfs_usb_serial_jtag.c b/components/vfs/vfs_usb_serial_jtag.c index f5ab0b1f794c..a0d0771c6c5c 100644 --- a/components/vfs/vfs_usb_serial_jtag.c +++ b/components/vfs/vfs_usb_serial_jtag.c @@ -245,6 +245,7 @@ static int usb_serial_jtag_fcntl(int fd, int cmd, int arg) { int result = 0; if (cmd == F_GETFL) { + result |= O_RDWR; if (s_ctx.non_blocking) { result |= O_NONBLOCK; }