[Lcdproc] Keystroke creation in hd44780-lcd2usb

Markus Dolze bsdfan@nurfuerspam.de
Sat Sep 29 20:16:01 2007


Hello,

recently I added input key processing to the hd44780-lcd2usb subdriver.
Yesterday I found that my change has a side effect: I can create three
different keystrokes with only two keys!

Looking at how input is handled by LCDd I found this processing chain
(here for hd44780-winamp):

server/main:do_mainloop
server/input:handle_input
server/drivers:drivers_get_key
server/drivers/hd44780:get_key
server/drivers/hd44780:scankeypad  (<= may be overriden by subdriver)
server/drivers/hd44780-winamp:readkeypad  (<= must be implemented in
subdriver if scankeypad is not changed)

In this example readkeypad() creates a bitmask of the pressed keys. This
bitmask is filtered by scankeypad() so that only one key can be pressed
at a time.

For the lcd2usb subdriver I have overwritten the scankeypad() function
returning the bitmask of the pressed keys without any further filtering.
Therefore I can have three scancodes (only key 1 or key 2 pressed or
both at the same time).

This means that menues can be used with only two keys, if the third
scancode is used as menukey! This is not possible with the winamp or
4bit wiring. As the lcd2usb device is equipped with two keys by default
(more keys could be added if the firmware is changed), I would like to
stay with this (I will add a hint to the documentation).

Does this fit into lcdproc's model of operation?

Regards
Markus Dolze