[Toybox] [PATCH] Add "microcom" to pending.
enh
enh at google.com
Sun Jan 15 11:18:32 PST 2017
On Sat, Jan 14, 2017 at 2:50 PM, Rob Landley <rob at landley.net> wrote:
> On 01/14/2017 03:19 PM, enh wrote:
>> Our device bringup folks wanted a simple serial console, both on the
>> host and on the device. This is certainly enough to replace what I've
>> been using personally on the host.
>
> I've used "netcat -f /dev/ttyS0" but you need stty to set it up and it's
> not properly handling ctrl-C and its guts need to be moved out to
> lib/net.c and...
i've almost implemented stty a couple of times now. the input side
seems like a pain (though i assume that existing implementations just
ignore the various conflicts and just do what you said in order), and
the output side is annoyingly under-specified (what to show without
-a, what -g should look like), and so far it's always turned out that
i don't actually need it anyway.
> Sigh. I need time to work through my todo list.
>
>> I'd never heard of "microcom" until I asked the internets what busybox
>> users use, so I don't care what we call this or what the options are
>> called. (But would like to decide before it gets ossified in a million
>> factory test scripts and the like!)
>
> The name microcom is fine. (It's a pun on "minicom" which is a common
> external version.) I was meaning to add that as an alias to netcat -f
> once I got that properly cleaned up and stty implemented.
>
> (Honestly the hard part of microcom, netcat, stty, tcpserv, and so on is
> making them all share infrastructure sanely. They all want _slightly_
> different semntics...)
>
>> The tool that this replaces for me defaulted to /dev/ttyUSB0, but since
>> I don't know whether that default would be useful for most other people
>> too, I left that out. Command-line history will solve my transition
>> problem.
>
> Indeed.
>
> I'll merge this but I'll also try to get it cleaned up and promoted on
> the flight to linuxconf.au so you're not using _another_ command out of
> pending.
>
> Thanks,
>
> Rob
>
> P.S. Hmmm... in lib/ my set_terminal() isn't setting speed, my
> tty_sigreset() is only resetting stdin not a second fd,
note that tty_sigreset (despite the name) is unrelated. that's all
about resetting VT100-style state. the code in microcom is about
resetting line discipline-style state.
similarly, set_terminal has curses-style interests that don't make
sense for microcom (but are probably useful for a wider range of
toys).
> and my
> pollinate() uses "shutdown()" so if you go:
>
> echo GET / | netcat old-http-1.0-server 80
>
> You get output. But in _this_ case, stdin closing probably means you
> want the program to exit because serial console doesn't do the
> unidirectional close thing so you can't tell when/if the other end hung
> up... Slightly Different Semantics. ALMOST the same enough to share
> code. Hmmm...
at the same time, these functions are short enough that abstracting
out to cover both seems like it just makes things worse. keeping the
high-level "curses" stuff distinct from the low-level "serial line"
stuff seems reasonable until/unless we have more of the latter, and
even then it seems likely that the two groups would stay distinct.
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
More information about the Toybox
mailing list