Andy Isaacson wrote:
> 
> On Wed, Oct 23, 2002 at 02:12:25AM +1000, Russell wrote:
> > I'm testing out some terminal escape sequences as in:
> >   http://cns.georgetown.edu/~ric/howto/Xterm-Title/ctlseqs.txt
> > Just try typing: echo -ne "\033[2t" into an xterm;)
> >
> > Anyway, how can i type control sequences into an xterm
> > without the cursor moving? When i press ESC, it gets
> > intercepted by the shell. ESC-[ doesn't work either.
> >
> > Is there a way to echo a string from one xterm into
> > another xterm?
> 
> I don't understand the problem you're having.  You demonstrate how to
> generate output sequences containing ESC (using echo), then ask how to
> input control sequences.  Are you attempting to generate the VT220
> "uparrow" keystroke manually?  If so, you are going to have a hard time
> doing so by typing ESC [ A, because of the software layering.
> Here's how VTxx emulation works with xterm:
> You press a key (let's use Up as an example).
> The keyboard sends a scancode to the motherboard keyboard controller.
> The kernel processes the data, then sends the scancode to the X server.
> The X server converts the scancode to a KeyPress event, which says "the
>    key labelled 'Up' was pressed at time 391517935".  It sends this event
>    to the xterm process.
> XTerm looks for 'Up' in its internal tables, and converts it to a
>    string; in this case, three bytes, ESC [ A.
> XTerm sends these three bytes down the pseudo-tty; the kernel
>    thinks it over, and delivers these three bytes to a process (such
>    as bash, or vim, or cat).
> An app such as vim or bash does its own echoing, so nothing is printed
>    back to the pty by the system (because the echo* tty settings are
>    turned off; run "stty" and read its man page).
> The application interprets the bytes however it wants, and perhaps
>    prints something back to the xterm.  The output might consist of the
>    same bytes ESC [ A, in which case xterm would move the cursor up one
>    line.
> If you run cat, it does not place the pty in raw mode, and so the kernel
>    takes care of handling echo and control characters for the app.
>    Since ptys in linux default to echoctl, the kernel generates the four
>    bytes ^ [ [ A, and sends them back down the pty to xterm, which
>    displays them.  If you do "stty -echoctl; cat" the kernel will echo
>    back an up-arrow as three bytes ESC [ A, and xterm will move the
>    cursor.
> 
> (Glossary: tty is teletype, the generic term for a port via which an
> application might talk to a user.  pty is pseudo tty, a fake tty which
> is used by apps like xterm which want to fool other apps into thinking
> they're talking to a user.

I found i can send the output from one xterm into another.
Open two xterms. One will be /dev/pts/0, and the other /dev/pts/1.
In the first xterm, type: echo -n "^[[10;20H". ^[ is a literal ESC.
Can try also: echo -ne "\033[10;20H"
This will move the cursor. Now type: echo -n "^[[10;20H" >/dev/pts/1
This will move the cursor in the second xterm window. I've been
doing this to try out various cursor movement sequences.

I kind of figured out that:
  The scancode is converted to a symbolic code in
/etc/X11/xkb/keycodes/xfree86. For the up arrow cursor key,
the scancode is 98:

<UP>= 98

The symbolic name is converted to a logical key name in
/etc/X11/xkb/symbols/us

key <UP> { [ Up      ] };

Now i'd guess that the keyboard driver whatever that is in
XF86Config-4:

Section "InputDevice"
...
  Driver "keyboard"
Endsection

takes the logical key presses such as Up and converts that to
the terminal command: cuu. This is defined as cuu=\E[A in
terminfo for xterm.

Pressing ctrl-v then up arrow shows the sequence: ^[[A.
Typing "od" or "cat -" makes the terminal show the sequences
for std input too.

http://www.charvolant.org/~doug/xkb/html/xkb.html
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to