Hardware Reference
In-Depth Information
The second file is the ser2net binary at /usr/sbin/ser2net . If you run the ser2net binary file with the --help flag
as the only option you will be presented with a little bit of information on how you can run the daemon. You're going
to need to create a configuration file for ser2net to work. Otherwise it will just exit cleanly.
To create a configuration file, create a file called /etc/ser2net.conf . Use whatever editor you like to create
this. Let me explain the configuration file for you. There are three main sections that you can have and only one
is mandatory:
The banner section lets you create a little banner message that will be displayed on that TCP
port when you first connect. It is handy to put the remote device name in it and is also an
optional setting for ser2net.
Next you will have the tracefile. The tracefile option allows you to record the Telnet session to
a file and it is optional. I personally don't use this.
Lastly you will see a set of port and device-mapping options. This section is where the real
action takes place and it is mandatory. I created Table 9-2 to help you understand its format.
Table 9-2. The format of the port section in the ser2net configuration file
Option
Function
Example Value
TCP Port
Sets the TCP port for the given serial device
2001
State
How the port will transmit data
telnet
Timeout
How long before the TCP port times out
600 seconds
Device
The physical serial port device
/dev/ttyAMA0
Now that you can see how the configuration file is set up, it's time to create a simple config file. Each option from
Table 9-2 is separated by a colon apart from the last option's section where each suboption is separated by a space.
In Listing 9-2 you can see my sample ser2net configuration file.
Listing 9-2. A Working Sample ser2net.conf File
# Description : A sample ser2net config file
# Author : Brendan Horan
# Banner Section
BANNER:banner1:Connected to TCP port \p on device \d\r\n\
Remote end:- Brendans Mini210s ARM dev board\r\n
BANNER:banner2:Connected to TCP port \p on device \d\r\n\
Remote end:- Brendans PA-RISC J6750\r\n
# Port config section
2001:telnet:0:/dev/ttyAMA0:115200 banner1
2002:telnet:60:/dev/ttyUSB0:9600 banner2
#EOF
 
 
Search WWH ::




Custom Search