# Setting databits for ttyu



## j4ck (Sep 3, 2013)

Hi,

Is it possible to set databits, flowcontrol, parity and stopbits for e.g. ttyu2?


----------



## fonz (Sep 3, 2013)

Have you checked gettytab(5) and termcap(5)?


----------



## j4ck (Sep 4, 2013)

You know I want to configure e.g. ttyu6 for incoming connections. In order to do so I add the following line to /etc/ttys file:

```
cuau6   "/usr/libexec/getty std.115200" cons25  on secure
```
OK, I can set the line's speed here, but what about the other options? Like databits, stopbits, etc.


----------



## ShelLuser (Sep 4, 2013)

j4ck said:
			
		

> OK, I can set the line's speed here, but what about the other options? Like databits, stopbits, etc.


I've never done this myself before (well, not on FreeBSD that is, I have used modems quite extensively) but you might want to look into the gettytab(5) manualpage. I came across this critter when reading the getty(5) manual page.

The reason I think this might be able to help you are entries such as these:


```
ap      bool    false             terminal uses any parity
     ep      bool    false             terminal uses even parity
     np      bool    false             terminal uses no parity (i.e. 8-bit
                                       characters)
     op      bool    false             terminal uses odd parity
     sp      num     unused            line speed (input and output)
```
Hope this can help.


----------



## j4ck (Sep 8, 2013)

How about using the stty command?


----------



## j4ck (Sep 11, 2013)

Alright, I have added the following entry to the /etc/gettytab file:


```
test.std.115200:\
        :ep:sp#4800:tc:Pc
```

And also I have changed the /etc/ttys file:


```
cuau3   "/usr/libexec/getty test.std.115200"    cons25  on secure
```

I expect the /dev/cuau3 device to use even parity and 4800 as speed, but when I check the device properties using `stty -f /dev/cuau3`, only the speed changes to 4800 and the parity value does not change.

Here's the output of `stty -f /dev/cuau3` after applying the changes using the `kill -HUP 1` command.


```
speed 4800 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost tab3
cflags: cs8 -parenb
```


----------

