[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stty procedure for setting serial port



This one time, at band camp, Larry Smith said:
> I know I can do something like this:
> stty -g </dev/ttyS0 >save_file
> 
> To get a hex listing of parameters for ttyS0 saved
> into a file (called save_file here).  Supposedly the
> -g options list the parameters in a way making them
> compatible as parameters for another stty command.
> 
> So how do I do that?  How would I take a saved set of
> serial commands (using -g option), and later
> re-instating them as the settings for a port with
> stty?
> 
> I've tried stty <save_file >/dev/ttyS0, but that
> doesn't work.
> 
> I tried editing the file and making the dumped arments
> part of a complete command, like this:
> 
> stty dumped_parameters >/dev/ttyS0
> 
> That doesn't work either.
> 
> What's the use of -g if I can't use what I get from
> it?

Not totally sure if this is what you're trying to do, but have you
looked at setserial?  IIRC, it saves it's findings after the first run
in a conffile, and uses them for later runs.  This conffile is also used
to (somehow - magic, I'm guessing) take all the work out of configuring
serial ports at boot time.  Worked wonders for me on an old laptop.

HTH,
Steve

-- 
"Ignorance is the soil in which belief in miracles grows."
-- Robert G. Ingersoll

Attachment: pgpIG7NIjQVl1.pgp
Description: PGP signature


Reply to: