On 12/31/2014 11:10:29 PM, Rob Landley wrote: > On 12/31/14 23:14, Isaac Dunham wrote: >> On Wed, Dec 31, 2014 at 10:19:47PM -0600, Rob Landley wrote: >>> I've used netcat -f /dev/ttyUSB0 as a terminal, the netcat help points >>> out you need to use stty first to set up the terminal: >>> >>> Use "stty 115200 -F /dev/ttyS0 && stty raw -echo -ctlecho" with >>> netcat -f to connect to a serial port. >>> >>> On my todo list is gluing the two of those together into a nanoterm but >>> I need to cleanup and promote stty first and that command is... complicated. >>> >>> Um, correction. Looks like I need to implement it. (Not in pending. >>> might be in ashwini's patch pile...) >> >> To save you the trouble of looking: >> I haven't seen an stty patch (that was actually my complaint about reset). > > stty isn't hard, it's just long. > > Lemme rephrase that: stty has 8 gazillion config options that aren't > always obvious how to implement. > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/stty.html > I thought it seemed fairly straight forward. Tedious if you want the whole set but straight forward, since a lot of it can be implementation defined if you do something mutually exclusive the results are unspecified. a bunch of the commands include if possible. The reason the current version in busybox is such a mess is poor organization and an ifdef forest to support a bunch of very old OSes that were missing parts of the standard. 9 control character settings 35 toggles +7 one of severals (cs5 cs6 cs7 cs8) for 18 symbols and the combo modes that are combos of the above
only two required options -a : output all the current settings -g : output all the current settings in unspecified format acceptable as input to stty and not requiring shell escapes > The entire historical unix layer is one of those things that evolved > from teletype machines with 6 bit serial interfaces driving a daisy > wheel (_5_ bit serial back in the 1930's, they had a shift code between > two pages, yes really: > http://www.textfiles.com/bitsavers/pdf/teletype/144_Model15_Descr_Feb31.pdf > ). > Hey, I always liked the model 15 it was built like a brick, and they built them for over 50 years, how many other pieces of complex high tech gear will be built in the same model for that long ;) The 5-level code is usually called Baudot after the inventor of the first version in 1874 is still in use today, still at 60wpm or 45.45 baud (22ms/bit), after all on amateur radio the FCC did not even permit ASCII until 1980. The code evolved from 5 keys played like a piano with a code chosen to minimize operator fatigue through electro mechanical version where the bit patterns were chosen to minimize wear in sort of a combination of Morse code and a typewriter. The reason it is called a shift code is that it literally shifted the carriage up and down just like in a mechanical typewriter. The daisy-wheel was used in some of the first experimental systems but most of the teletypes were more like a mechanical typewriter. Some of the last models made were more like the IBM Selectric typewriter. The 1.42 stop bits were used to resynchronize the clutch, in the mechanical serial to parallel converter. The original daisy-wheels tended to use synchronous motors and getting everything synced up was hard. Asynchronous was tolerant of minor variations in equipment timing and still worked. The only six-level code I know of was for the Lin-o-type machines in a teletypesetter. Where lowercase letters, ligatures like fi, fl, oe and quadding (blank space on left, right or both sides) and mechanical automatic justification was required and used in newspapers to cast the lead slugs of a entire line of type. > For most of toybox all I really care about is "raw mode vs cooked mode", > but stty has to flip all the switches individually... And if you don't require it to succeed at processing all those other options then that looks very simple, load one set of constants or the other and call tcsetattr > > It's on the todo list. > >> HTH, >> Isaac Dunham > > Rob > _______________________________________________ > Toybox mailing list > [email protected] > http://lists.landley.net/listinfo.cgi/toybox-landley.net > _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
