[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#122142: Happens here too



On Wed, Jan 16, 2002 at 04:49:06PM -0800, Matt Kraai wrote:
> Hmm.  Would you run the ioctl Richard mentioned on /dev/console
> and see what it returns?
OK, here is some of dmesg
Kernel command line: root=/dev/sda1 ro console=ttyS0
Console: mono PROM 80x34
Calibrating delay loop... 719.25 BogoMIPS

ebus0: [auxio] [power] [SUNW,pll] [su] [su] [ecpp] [fdthree] [eeprom]
[flashprom] [watchdog] [display7seg] [beeper] [flashprom] [flashprom] [i2c -> (adc) (gpio)
 (gpio)] [i2c] [SUNW,lom]
PCIO serial driver version 1.54
su(serial) at 0x1fff13803f8 (tty 0 irq 10,7dc) is a 16550A
su(serial) at 0x1fff13602f8 (tty 1 irq 10,7d4) is a 16550A

VFS: Mounted root (ext2 filesystem) readonly.
Warning: unable to open an initial console.
Adding Swap: 51184k swap-space (priority -1)
eth5: Link is up using external transceiver at 100Mb/s, Full Duplex.

Don't know why i get the error about the console, there is a getty on
ttyS0

Here is my example program:
#include <stdio.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/serial.h>

int main()
{
        int fd;
        struct serial_struct ser;

        fd = open("/dev/console",O_RDONLY);


        /* Are we on a serial console? */
        if (ioctl(fd, TIOCGSERIAL, &ser) < 0)
                  /* Not on a serial console */
                  printf("Not on serial line.\n");
        else {
              /* Serial console on ttySx */
              printf ("serial console found on line %d\n", ser.line);
        }
}

# ./test
Not on serial line.

Changing the device to /dev/ttyS0 says serial console on line 0

I ran the same program on my alpha which also has a serial line and both
/dev/console and /dev/ttyS0 say yes there is a serial cosnole there.

So why is a ttya on a Netra T1 not a serial console, but is a serial console?


-- 
Craig Small VK2XLZ  GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
Eye-Net Consulting http://www.eye-net.com.au/        <csmall@eye-net.com.au>
MIEEE <csmall@ieee.org>                 Debian developer <csmall@debian.org>



Reply to: