Updated 2011-08-16 01:31:08 by RLE

Anyone have tips on using serial ports on platforms other than Windows?

The man pages one should read if one is interested in serial ports: fconfigure open fileevent, ... basically all that is listed under channel, ignoring socket.

  • All: relevant options to fconfigure are described in "man open".
  • Linux: opening a special device with the proper major/minor numbers always succeeds independent of there being any hardware attached or not. The first error usually happens when doing [ fconfigure -mode ... ] with -mode not a valid option for ...
  • NetBSD: When a terminal file is opened, it normally causes the process to wait until a connection is established. For most hardware, the presence of a connection is indicated by the assertion of the hardware CARRIER DETECT (DCD) line. This is a problem since most hardware and/or cables in common use ignores this line. Using the NONBLOCK flag with open is not enough to get things right, because the DCD is also used to detect the eof condition, causing the channel to assert eof after the first read or gets. There's a patch which adds a new flag to fconfigure, -ignoredcd (only on unix machines with conforming termios interface) which controls whether the underlying device driver ignores the DCD line or not. Without this patch, the (non-portable) way to use a serial port lacking the DCD line is:
    set device /dev/tty00
    set fd [open $device {RDWR NONBLOCK}]
    exec stty -f $device clocal

See also: