KDGKBENT and unicode



Dear linux-kernel,

I am trying to read keyboard in raw mode (K_MEDIUMRAW, to be exact). I hope to avoid reading all the keymaps from the kernel to the application for keycode translation. Therefore I call KDGKBENT ioctl for every keycode I get from the tty. Basically this works except, when the translation result is an unicode keysym or should I say the unicode value happens to be greater than 0xFF, I get K_HOLE.

This observation seems to be in harmony with the drivers/char/vt_ioctl.c code. There I learned that, if I had the keyboard in the K_UNICODE mode, I could get directly the 16 bit unicode values.

So I have two options:

1) Read the keymaps in K_UNICODE mode and do the translations myself while in K_MEDIUMRAW mode

2) For each keycode switch to K_UNICODE mode, ask the translation from kernel, switch back to K_MEDIUMRAW mode and read the next keycode (the continuous switching might have severe side effects).

The question is am I correct so far or am I miserably confused? Aren't there any smarter ways to do the translation?

The next question probably must be how do I handle CAPS with kernel keymaps? As the CAPS sensitivity is encoded in the type field of keysym value, it is lost when the value is 16 bit unicode. I am seeing this phenomenon in ordinary VT when I manage to load some keysyms as 16 bit unicode.

--

Timo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [ANN] Ruby Hacking Guide - New chapters (and a bonus)
    ... Here they are, translations of chapter 3, 4 and 6 of the Ruby Hacking Guide! ... We know the translation is far from being perfect, ... Perl is Ruby's big brother ... What are your complaints towards Unicode? ...
    (comp.lang.ruby)
  • Re: Documentation of kernel messages (Summary)
    ... suggested solutions for documentation / translation of kernel messages ... the messages should _be_ documentation. ... Use printk format string as message identifier ...
    (Linux-Kernel)
  • Re: [Lf_kernel_messages] Re: Documentation of kernel messages (Summary)
    ... The idea that was tossed about was essentially printk hashes (hashed ... that will be a major pain for whoever wants to do the translation --- ... but sometimes kernel developers *like* cute messages. ...
    (Linux-Kernel)
  • Documentation of kernel messages (Summary)
    ... suggested solutions for documentation / translation of kernel messages ... to the corresponding documentation / translation. ... Use printk format string as message identifier ...
    (Linux-Kernel)
  • Re: [Patch] Support UTF-8 scripts
    ... It will be the first POSIX kernel to correctly support utf-8 scripts. ... Not surprisingly the Unicode Consortium is one of them. ... There is no problem arising from the patch, ... No pure ASCII file will be marked, since a marked file will be no ...
    (Linux-Kernel)