← index #6023Issue #4849
Related · high · value 4.520
QUERY · ISSUE

no input for repl with dupterm

openby uraichopened 2020-05-10updated 2024-11-09

On my esp32 and the esp8266 port REPL does not seem to ask for input except for slot 0.
webrepl shows output but does not take input. Same if I try to use a second serial port. Same for utelnetserver. Is this a dupterm problem?
Working with the newest micropython commit v1.12-447-gab4e19770-dirty

CANDIDATE · ISSUE

[ESP8266] No non-blocking read on uart0 if dupterm is active

closedby Winkelkatzeopened 2019-06-15updated 2019-07-03
port-esp8266

As far as I can see, there is no non-blocking way to read the input from the uart0, if this uart is also used for REPL through dupterm.
In version 1.9 and before it is possible to use the UART.read() function for this, however since commit afd0701bf7a9dcb50c5ab46b0ae88b303fec6ed3 the uart buffer is bypassed when UART 0 is used for REPL, so that UART.read() will never receive any data.
The input data is now directly put into the stdin buffer, which has (as far as I know) no function to check if any data is available.

The only workaround for this would be to disable dupterm for the uart0 while intending to read data. Yet, this is somewhat inconvenient, because then print() also won't output any data on the uart.

I think, the best option is to add a non-blocking read for stdin (or at least a way to check, if data is available for read).
This is not the same as a non-blocking read on the uart, but for most applications, this should be sufficient.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied