I'm trying to improve rshell to handle dropped characters curing cp commands more robustly.
This means that I need to be able to detect dropped characters, which in turn means I need to be able to issue a read on stdin that will timeout.
I tested select/poll and those didn't work. There doesn't seem to be an any() method on stdin.
If non-blocking stdin isn't an option, then I'll probably do something like slip framing and then if the host side fails to get an ACK then it will start sending frame start sharacters until it gets an ACK/NAK (eventually it will send enough frame start characters to satisy the read).
Anybody know how to make stdin non-blocking?
Re: Anybody know how to make stdin non-blocking?
Hi Dave,
I'm not quite sure I understood your problem but we always use termios with c_lflags ICANON == off and parameters:
That makes perfect polling read.
I'm not quite sure I understood your problem but we always use termios with c_lflags ICANON == off and parameters:
Code: Select all
c_cc[VMIN] = 0
c_cc[VTIME] = 0
Re: Anybody know how to make stdin non-blocking?
Sorry, I meant make stdin on the MicroPython side non-blocking.
Re: Anybody know how to make stdin non-blocking?
I thought so. But I agree, having some of the termios features on MPY's stdin would be nice.
So far we are using pyb.USB_VCP() to do things like USB to UART converters on pyboards.
So far we are using pyb.USB_VCP() to do things like USB to UART converters on pyboards.
Re: Anybody know how to make stdin non-blocking?
Yeah - if I were to use pyb.UART or pyb.USB_VSP (or the machine variants) then I could use the any() method.
rshell uses stdin since it doesn't know which UART (if any) is being used, or whether USB is being used.
rshell uses stdin since it doesn't know which UART (if any) is being used, or whether USB is being used.