-->
Page 139
Page 140
Page 141
In this hour, you'll learn about communicating with the outside world by using programs installed from this book's CD-ROM. You'll learn how to set up your serial port or modem, configure and use two communication programs, and send and receive faxes with Linux.
Although your CD-ROM contains all the software you'll need to run Linux communications programs, you'll need a serial communications port and modem to dial out with your Linux system. I assume that you're familiar with modems; communication terms such as baud rate, parity, or stop bits; and how to connect your modem to your computer.
Page 142
Your first task is to find your spare serial port. You should be able to find the port on the back of your computer, and it will most likely have 9 or 25 pins. If you're using a laptop, you may have a 9-pin male serial port, an RJ-11 telephone jack for an internal modem, or a PCMCIA modem card with an RJ-11 telephone jack.
You'll find your serial port in Linux by looking in the device or /dev directory. Many devices are defined there, such as hard drives, floppies, and printers, but you should look for devices of type cua or ttyfor example,
# ls /dev/cua* /dev/ttyS* /dev/cua0 /dev/cua2 /dev/ttyS0 /dev/ttyS2 /dev/cua1 /dev/cua3 /dev/ttyS1 /dev/ttyS
These devices correspond to the traditionally defined DOS serial ports, as shown in Table 9.1.
Table 9.1. DOS and Linux serial ports.
DOS Port | Linux Device |
COM1 | /dev/cua0, /dev/ttyS0 |
COM2 | /dev/cua1, /dev/ttyS1 |
COM3 | /dev/cua2, /dev/ttyS2 |
COM4 | /dev/cua3, /dev/ttyS3 |
If you have a laptop with a PCMCIA modem card, you won't be able to use your modem (or any other PCMCIA devices) until you enable those services and tell Linux to look for PCMCIA devices when it starts. To enable your PC card modem, make sure that you're logged in as the root operator and edit the file named pcmcia in the /etc/sysconfig directory, to look like the following:
PCMCIA=yes PCIC=i82365 PCIC_OPTS= CORE_OPTS=
This tells Linux to install PCMCIA services. Save the file, and then reboot Linux. Your PC card modem (and other PC cards, if installed) should be recognized during the reboot.
Page 143
JUST A MINUTE |
If you have trouble with PCMCIA devices, read David Hinds' PCMCIA-HOWTO, which you'll find under the /usr/doc directory. If you want the latest information, you can also browse to |
You can check to make sure that your serial ports are enabled by checking portions of the Linux startup message, dmesg, which is found under the /var/log directory. You can use the dmesg command, found under the /bin directory, to read this startup logfor example,
# dmesg ... Serial driver version 4.13 with no serial options enabled tty00 at 0x03f8 (irq = 4) is a 16550A tty03 at 0x02e8 (irq = 3) is a 16550A ...
A portion of the dmesg file is reproduced here, so you can see what to look for. If you don't see a serial driver, or serial port listing, you must make sure that serial-line support is enabled for your Linux kernel.
To test your modem, make sure that you're running as the root operator, make sure that your modem is on and connected, and then try
# echo "ATDTXXX-XXXX/n" >/dev/cuaN
The number represented as XXX-XXXX is your phone number; N is the serial port you want to test. Wait at least 30 seconds or so and you should hear a dial tone, followed by the dialing, and then a busy signal. This can also be a handy way, when you have your modem working, to get the current time (albeit spoken in the tinny voice of your modem's speaker). Just insert the phone number for your local phone company's time-of-day service, save the command line in a file, and make it executable. Here's an example:
# cat > dotime echo "ATDT373-0660/n" >/dev/cua1 # chmod +x dotime # ./dotime
This creates the file with the cat command (after you type the command line, press Ctrl and the D key to save it). The chmod command then makes the file executable so you can run it with the final command line. If you want to test your modem interactively, you can try the minicom program discussed in the section "Dialing Out with Communications
Page 144
Programs."
You can also use the Red Hat X11 control-panel client to set up your modem. Make sure that you're running as the root operator, and then run the control-panel client. When you click the modemtool command in the control panel, the program modemtool, found under the /usr/bin/ directory, will run and present a list of serial ports. Select one, and then click OK.
This program makes a symbolic link (discussed in Hour 5, "Manipulation and Searching Commands") from the selected device to a file called /dev/modem. You can do the same thing from the command line by using the ln command to create the symbolic link yourself. For example, if you have your modem connected to COM2, make sure that you're running as root, and enter
# ln -s /dev/cua1 /dev/modem
This will create a symbolic link, /dev/modem, which points to the serial port connected to your modem.
This section covers two communications programs that come with your Linux distribution: minicom and seyon. The minicom program can be used with or without running X11. The seyon program must be used while you're running the X Window System.
You'll also find an old communications program, called cu, under the /usr/bin directory. This program isn't as friendly as minicom or seyon, but if you're interested in setting up and trying this program, read the cu man page, and definitely read the uucp software documentation under the /usr/doc directory.
The minicom program, by Miquel van Smoorenburg and located under the /usr/bin directory, is a friendly communication program you can use to dial out and connect with other computers or BBSs. You can use minicom without running X11, but if you're running X11, you should use the xminicom script, also located under the /usr/bin directory.
The first time you use minicom, make sure that you're running as the root operator so
you can set up and save minicom's default file,
minirc.dfl, which will be created and saved in the
/etc directory. Assuming that you're using X11, you can start
minicom with
# xminicom &