Open
Description
CircuitPython version
Adafruit CircuitPython 9.0.4 on 2024-04-16; Adafruit KB2040 with rp2040
Code/REPL
if supervisor.runtime.serial_bytes_available:
data = input()
print(data)
Behavior
On windows, enter will be encoded as \r\n (0x0D, 0x0A)
However, the input seems only recognize the \r, and the 0x0A cause the code to freeze at the input()
I've tried to send 0x0D only, the input has response.
Then I tried 0x0A, the input has no response.
Description
I tried to search why this happen on github. It seems the input is linked with mp_builtin_input in modbuiltins.c.
And it leads to readline_process_char.
It processes \r
circuitpython/shared/readline/readline.c
Line 218 in 126a1a4
but not \n
Additional information
It seems circuit python uses the same code as readline_process_char
The Unix port of Circuit python uses fgets to read line. And fgets actually look for \n
And python version of input() will take care \n or \r\n