l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Nov 04 01:23

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Serial on RedHat 9?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Serial on RedHat 9?

First off, the Linux kernel can't auto-detect the IRQ of the serial port,
so it won't show up on /proc/interrupts.... ever (it *might* show up
while you're using the port.)

The I/O port, too, is not really auto-detectable.  Linux can query the
BIOS, but the BIOS can often be unreliable so I'm not sure if Linux uses
the I/O port information from the BIOS or not.  I think it ignores it

In any case, Linux *assumes* the following settings on all PC if it's not

   COM1  /dev/ttyS0  port 0x03f8  irq 4
   COM2  /dev/ttyS1  port 0x02f8  irq 3
   COM3  /dev/ttyS2  port 0x03e8  irq 4
   COM4  /dev/ttyS3  port 0x02e8  irq 3

To see if the setting is correct, run the `setserial` program:

   # setserial /dev/ttyS0
   /dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
   # setserial /dev/ttyS1
   /dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
   # setserial /dev/ttyS2
   /dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
   # setserial /dev/ttyS3
   /dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3

So the setserial tells me I got one serial port (/dev/ttyS0) under the
default port (0x03f8), because it tells me it detected a recognizable UART
(16550A).  The other ports either don't exist, or their I/O ports haven't
been configured correctly, because their UART is unknown.

I seem to recall on the older kernels that it used to report an older type
of UART (8250?) if it can't determine what UART it is.  In either case, on
all modern systems, you should get a 16550A as the UART if Linux detects
the port.

As far as the IRQs go, `setserial` tells me what Linux thinks the ports'
IRQ settings are, but there's no way to verify those are the correct AFAIK
until you actually try out the port.

Now.... if you're not using the standard I/O port and IRQ settings, or if
you have a PNP serial port, you gotta figure out what the correct settings
for the port and the IRQ are.  Once you figure those out, you can tell
Linux to use those settings by running `setserial` again:

   # setserial /dev/ttyS0 port 0x02f8    # change I/O port
   # setserial /dev/ttyS0 autoconfig     # redetect UART
   # setserial /dev/ttyS0
   /dev/ttyS0, UART: unknown, Port: 0x02f8, IRQ: 4

Now that I misconfigured my /dev/ttyS0 on purpose, you can see Linux shows
UART can't be detected.  If I change the I/O back to the correct setting,
it'll detect the UART correctly.  You can change the IRQ this way, too,
but you can't check to see if you got the correct IRQ this way because the
UART detection depends only on the I/O port.

For more details on using the setserial program and its capabilities,
check `man setserial`.

So to sum it up, Linux can't autodetect the serial port settings, so you
gotta manually change it if it's not using the standard settings.  And to
do that, you first gotta figure out what the settings are, then set them
using `setserial`.  You verify the I/O port settings are correct using
`setserial` following the above steps, but you can't check to see if the
IRQ is correct unless you try out a serial port program.

I hope that helps.


On Mon, 3 Nov 2003, Mitch Patenaude wrote:

> I've got a generic, straight, generic RH 9.0 install on my IBM thinkpad
> T20, and it appears that it doesn't have serial drivers in the kernel
> by default, and I can't even figure out which drivers I should load.
> (lsmod doesn't show them... cat /proc/interrupts doesn't show irq 3 or
> 4 in use, /proc/ioports missing, etc)
> Can anybody point me in the right direction?  Please don't tell me that
> I need to do a kernel build just to get serial ports working?!
>    -- Mitch
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech

Mark K. Kim
AIM: markus kimius
Homepage: http://www.cbreak.org/
Xanga: http://www.xanga.com/vindaci
Friendster: http://www.friendster.com/user.jsp?id=13046
PGP key fingerprint: 7324 BACA 53AD E504 A76E  5167 6822 94F0 F298 5DCE
PGP key available on the website
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!