View Single Post
Old 11-10-2012, 06:16 AM   #29
choff
Member
choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.choff walks where angels fear to fly.
 
Posts: 12
Karma: 152738
Join Date: Jul 2010
Device: Kindle DXG
Hello,

I just e-mailed with Pepijn and he said that he would take it on from here.

Just some thoughts of mine on what remains to be done, in case someone else also wants to start working on this:

The major part of the work required is probably to convert the output of /dev/input/event* to ASCII, for further processing by the insertKeystroke property.

I already did some searches on that, and it seems like this is not going to be an easy thing.

First of all, what is read from /dev/input/event* is a "struct input_event". This struct contains various members, among them the actual keycode of the key that was pressed/released.

The challenge is then to convert that keyboard-layout dependent keycode into ASCII. In order to accomplish this, you will need to construct a mapping table from keycode to ASCII.

Unfortunately the layout of the mapping table depends on your keyboard layout.

So, for a generic application, you will need to also implement support for the various keyboard layouts. Normally keyboard layouts are handled by your GUI frontend, e.g. by the X11-Server or an embedded toolkit, such as QT embedded.

Unfortunately, on the Kindle, there is no such frontend installed. Thus, you will have to take of the keyboard support for yourself.

I already did some searches and to see if there are some apps that can be used as a string point and it seems like there are several that can be used as a starting point:
  • evtest - http://cgit.freedesktop.org/evtest/

    Very basic, no support for keyboard layouts or anything. But maybe a good strating point.
  • QT for embedded Linux - http://qt-project.org/

    Since version 4.6, QT embedded has decent USB keyboard support. Multiple keyboard layouts are also supported.

    Documentation is here: http://doc.qt.nokia.com/4.7/qt-embedded-charinput.html.

    For a decent, generic solution, one should probably create a standalone application from the relevant parts of the QT framework.

    Some files that might be of interest(all located in src/gui/embedded in the QT source tree):

    * qkbdlinuxinput_qws.cpp: Contains the low-level part of USB keyboard support
    * qkbd_qws.cpp: Handles the keycode->ASCII mapping and supports multiple keyboard layouts
    * qkbddriverfactory_qws.cpp: Factory class for USB keyboards

Regarding the time required to code that application, I think it varies on the level of complexity of your solution.

In one day, you can probably code a simple app without support for multiple keyboard layouts.

In one week, one can make a full-fledged application with keyboard layout support, custom actions for the function keys(F1-F12) etc.

If you are heading for a simple app, you would probably fork from evtest. If you want something more complex, you can use QT Embedded as a starting point.

Hope this helps!

Regards,

Chris
choff is offline   Reply With Quote