From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>,
linux-kernel@vger.kernel.org, Vojtech Pavlik <vojtech@suse.cz>
Subject: [New-PATCH] lkkbd: Current version
Date: Wed, 21 Apr 2004 14:40:08 +0200 [thread overview]
Message-ID: <20040421124008.GC12700@lug-owl.de> (raw)
In-Reply-To: <20040421113947.GA12700@lug-owl.de>
[-- Attachment #1: Type: text/plain, Size: 10213 bytes --]
On Wed, 2004-04-21 13:39:47 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de>
wrote in message <20040421113947.GA12700@lug-owl.de>:
> On Wed, 2004-04-21 00:52:25 -0500, Dmitry Torokhov <dtor_core@ameritech.net>
> wrote in message <200404210052.28755.dtor_core@ameritech.net>:
> > diff -Nru a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c
> > --- a/drivers/input/keyboard/lkkbd.c Tue Apr 20 23:00:57 2004
> > +++ b/drivers/input/keyboard/lkkbd.c Tue Apr 20 23:00:57 2004
> > @@ -12,7 +12,7 @@
> > * adaptor).
> > *
> > * DISCLAUNER: This works for _me_. If you break anything by using the
> ^--- If you had only caught this one :)
>
> I'll take this patch into my tree, too.
Here we are. Linus, please apply this patch. It incorporated Dmitry's
changes and also updates the lkkbd driver to it's current version (which
I use on my Athlon).
#
# This patch updates the lkkbd driver to it's current version.
# It also incorporates two patches suggested on LKML (fixing
# some leading whitespace and an unneccessary check).
#
Index: linux-2.6.6-rc2/drivers/input/keyboard/lkkbd.c
===================================================================
--- linux-2.6.6-rc2.orig/drivers/input/keyboard/lkkbd.c 2004-04-04 05:36:25.000000000 +0200
+++ linux-2.6.6-rc2/drivers/input/keyboard/lkkbd.c 2004-04-21 14:33:59.000000000 +0200
@@ -11,8 +11,8 @@
* and VAXstations, but can also be used on any standard RS232 with an
* adaptor).
*
- * DISCLAUNER: This works for _me_. If you break anything by using the
- * information given below, I will _not_ be lieable!
+ * DISCLAIMER: This works for _me_. If you break anything by using the
+ * information given below, I will _not_ be liable!
*
* RJ11 pinout: To DB9: Or DB25:
* 1 - RxD <----> Pin 3 (TxD) <-> Pin 2 (TxD)
@@ -34,23 +34,32 @@
* Additionally, you have to get +12V from somewhere.
* Most easily, you'll get that from a floppy or HDD power connector.
* It's the yellow cable there (black is ground and red is +5V).
+ *
+ * The keyboard and all the commands it understands are documented in
+ * "VCB02 Video Subsystem - Technical Manual", EK-104AA-TM-001. This
+ * document is LK201 specific, but LK401 is mostly compatible. It comes
+ * up in LK201 mode and doesn't report any of the additional keys it
+ * has. These need to be switched on with the LK_CMD_ENABLE_LK401
+ * command. You'll find this document (scanned .pdf file) on MANX,
+ * a search engine specific to DEC documentation. Try
+ * http://www.vt100.net/manx/details?pn=EK-104AA-TM-001;id=21;cp=1
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
* Should you need to contact me, the author, you can do so either by
* email or by paper mail:
* Jan-Benedict Glaw, Lilienstraße 16, 33790 Hörste (near Halle/Westf.),
@@ -67,8 +76,7 @@
#include <linux/serio.h>
#include <linux/workqueue.h>
-
-MODULE_AUTHOR ("Jan-Benedict Glaw <jblaw@lug-owl.de>");
+MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
MODULE_DESCRIPTION ("LK keyboard driver");
MODULE_LICENSE ("GPL");
@@ -92,6 +100,11 @@
module_param (ctrlclick_volume, int, 0);
MODULE_PARM_DESC (ctrlclick_volume, "Ctrlclick volume (in %), default is 100%");
+static int lk201_compose_is_alt = 0;
+module_param (lk201_compose_is_alt, int, 0);
+MODULE_PARM_DESC (lk201_compose_is_alt, "If set non-zero, LK201' Compose key "
+ "will act as an Alt key");
+
#undef LKKBD_DEBUG
@@ -126,8 +139,11 @@
#define LK_CMD_SET_DEFAULTS 0xd3
#define LK_CMD_POWERCYCLE_RESET 0xfd
#define LK_CMD_ENABLE_LK401 0xe9
+#define LK_CMD_REQUEST_ID 0xab
/* Misc responses from keyboard */
+#define LK_STUCK_KEY 0x3d
+#define LK_SELFTEST_FAILED 0x3e
#define LK_ALL_KEYS_UP 0xb3
#define LK_METRONOME 0xb4
#define LK_OUTPUT_ERROR 0xb5
@@ -139,6 +155,7 @@
#define LK_RESPONSE_RESERVED 0xbb
#define LK_NUM_KEYCODES 256
+#define LK_NUM_IGNORE_BYTES 6
typedef u_int16_t lk_keycode_t;
@@ -267,6 +284,7 @@
struct lkkbd {
lk_keycode_t keycode[LK_NUM_KEYCODES];
int ignore_bytes;
+ unsigned char id[LK_NUM_IGNORE_BYTES];
struct input_dev dev;
struct serio *serio;
struct work_struct tq;
@@ -313,6 +331,82 @@
return ret;
}
+static void
+lkkbd_detection_done (struct lkkbd *lk)
+{
+ int i;
+
+ /*
+ * Reset setting for Compose key. Let Compose be KEY_COMPOSE.
+ */
+ lk->keycode[0xb1] = KEY_COMPOSE;
+
+ /*
+ * Print keyboard name and modify Compose=Alt on user's request.
+ */
+ switch (lk->id[4]) {
+ case 1:
+ sprintf (lk->name, "DEC LK201 keyboard");
+
+ if (lk201_compose_is_alt)
+ lk->keycode[0xb1] = KEY_LEFTALT;
+ break;
+
+ case 2:
+ sprintf (lk->name, "DEC LK401 keyboard");
+ break;
+
+ default:
+ sprintf (lk->name, "Unknown DEC keyboard");
+ printk (KERN_ERR "lkkbd: keyboard on %s is unknown, "
+ "please report to Jan-Benedict Glaw "
+ "<jbglaw@lug-owl.de>\n", lk->phys);
+ printk (KERN_ERR "lkkbd: keyboard ID'ed as:");
+ for (i = 0; i < LK_NUM_IGNORE_BYTES; i++)
+ printk (" 0x%02x", lk->id[i]);
+ printk ("\n");
+ break;
+ }
+ printk (KERN_INFO "lkkbd: keyboard on %s identified as: %s\n",
+ lk->phys, lk->name);
+
+ /*
+ * Report errors during keyboard boot-up.
+ */
+ switch (lk->id[2]) {
+ case 0x00:
+ /* All okay */
+ break;
+
+ case LK_STUCK_KEY:
+ printk (KERN_ERR "lkkbd: Stuck key on keyboard at "
+ "%s\n", lk->phys);
+ break;
+
+ case LK_SELFTEST_FAILED:
+ printk (KERN_ERR "lkkbd: Selftest failed on keyboard "
+ "at %s, keyboard may not work "
+ "properly\n", lk->phys);
+ break;
+
+ default:
+ printk (KERN_ERR "lkkbd: Unknown error %02x on "
+ "keyboard at %s\n", lk->id[2],
+ lk->phys);
+ break;
+ }
+
+ /*
+ * Try to hint user if there's a stuck key.
+ */
+ if (lk->id[2] == LK_STUCK_KEY && lk->id[3] != 0)
+ printk (KERN_ERR "Scancode of stuck key is 0x%02x, keycode "
+ "is 0x%04x\n", lk->id[3],
+ lk->keycode[lk->id[3]]);
+
+ return;
+}
+
/*
* lkkbd_interrupt() is called by the low level driver when a character
* is received.
@@ -329,7 +423,11 @@
if (lk->ignore_bytes > 0) {
DBG (KERN_INFO "Ignoring a byte on %s\n",
lk->name);
- lk->ignore_bytes--;
+ lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
+
+ if (lk->ignore_bytes == 0)
+ lkkbd_detection_done (lk);
+
return IRQ_HANDLED;
}
@@ -375,7 +473,8 @@
break;
case 0x01:
DBG (KERN_INFO "Got 0x01, scheduling re-initialization\n");
- lk->ignore_bytes = 3;
+ lk->ignore_bytes = LK_NUM_IGNORE_BYTES;
+ lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
schedule_work (&lk->tq);
break;
@@ -389,7 +488,7 @@
input_sync (&lk->dev);
} else
printk (KERN_WARNING "%s: Unknown key with "
- "scancode %02x on %s.\n",
+ "scancode 0x%02x on %s.\n",
__FILE__, data, lk->name);
}
@@ -467,6 +566,9 @@
unsigned char leds_on = 0;
unsigned char leds_off = 0;
+ /* Ask for ID */
+ lk->serio->write (lk->serio, LK_CMD_REQUEST_ID);
+
/* Reset parameters */
lk->serio->write (lk->serio, LK_CMD_SET_DEFAULTS);
@@ -527,9 +629,7 @@
if ((serio->type & SERIO_TYPE) != SERIO_RS232)
return;
- if (!(serio->type & SERIO_PROTO))
- return;
- if ((serio->type & SERIO_PROTO) && (serio->type & SERIO_PROTO) != SERIO_LKKBD)
+ if ((serio->type & SERIO_PROTO) != SERIO_LKKBD)
return;
if (!(lk = kmalloc (sizeof (struct lkkbd), GFP_KERNEL)))
@@ -537,10 +637,16 @@
memset (lk, 0, sizeof (struct lkkbd));
init_input_dev (&lk->dev);
-
- lk->dev.evbit[0] = BIT (EV_KEY) | BIT (EV_LED) | BIT (EV_SND) | BIT (EV_REP);
- lk->dev.ledbit[0] = BIT (LED_CAPSL) | BIT (LED_COMPOSE) | BIT (LED_SCROLLL) | BIT (LED_SLEEP);
- lk->dev.sndbit[0] = BIT (SND_CLICK) | BIT (SND_BELL);
+ set_bit (EV_KEY, lk->dev.evbit);
+ set_bit (EV_LED, lk->dev.evbit);
+ set_bit (EV_SND, lk->dev.evbit);
+ set_bit (EV_REP, lk->dev.evbit);
+ set_bit (LED_CAPSL, lk->dev.ledbit);
+ set_bit (LED_SLEEP, lk->dev.ledbit);
+ set_bit (LED_COMPOSE, lk->dev.ledbit);
+ set_bit (LED_SCROLLL, lk->dev.ledbit);
+ set_bit (SND_BELL, lk->dev.sndbit);
+ set_bit (SND_CLICK, lk->dev.sndbit);
lk->serio = serio;
@@ -564,14 +670,13 @@
return;
}
- sprintf (lk->name, "LK keyboard");
+ sprintf (lk->name, "DEC LK keyboard");
+ sprintf (lk->phys, "%s/input0", serio->phys);
memcpy (lk->keycode, lkkbd_keycode, sizeof (lk_keycode_t) * LK_NUM_KEYCODES);
for (i = 0; i < LK_NUM_KEYCODES; i++)
set_bit (lk->keycode[i], lk->dev.keybit);
- sprintf (lk->name, "%s/input0", serio->phys);
-
lk->dev.name = lk->name;
lk->dev.phys = lk->phys;
lk->dev.id.bustype = BUS_RS232;
@@ -599,9 +704,9 @@
}
static struct serio_dev lkkbd_dev = {
- .interrupt = lkkbd_interrupt,
.connect = lkkbd_connect,
.disconnect = lkkbd_disconnect,
+ .interrupt = lkkbd_interrupt,
};
/*
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak!
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-04-21 12:41 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-21 5:49 [PATCH 0/15] New set of input patches Dmitry Torokhov
2004-04-21 5:50 ` [PATCH 1/15] New set of input patches: synaptics cleanup Dmitry Torokhov
2004-04-21 5:51 ` [PATCH 2/15] New set of input patches: synaptics middle button support Dmitry Torokhov
2004-04-21 5:51 ` [PATCH 3/15] New set of input patches: dont change max proto Dmitry Torokhov
2004-04-21 5:52 ` [PATCH 4/15] New set of input patches: lkkbd whitespace Dmitry Torokhov
2004-04-21 11:39 ` Jan-Benedict Glaw
2004-04-21 12:40 ` Jan-Benedict Glaw [this message]
2004-04-22 7:27 ` Vojtech Pavlik
2004-04-21 5:53 ` [PATCH 5/15] New set of input patches: lkkbd simplify checks Dmitry Torokhov
2004-04-21 11:34 ` Jan-Benedict Glaw
2004-04-21 5:54 ` [PATCH 6/15] New set of input patches: atkbd soften accusation Dmitry Torokhov
2004-04-21 14:13 ` Giuseppe Bilotta
2004-04-21 5:56 ` [PATCH 7/15] New set of input patches: atkbd trailing whitespace Dmitry Torokhov
2004-04-21 5:57 ` [PATCH 8/15] New set of input patches: atkbd - use bitfields Dmitry Torokhov
2004-04-22 7:31 ` Vojtech Pavlik
2004-04-22 7:41 ` Dmitry Torokhov
2004-04-22 7:58 ` Vojtech Pavlik
2004-04-25 6:25 ` Pavel Machek
2004-04-21 5:58 ` [PATCH 9/15] New set of input patches: atkbd timeout complaints Dmitry Torokhov
2004-04-22 7:32 ` Vojtech Pavlik
2004-04-22 7:43 ` Dmitry Torokhov
2004-04-21 6:00 ` [PATCH 10/15] New set of input patches: psmouse rescan on hotplug Dmitry Torokhov
2004-04-21 6:01 ` [PATCH 11/15] New set of input patches: psmouse reconnect after error Dmitry Torokhov
2004-04-21 6:01 ` [PATCH 12/15] New set of input patches: psmouse add protocol_handler Dmitry Torokhov
2004-04-21 6:02 ` [PATCH 13/15] New set of input patches: psmouse sliced commands Dmitry Torokhov
2004-04-21 6:04 ` [PATCH 14/15] New set of input patches: atkbd reconnect probe Dmitry Torokhov
2004-04-21 6:05 ` [PATCH 15/15] New set of input patches: allow disabling psaux Dmitry Torokhov
2004-04-21 12:43 ` [PATCH 0/15] New set of input patches Jan-Benedict Glaw
2004-04-22 6:43 ` [PATCH 16/15] New set of input patches: serio whitespace Dmitry Torokhov
2004-04-22 6:56 ` [PATCH 17/15] New set of input patches: serio open/close optional Dmitry Torokhov
2004-04-22 7:29 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040421124008.GC12700@lug-owl.de \
--to=jbglaw@lug-owl.de \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=vojtech@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox