[E3-hacking] [RFC][PATCH v2 0/5] omap1: Amstrad Delta: add support for external keyboard

Janusz Krzysztofik jkrzyszt at tis.icnet.pl
Mon Mar 29 20:58:02 BST 2010


Monday 29 March 2010 16:19:23 Janusz Krzysztofik napisał(a):
> This series of patches adds support for an external keyboard (called
> mailboard) connected to the Amstrad Delta (E3) videophone.
>
> The series is based on a patch by Matt Callow, created against
> linux-omap-2.6.19[1], initially submitted to the e3-hacking mailing list in
> April 2006[2].
>
> Since the keyboard serial clock line is connected to a GPIO line, it
> generates interrupts every single bit received. In order to handle this
> correctly, the code makes use of a FIQ hardware feature. Since all GPIO
> generated interrupts would be converted to FIQ, the handler must include
> support for all supported GPIO connected devices: the keyboard, a modem and
> a hook switch.
>
> My modifications to the original patch include:
> - split into several patches,
> - refresh against a recent linux version,
> - a lot of cleanups, mainly to get rid of checkpatch reported issues,
> - add support for handling interrupts generated by a GPIO line that the
>   meanwhile activated hook switch hangs off.
> v2 changes:
> - remove scan code to key code mapping from the serio driver, that doesn't
>   belong here and should be set up from userspace;


Hi,

For those of you who would like to do some testing:

You'll need a utility for installing a key table. Given no single hint from 
linux-input team, I ended up using input-kbd, that is part of input-utils 
package, at least on Gentoo and Debian. Other possibilities I know of:
- V4L guys provided linux/Documentation/DocBook/v4l/keytable.c.xml example,
- http://0pointer.de/lennart/projects/keyfuzz/

My input-kbd compatible /etc/mailboard.map for my Delta looks like this:
-------------------------
112 = KEY_ESC
122 = KEY_F1
 70 = KEY_F2
124 = KEY_F3
119 = KEY_F4
114 = KEY_F5
105 = KEY_F6
 26 = KEY_F7
 42 = KEY_F8
 28 = KEY_F9
 21 = KEY_F10
113 = KEY_TAB
116 = KEY_1
115 = KEY_2
107 = KEY_3
 34 = KEY_4
 27 = KEY_5
 29 = KEY_6
 30 = KEY_7
121 = KEY_8
125 = KEY_9
117 = KEY_0
108 = KEY_BACKSPACE
 33 = KEY_Q
 35 = KEY_W
 36 = KEY_E
 38 = KEY_R
 82 = KEY_T
 93 = KEY_Y
 13 = KEY_U
 14 = KEY_I
 50 = KEY_O
 52 = KEY_P
 44 = KEY_ENTER
 49 = KEY_A
 51 = KEY_S
 53 = KEY_D
 54 = KEY_F
 41 = KEY_G
 91 = KEY_H
  3 = KEY_J
118 = KEY_K
 58 = KEY_L
 59 = KEY_BACKSLASH # there is no KEY_AT
 60 = KEY_LEFTSHIFT
 61 = KEY_Z
 78 = KEY_X
 84 = KEY_C
 11 = KEY_V
  5 = KEY_B
 65 = KEY_N
 66 = KEY_M
 67 = KEY_DOT
 62 = KEY_UP
 85 = KEY_RIGHTSHIFT
259 = KEY_LEFTCTRL
  6 = KEY_LEFTALT
 73 = KEY_RIGHTMETA
 75 = KEY_SPACE
 68 = KEY_COMMA
 22 = KEY_LEFT
 46 = KEY_DOWN
  9 = KEY_RIGHT
-------------------------
You may want to adopt it to better suit your taste.

My udev installs it up automatically for me with this simple rule:
-------------------------
ACTION=="add", KERNEL=="event[0-9]*", \ 
	ATTRS{phys}=="GPIO/serio[0-9]*/input[0-9]*", \ 
	RUN+="/usr/bin/input-kbd -f /etc/mailboard.map %n"
-------------------------

If you are using Angstrom (or other OpenEmbedded generated distribution), you 
may want to give my simple recipes/input-utils/input-utils.bb recipe a try:
-------------------------
PV = "20081014-${SRCREV}"
SRCREV = "101501"
SRC_URI = "http://dl.bytesex.org/cvs-snapshots/input-${PV}.tar.gz \
	file://fix-makefiles.patch;patch=1"
LICENSE = "GPL"
inherit autotools
S = "${WORKDIR}/input"
PACKAGES_prepend = "input-kbd input-remote "
FILES_input-kbd = "/usr/bin/input-kbd"
FILES_input-remote = "/usr/bin/input-send /usr/bin/input-recv"
--------------------------

and recipes/input-utils/files/fix-makefiles.patch:
--------------------------
--- input/mk/Variables.mk.orig	2008-10-14 12:27:01.000000000 +0200
+++ input/mk/Variables.mk	2010-03-29 17:11:58.000000000 +0200
@@ -30,7 +30,7 @@ MOC             ?= $(if $(QTDIR),$(QTDIR
 
 STRIP		?= -s
 INSTALL		?= install
-INSTALL_BINARY  := $(INSTALL) $(STRIP)
+INSTALL_BINARY  := $(INSTALL)
 INSTALL_SCRIPT  := $(INSTALL)
 INSTALL_DATA	:= $(INSTALL) -m 644
 INSTALL_DIR	:= $(INSTALL) -d
--------------------------

After putting the above two files in your local OE overlay, building the 
package(s) with "bitbake input-utils" and refreshing your repository Packeges 
list, all you need is running "opkg install input-kbd" on your Delta.

Have fun,
Janusz


>   thanks to Dmitry 
>   Torokhov for advising this,
> - no funtional changes in FIQ part (there were no comments in round 1).
>
> There is still one minor issue that I was not able to deal with: when built
> with CONFIG_OMAP_RESET_CLOCKS=y, the keyboard driver stops working. I have
> no idea how I could find which clock I should enable to get it working
> regardless of boot loader used. Any suggestions?
>
> Created and tested against linux-2.6.34-rc2.
>
> Janusz Krzysztofik(5)
> 	omap1: Amstrad Delta: add FIQ handler for serial keyboard port interrupt
> 			processing
> 	omap1: Amstrad Delta: add a handler for processing interrupts generated by
> 			the FIQ routine
> 	omap1: Amstrad Delta: use FIQ for processing GPIO interrupts
> 	input: serio: add support for Amstrad Delta serial keyboard port
> 	omap1: Amstrad Delta: modify defconfig for external keyboard support
>
>  arch/arm/configs/ams_delta_defconfig             |    2
>  arch/arm/mach-omap1/Kconfig                      |    8
>  arch/arm/mach-omap1/Makefile                     |    3
>  arch/arm/mach-omap1/ams-delta-fiq-handler.S      |  342
> +++++++++++++++++++++++ arch/arm/mach-omap1/ams-delta-fiq.c              | 
> 175 +++++++++++ arch/arm/mach-omap1/board-ams-delta.c            |    6
>  arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |   57 +++
>  arch/arm/plat-omap/include/plat/irqs.h           |    4
>  drivers/input/serio/Kconfig                      |    9
>  drivers/input/serio/Makefile                     |    1
>  drivers/input/serio/ams_delta_keyboard.c         |  171 +++++++++++
>  11 files changed, 777 insertions(+), 1 deletion(-)
>
> Thanks,
> Janusz
>
> [1] http://the.earth.li/pub/e3/2.6.19/ams-delta-keyboard.patch
> [2] http://www.earth.li/pipermail/e3-hacking/2006-April/000453.html





More information about the e3-hacking mailing list