If you're using Linux at home or in a small office, you probably want to use the modem for one or more of the following reasons:
To dial out to another computer, an online service (such as America Online), or another UNIX system, perhaps at your university or company.
To enable other people to dial in and use your Linux system. If your home PC runs Linux and you have a modem set up, you might even dial in to your home system from work.
To use dial-up networking with Serial Line Internet Protocol (SLIP) or Point-to-Point Protocol (PPP) to connect to the Internet (typically through an Internet service provider).
The following sections describe how to use a modem to dial out from your Linux PC. Dial-up networking with SLIP or PPP is an important topic in itself: Chapter 13 covers that subject in detail.
Many PCs and laptops come with Winmodems that turn over much of the modem's signal-processing functions to the main CPU. These modems work only with special software that performs the necessary parts of the modem's functions. For this reason, they are often called software modems. Initially, such software modems came with special driver software for Microsoft Windows only; hence the name Winmodem (for Windows modem). Lately, Linux software necessary to operate these modems has become available. If your system has a Winmodem, you should visit the Linux Winmodem Support homepage at http://www.linmodems.org/ to learn more about Linux support for various models of Winmodems. For a list of Linux-compatible Winmodems-or Linmodems, as they are often called-visit the Web page at http://www.idir.net/~gromitkc/winmodem.html.
You should be able to use USB modems in Linux provided that you load the acm module that supports the Abstract Control Model (ACM) of the USB Communication Device Class (CDC) specification. The USB modem must also comply with the CDC specification; otherwise, it will not work with the acm driver module.
You also must set up the device node entries for the modems. You can use up to 32 modems with the acm driver. For example, the following commands set up the first four modem devices:
mknod /dev/usb/ttyACM0 c 166 0 mknod /dev/usb/ttyACM1 c 166 1 mknod /dev/usb/ttyACM2 c 166 2 mknod /dev/usb/ttyACM3 c 166 3
After you set up the devices and load the acm driver (type the command modprobe acm while logged in as root), you should be able to use a serial communication program such as minicom to dial out of a USB modem by specifying /dev/usb/ttyACM0 as the device name for the modem.
When you install Red Hat Linux from this book's companion CD-ROMs, you automatically install some tools you can use to dial out from your Linux system with a modem. Before you can dial out, however, you have to make sure you have a modem properly connected to one of the serial ports of your PC and that the Linux devices for the serial ports are set up correctly.
Make sure that your modem is properly connected to the power supply and the telephone line.
Buy the right type of cable to connect the modem to the PC. As explained in earlier sections of this chapter, you need a straight-through serial cable to connect the modem to the PC. The types of connectors at the ends of the cable depend on the type of serial connector on your PC. The modem end of the cable needs a male DB-25 connector. The PC end of the cable often is a female DB-9 connector, but, in addition, some PCs need a female DB-25 connector at the PC end of the cable.
You can buy modem cables at most computer stores. In particular, the DB-9 to DB-25 modem cables are often sold as AT modem cables.
If your PC's serial port is a DB-25, the connector at the back of the PC (not the one on the cable) is a male DB-25 connector. Don't confuse this connector with the parallel port's DB-25 connector, which is female. If you use the wrong connector, no damage should occur, but serial communication won't work.
If your PC has an internal modem, all you have to do is make sure the IRQ and I/O addresses are set properly (assuming that the modem card has jumpers for setting these values). For COM1, set the IRQ to 4 and the I/O address to 0x3f8; for COM2, set the IRQ to 3 and the I/O address to 0x2f8. You also have to connect the phone line to the phone jack at the back of the modem card.
When you install Red Hat Linux from this book's CD-ROMs, following the directions in Chapter 2, the necessary Linux serial devices are automatically created for you. You should have the /dev/ttyS* devices for dialing in and out through the modem.
The installation process creates the /dev/ttyS* files with a permission setting that does not enable everyone to read the device. If you want any user to be able to dial out with the modem, type the following command while you are logged in as root:
chmod o+rw /dev/ttyS*
This command gives all users access to the dial-out devices.
Another approach is to create a group named ppp and to make it the owner of the /dev/ttyS* files. Then, you can add to the ppp group those users you trust to use the dial-out capability.
To verify that the Linux kernel has detected the serial port correctly, check the boot messages by typing dmesg | grep ttyS in a terminal window. If you see a message about the serial driver being loaded, the next few lines should show information about one or more serial ports on your system. On one of my PCs, for example, I get the following message for the first serial port (COM1):
ttyS0 at 0x03f8 (irq = 4) is a 16550A
You can also check for the serial ports with the setserial command. Type setserial -g /dev/ttyS? to see detailed information about the serial ports. A telltale sign of a problem is a message from setserial of the form:
/dev/ttyS0, UART: unknown, Port: 0x03f8, IRQ: 4
If the UART is shown as unknown, this means the serial port was not detected. This usually occurs because your PC's BIOS is set up to expect a Plug and Play (PnP) operating system. You should reboot your PC and, as it powers up, press a key (typically you have to press a function key such as F2, but the exact key depends on your PC's BIOS) to enter BIOS setup. In the setup screen, locate the option for PnP operating system (often labeled 'Plug & Play O/S') and turn that option off. Then, save the BIOS settings and exit. This causes the PC to reboot. This time, when Linux boots again, the kernel should be able to detect the PC's serial port correctly.
After you complete the physical installation of the modem and verify that the necessary Linux device files exist, you can try to dial out through the modem. The best approach is to use the Minicom serial communications program included in the Linux distribution on this book's CD-ROM and installed in the /usr/bin directory. The Minicom program is a serial communication program with a text-based interface that emulates a VT102 terminal. Minicom is similar to other communication software, such as Procomm or Crosstalk, which you may have used under MS-DOS or Windows.
To run Minicom, type minicom at the shell prompt in a terminal window or in a virtual console. If you run Minicom as a normal user (not root), Minicom may display the following error message and exit:
minicom minicom: there is no global configuration file /etc/minirc.dfl Ask your sysadm to create one (with minicom -s).
Log in as root, and type:
Minicom starts and displays a dialog box that lets you configure various aspects of Minicom, including serial-port commands and the modem-dialing commands. Make any changes you want, and then use the up and down arrow keys to highlight the item labeled Save as dfl (meaning save as default); then, press Enter. Minicom saves the settings in the /etc/minirc.dfl file-the default configuration file for Minicom. After that, you can exit Minicom by selecting Exit from Minicom and pressing Enter.
You also need to do the following before any user can run Minicom:
Make sure that the text file /etc/minicom.users has a line containing the word ALL. (This enables all users to access Minicom's default configuration file.)
Assuming that you want all users to be able to dial out using the modem, enable any user to read from and write to the serial port where the modem is connected. For example, if the modem is on COM1 (/dev/ttyS0), type chmod o+rw /dev/ttyS0 to give everyone write permission for that device.
Establish a link between the /dev/modem and the serial port device where the modem is connected. If the modem is on COM1 (/dev/ttyS0), you should type the following command:
ln -s /dev/ttyS0 /dev/modem
After that, you can run Minicom as an ordinary user. When Minicom first runs, it resets the modem.
The Minicom program is similar to an older shareware communication program named Telix. As in that program, you can press Ctrl-A to get the attention of the Minicom program. After you press Ctrl-A, if you press Z, a help screen appears in the form of a text window.
In the help screen, you can get information about other Minicom commands. From the help screen, press Enter to return to online mode. In online mode, you can use the modem's AT commands to dial out. In particular, you can use the ATDT command to dial the phone number of another modem (for example, your Internet service provider's computer or a system at work). Once you get the login prompt, you can log in as usual and use the remote system.
When you log out of the other system and want to exit Minicom, press Ctrl-A, then type X to exit the program. Press Enter again in response to the Minicom prompt.