8000 RP2/machine_uart.c: Fix poll ioctl. · micropython/micropython@19e16d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 19e16d9

Browse files
committed
RP2/machine_uart.c: Fix poll ioctl.
* The RX IRQ does not trigger if the FIFO is less than the trigger level. * Use machine_uart_any to check for readability to drain the RX FIFO.
1 parent 6a9133a commit 19e16d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ports/rp2/machine_uart.c

Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ STATIC mp_uint_t machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint
477477
if (request == MP_STREAM_POLL) {
478478
uintptr_t flags = arg;
479479
ret = 0;
480-
if ((flags & MP_STREAM_POLL_RD) && ringbuf_avail(&self->read_buffer) > 0) {
480+
if ((flags & MP_STREAM_POLL_RD) && (uart_is_readable(self->uart) || ringbuf_avail(&self->read_buffer) > 0)) {
481481
ret |= MP_STREAM_POLL_RD;
482482
}
483483
if ((flags & MP_STREAM_POLL_WR) && ringbuf_free(&self->write_buffer) > 0) {

0 commit comments

Comments
 (0)
0