[Top][All Lists]

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

about keycodes

From: chinlu chinawa
Subject: about keycodes
Date: Tue, 29 May 2007 12:01:39 +0100 (BST)


I've been trying to find out how does curses do so the
keystroke-getting mechanism bypasses endianness
I hardly tried to setup qemu with some big-endian
linux on it so I could test this, but it's been
completely impossible.

I started then by kgetch, which uses a `struct tries'
which is the one that actually contains each keycode. 

Data for this structure seems to come from the
respective terminal description, which is filled by
newterm through _nc_init_keytries

By tracing a test case, I can get to see this:

char 0 = 033
char 1 = 'O' = 0117
char 2 = 'D' = 0104
char 3 = 000
char 4 = 000
char 5 = 000
char 6 = 000
char 7 = 000
char 8 = 000
char 9 = 000
peeking at 2
ch: 'D' = 0104
ptr=0x808e940, ch=68, value=260
end of sequence
wgetch returning : 'KEY_LEFT' = 0404

I've been trying to make some sense out of this, for
example perhaps values on the fifo were summed, and/or
then (un)mettaed ((x) & (~0x80)), or (un)controlled as
keycodes seem to start over 256 decimal (MIN_KEY 0401)
have tried different things, though I don't seem to
get how it "magically" knows the keypress was

I've also been trying to trace the _keytry pointer,
but I don't seem to push the right bits, even when I
can see there is a function which traces it, neither
could access to it by hand via the SCREEN pointer
given by newterm, due to that data being private.


Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]