Chapter 15 Serial Communications

This section answers common questions about serial communications with FreeBSD. PPP and SLIP are covered in the Networking section.

15.1. How do I tell if FreeBSD found my serial ports?
15.2. How do I tell if FreeBSD found my modem cards?
15.3. How do I access the serial ports on FreeBSD?
15.4. How do I enable support for a multiport serial card?
15.5. Can FreeBSD handle multiport serial cards sharing IRQs?
15.6. Can I set the default serial parameters for a port?
15.7. How can I enable dialup logins on my modem?
15.8. How can I connect a dumb terminal to my FreeBSD box?
15.9. Why can I not run tip or cu?
15.10. My stock Hayes modem is not supported -- what can I do?
15.11. How am I expected to enter these AT commands?
15.12. Why does the @ sign for the pn capability not work?
15.13. How can I dial a phone number on the command line?
15.14. Do I have to type in the bps rate every time I do that?
15.15. How can I more easily access a number of hosts through a terminal server?
15.16. Can tip try more than one line for each site?
15.17. Why do I have to hit Ctrl+P twice to send Ctrl+P once?
15.18. Why is everything I type suddenly in UPPER CASE?
15.19. How can I do file transfers with tip?
15.20. How can I run zmodem with tip?

15.1. How do I tell if FreeBSD found my serial ports?

As the FreeBSD kernel boots, it will probe for the serial ports in your system for which the kernel was configured. You can either watch your system closely for the messages it prints or run this command after your system is up and running:

% dmesg | grep -E "^sio[0-9]"

Here is some example output from the above command:

sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 16550A
sio1: <16550A-compatible COM port> port 0x2f8-0x2ff irq 3 on acpi0
sio1: type 16550A

This shows two serial ports. The first is on IRQ 4, is using port address 0x3f8, and has a 16550A-type UART chip. The second uses the same kind of chip but is on IRQ 3 and is at port address 0x2f8. Internal modem cards are treated just like serial ports -- except that they always have a modem “attached” to the port.

The GENERIC kernel includes support for two serial ports using the same IRQ and port address settings in the above example. If these settings are not right for your system, or if you have added modem cards or have more serial ports than your kernel is configured for, just reconfigure your kernel. See section about building a kernel for more details.

15.2. How do I tell if FreeBSD found my modem cards?

Refer to the answer to the previous question.

15.3. How do I access the serial ports on FreeBSD?

The third serial port, sio2 (see sio(4), known as COM3 in DOS), is on /dev/cuad2 for dial-out devices, and on /dev/ttyd2 for dial-in devices. What is the difference between these two classes of devices?

You use ttydX for dial-ins. When opening /dev/ttydX in blocking mode, a process will wait for the corresponding cuadX device to become inactive, and then wait for the carrier detect line to go active. When you open the cuadX device, it makes sure the serial port is not already in use by the ttydX device. If the port is available, it “steals” it from the ttydX device. Also, the cuadX device does not care about carrier detect. With this scheme and an auto-answer modem, you can have remote users log in and you can still dial out with the same modem and the system will take care of all the conflicts.

15.4. How do I enable support for a multiport serial card?

Again, the section on kernel configuration provides information about configuring your kernel. For a multiport serial card, place an sio(4) line for each serial port on the card in the device.hints(5) file. But place the IRQ specifiers on only one of the entries. All of the ports on the card should share one IRQ. For consistency, use the last serial port to specify the IRQ. Also, specify the following option in the kernel configuration file:

options COM_MULTIPORT

The following /boot/device.hints example is for an AST 4-port serial card on IRQ 12:

hint.sio.4.at="isa"
hint.sio.4.port="0x2a0"
hint.sio.4.flags="0x701"
hint.sio.5.at="isa"
hint.sio.5.port="0x2a8"
hint.sio.5.flags="0x701"
hint.sio.6.at="isa"
hint.sio.6.port="0x2b0"
hint.sio.6.flags="0x701"
hint.sio.7.at="isa"
hint.sio.7.port="0x2b8"
hint.sio.7.flags="0x701"
hint.sio.7.irq="12"

The flags indicate that the master port has minor number 7 (0x700), and all the ports share an IRQ (0x001).

15.5. Can FreeBSD handle multiport serial cards sharing IRQs?

Not yet. You will have to use a different IRQ for each card.

15.6. Can I set the default serial parameters for a port?

See the Serial Communications section in the FreeBSD Handbook.

15.7. How can I enable dialup logins on my modem?

Please read the section about Dial-in Services in the FreeBSD Handbook.

15.8. How can I connect a dumb terminal to my FreeBSD box?

You can find this information in the Terminals section of the FreeBSD Handbook.

15.9. Why can I not run tip or cu?

On your system, the programs tip(1) and cu(1) can only access the /var/spool/lock directory via user uucp and group dialer. You can use the group dialer to control who has access to your modem or remote systems. Just add yourself to group dialer.

Alternatively, you can let everyone on your system run tip(1) and cu(1) by typing:

# chmod 4511 /usr/bin/cu
# chmod 4511 /usr/bin/tip

15.10. My stock Hayes modem is not supported -- what can I do?

See this answer in the FreeBSD Handbook.

15.11. How am I expected to enter these AT commands?

See this answer in the FreeBSD Handbook.

15.12. Why does the @ sign for the pn capability not work?

See this answer in the FreeBSD Handbook.

15.13. How can I dial a phone number on the command line?

See this answer in the FreeBSD Handbook.

15.14. Do I have to type in the bps rate every time I do that?

See this answer in the FreeBSD Handbook.

15.15. How can I more easily access a number of hosts through a terminal server?

See this answer in the FreeBSD Handbook.

15.16. Can tip try more than one line for each site?

See this answer in the FreeBSD Handbook.

15.17. Why do I have to hit Ctrl+P twice to send Ctrl+P once?

See this answer in the FreeBSD Handbook.

15.18. Why is everything I type suddenly in UPPER CASE?

See this answer in the FreeBSD Handbook.

15.19. How can I do file transfers with tip?

See this answer in the FreeBSD Handbook.

15.20. How can I run zmodem with tip?

See this answer in the FreeBSD Handbook.