Полезная информация Работа райдера stiga http://www.agrozakaz.ru.

Chapter 14. Serial Communications

Table of Contents
14.1. Serial Basics
14.2. Terminals
14.3. Dialin Service
14.4. Dialout Service
14.5. Setting Up the Serial Console

14.1. Serial Basics

Assembled from FAQ.

This section should give you some general information about serial ports. If you do not find what you want here, check into the Terminal and Dialup sections of the handbook.

The ttydX (or cuaaX) device is the regular device you will want to open for your applications. When a process opens the device, it will have a default set of terminal I/O settings. You can see these settings with the command

    # stty -a -f /dev/ttyd1

When you change the settings to this device, the settings are in effect until the device is closed. When it is reopened, it goes back to the default set. To make changes to the default set, you can open and adjust the settings of the ``initial state'' device. For example, to turn on CLOCAL mode, 8 bits, and XON/XOFF flow control by default for ttyd5, do:

    # stty -f /dev/ttyid5 clocal cs8 ixon ixoff

A good place to do this is in /etc/rc.serial. Now, an application will have these settings by default when it opens ttyd5. It can still change these settings to its liking, though.

You can also prevent certain settings from being changed by an application by making adjustments to the ``lock state'' device. For example, to lock the speed of ttyd5 to 57600 bps, do

    # stty -f /dev/ttyld5 57600

Now, an application that opens ttyd5 and tries to change the speed of the port will be stuck with 57600 bps.

Naturally, you should make the initial state and lock state devices writable only by root. The MAKEDEV script does not do this when it creates the device entries.