[BRLTTY] stty and ofill

Dave Mielke dave at mielke.cc
Thu Oct 1 00:26:17 EDT 2009


[quoted lines by james collins on 2009/09/30 at 12:41 -0400]

>I am trying to use stty to append a NUL character. I tried the  
>following at a shell prompt:
>stty ofill nl1
>That is en-el-one, when I ran this command I got back a shell prompt,  
>but I don't know if it is working? 

Neither feature (ofill, nl) is necessarily implemented on any given platform. 
Let's assume for the moment, however, that it is on yours. The command, if 
entered exactly as shown above, won't do what you're wanting it to do.

stty changes the settings of the serial device which is attached to its 
standard input. This means that you're changing the settings of the serial 
device which is attached to your keyboard/monitor. If your goal is to change 
the settings of the serial port which is attached to your speech synthesizer 
then you need to redirect stty's standard input to that device. So the command, 
in other words, should look like this:

   stty ofill nl1 </dev/whatever

>1. Does stty reset to defaults when I exit the shell, in other words, if I 
>typed in the stty command and then exited my shell, if I reopened my shell 
>would the stty command still be in effect? I don't want to append two NUL 
>characters?

You're actually asking two questions:

First: The settings of a serial device have absolutely nothing to do with the 
shell you invoke the stty command from. In fact, since the stty command is run 
as a child process to the shell, the shell itself knows nothing whatsoever 
about any of the changes you've made. All you're doing when you issue an stty 
command is alter the specified settings of the specified serial device.

Second: Specifying nl1 doesn't mean that exactly one NUL will be appended to 
anything you write to the device. nl1 means that you want a delay which is 
defined in terms of a particular amount of time (I forget how much time it is 
for nl). How many NULs are written, therefore, depends on the output baud of 
the device. The higher the output baud, the more NULs will be written so as to 
cause the right delay duration. I'd expect lots of NULs to be written because 
the purpose of the delay is to allow enough time for a mechanical printer to do 
a real linefeed.

Note that all setting changes are lost when the device is closed. Applying stty 
to a device which is closed, therefore, will simply open the device, change the 
settings, and close the device. In other words, the stty command will 
ultimately have no effect whatsoever. Again, therefore, you need a script which 
opens the device, changes its settings appropriately, writes to it as needed, 
and then closes it.

>2. I am trying to figure out what the stty ofill fill character, is for my mac 
>mac os x 10.6? 

The fill character indeed is NUL if ofdel is off, and is DEL if ofdel is on.

-- 
Dave Mielke           | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario   | 2011 May 21 is the Day of Judgement.
EMail: dave at mielke.cc | Canada  K2A 1H7   | 2011 Oct 21 is the End of the World.
http://FamilyRadio.com/                   | http://Mielke.cc/bible/


More information about the BRLTTY mailing list