mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
vfs: usb_serial_jtag: consider O_NONBLOCK flag when reading via driver
Closes https://github.com/espressif/esp-idf/issues/8839
This commit is contained in:
@ -71,8 +71,11 @@ typedef struct {
|
|||||||
// Read and write locks, lazily initialized
|
// Read and write locks, lazily initialized
|
||||||
_lock_t read_lock;
|
_lock_t read_lock;
|
||||||
_lock_t write_lock;
|
_lock_t write_lock;
|
||||||
// Non-blocking flag. Note: default implementation does not honor this
|
// Non-blocking flag.
|
||||||
// flag, all reads are non-blocking. ToDo: implement driver that honours this.
|
// The default implementation does not honor this flag, all reads
|
||||||
|
// are non-blocking.
|
||||||
|
// When the driver is used (via esp_vfs_usb_serial_jtag_use_driver),
|
||||||
|
// reads are either blocking or non-blocking depending on this flag.
|
||||||
bool non_blocking;
|
bool non_blocking;
|
||||||
// Newline conversion mode when transmitting
|
// Newline conversion mode when transmitting
|
||||||
esp_line_endings_t tx_mode;
|
esp_line_endings_t tx_mode;
|
||||||
@ -389,7 +392,8 @@ esp_err_t esp_vfs_dev_usb_serial_jtag_register(void)
|
|||||||
static int usbjtag_rx_char_via_driver(int fd)
|
static int usbjtag_rx_char_via_driver(int fd)
|
||||||
{
|
{
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
int n = usb_serial_jtag_read_bytes(&c, 1, portMAX_DELAY);
|
TickType_t timeout = s_ctx.non_blocking ? 0 : portMAX_DELAY;
|
||||||
|
int n = usb_serial_jtag_read_bytes(&c, 1, timeout);
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user