pei lin | 14 Jul 17:08 2008
Picon

questions about linux termios

Hi,buddy
  I am puzzled by the linux termios.
   First Question about /dev/tty0 and /dev/tty,this two devices is
the same one?
   When i am in X terminal,as /dev/pts/0 , i do "echo hello >
/dev/pts/0 and echo hello > /dev/tty ", they return the same like that
"hello" on the screen .This means /dev/tty ->/dev/pts/0? But "echo
hello > /dev/tty0",there is nothing on the screen.And when i go to
Init 3 mode ,like /dev/tty1,when i do "echo hello > /dev/tty1 and echo
hello > .dev/tty and echo hello > /dev/tty0" ,They return the same all
print hello on the screen.Do they all point to the /dev/tty1?

   The second Question is that i write a small program to get
keyboard input like below.When i run it in X terminal ,when i press
keyboard it can return but can not get the press and release event.And
in the console,like tty1,it doesn't work .i don't know why.

file : get_keyboard.c

#include <stdio.h>
#include <linux/keyboard.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <termios.h>
#include <unistd.h>
int main()
{
       int fd,len,i;
       struct kbentry entry;
(Continue reading)

Frederic Marmond | 14 Jul 20:38 2008
Picon

Re: questions about linux termios

Hi, 
first question:
/dev/tty is the CURRENT terminal, wherever you are, and tty0 is the first one.
So, echo "foobar" > /dev/tty will always display "foobar" on your current 
terminal.
second question: no time right now, maybe latter...

Fred

Le Monday 14 July 2008 à 17:08, pei lin a écrit :
> Hi,buddy
>   I am puzzled by the linux termios.
>    First Question about /dev/tty0 and /dev/tty,this two devices is
> the same one?
>    When i am in X terminal,as /dev/pts/0 , i do "echo hello >
> /dev/pts/0 and echo hello > /dev/tty ", they return the same like that
> "hello" on the screen .This means /dev/tty ->/dev/pts/0? But "echo
> hello > /dev/tty0",there is nothing on the screen.And when i go to
> Init 3 mode ,like /dev/tty1,when i do "echo hello > /dev/tty1 and echo
> hello > .dev/tty and echo hello > /dev/tty0" ,They return the same all
> print hello on the screen.Do they all point to the /dev/tty1?
>
>    The second Question is that i write a small program to get
> keyboard input like below.When i run it in X terminal ,when i press
> keyboard it can return but can not get the press and release event.And
> in the console,like tty1,it doesn't work .i don't know why.
>
> file : get_keyboard.c
>
> #include <stdio.h>
(Continue reading)


Gmane