From: Neil Brown <neilb@cse.unsw.edu.au>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Input issues - key down with no key up
Date: Fri, 15 Aug 2003 15:16:18 +1000 [thread overview]
Message-ID: <16188.27810.50931.158166@gargle.gargle.HOWL> (raw)
Hi,
I have a notebook (Dell Latitude D800) which has some keys (actual
fn+something combinations) that generate Down events but no Up events
(clever, isn't it).
This makes those keys unusable with 2.6.0 as it is because the input
layer insists on there being up events. Once it sees a down, it will
ignore any future down events until it sees an up event. It will
also auto-repeat the key until some other key is pressed. On the
whole, not very useful for these keys.
After some thought, the simplest way I could think of to fix it was
to have a bitmap of keys that don't generate up events themselves.
For these keys the auto-repeat code can then generate an "UP" event
(val==0) instead of a "repeat" event (val==2) after the timeout.
The following patch does that and I can now use those keys (after
using the relevant ioctl to associate the scan code with a keycode).
This may not be the best way to do it, and I am happy to discuss
other approaches, including different ioctls for getting the new
status bits into and out-of the kernel.
NeilBrown
----------- Diffstat output ------------
./drivers/input/evdev.c | 13 +++++++++++++
./drivers/input/input.c | 7 +++++--
./include/linux/input.h | 3 +++
3 files changed, 21 insertions(+), 2 deletions(-)
diff ./drivers/input/evdev.c~current~ ./drivers/input/evdev.c
--- ./drivers/input/evdev.c~current~ 2003-08-15 13:44:46.000000000 +1000
+++ ./drivers/input/evdev.c 2003-08-15 14:48:52.000000000 +1000
@@ -246,9 +246,21 @@ static int evdev_ioctl(struct inode *ino
if(INPUT_KEYCODE(dev, t) == u) break;
if (i == dev->keycodemax) clear_bit(u, dev->keybit);
set_bit(INPUT_KEYCODE(dev, t), dev->keybit);
+ clear_bit(INPUT_KEYCODE(dev, t), dev->key);
return 0;
+ case EVIOCSKEYNOUP:
+ if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
+ if (t < 0 || t > dev->keycodemax) return -EINVAL;
+ if (get_user(u, ((int *) arg) + 1)) return -EFAULT;
+ if (u & ~1) return -EINVAL;
+ if (u)
+ set_bit(t, dev->keynoup);
+ else
+ clear_bit(t, dev->keynoup);
+ return 0;
+
case EVIOCSFF:
if (dev->upload_effect) {
struct ff_effect effect;
@@ -303,6 +315,7 @@ static int evdev_ioctl(struct inode *ino
switch (_IOC_NR(cmd) & EV_MAX) {
case 0: bits = dev->evbit; len = EV_MAX; break;
case EV_KEY: bits = dev->keybit; len = KEY_MAX; break;
+ case EV_REP: bits = dev->keynoup; len = KEY_MAX; break;
case EV_REL: bits = dev->relbit; len = REL_MAX; break;
case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;
case EV_LED: bits = dev->ledbit; len = LED_MAX; break;
diff ./drivers/input/input.c~current~ ./drivers/input/input.c
--- ./drivers/input/input.c~current~ 2003-08-15 13:44:46.000000000 +1000
+++ ./drivers/input/input.c 2003-08-15 13:44:46.000000000 +1000
@@ -191,8 +191,11 @@ static void input_repeat_key(unsigned lo
if (!test_bit(dev->repeat_key, dev->key))
return;
-
- input_event(dev, EV_KEY, dev->repeat_key, 2);
+ if (test_bit(dev->repeat_key, dev->keynoup))
+ /* don't auto-repeat, just auto-up */
+ input_event(dev, EV_KEY, dev->repeat_key, 0);
+ else
+ input_event(dev, EV_KEY, dev->repeat_key, 2);
input_sync(dev);
mod_timer(&dev->timer, jiffies + dev->rep[REP_PERIOD]);
diff ./include/linux/input.h~current~ ./include/linux/input.h
--- ./include/linux/input.h~current~ 2003-08-15 12:16:16.000000000 +1000
+++ ./include/linux/input.h 2003-08-15 13:44:46.000000000 +1000
@@ -60,6 +60,7 @@ struct input_absinfo {
#define EVIOCSREP _IOW('E', 0x03, int[2]) /* get repeat settings */
#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */
#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */
+#define EVIOCSKEYNOUP _IOW('E', 0x05, int[2]) /* set 'no-repeat' bit */
#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
@@ -790,6 +791,8 @@ struct input_dev {
int abs[ABS_MAX + 1];
int rep[REP_MAX + 1];
+ unsigned long keynoup[NBITS(KEY_MAX)]; /* set if key doesn't generate up event */
+
unsigned long key[NBITS(KEY_MAX)];
unsigned long led[NBITS(LED_MAX)];
unsigned long snd[NBITS(SND_MAX)];
next reply other threads:[~2003-08-15 5:16 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-15 5:16 Neil Brown [this message]
2003-08-15 7:46 ` Input issues - key down with no key up Andries Brouwer
2003-08-15 10:58 ` Vojtech Pavlik
2003-08-15 12:36 ` Andries Brouwer
2003-08-15 12:43 ` Vojtech Pavlik
2003-08-15 13:27 ` Jamie Lokier
2003-08-15 13:52 ` Vojtech Pavlik
2003-08-15 14:02 ` Jamie Lokier
2003-08-15 15:05 ` Jason Lunz
2003-08-15 13:04 ` Jamie Lokier
2003-08-15 13:10 ` Vojtech Pavlik
2003-08-15 13:33 ` Jamie Lokier
2003-08-15 13:53 ` Vojtech Pavlik
2003-08-16 13:02 ` Maciej W. Rozycki
2003-08-16 14:09 ` Jamie Lokier
2003-08-17 21:54 ` Vojtech Pavlik
2003-08-18 12:22 ` Maciej W. Rozycki
2003-08-18 10:29 ` Andries Brouwer
2003-08-19 13:04 ` Maciej W. Rozycki
2003-08-19 17:48 ` Andries Brouwer
2003-08-21 11:37 ` Maciej W. Rozycki
2003-08-21 12:44 ` Andries Brouwer
2003-08-21 13:45 ` Maciej W. Rozycki
2003-08-21 14:28 ` Andries Brouwer
2003-08-21 14:38 ` Maciej W. Rozycki
2003-08-21 13:48 ` Jamie Lokier
2003-08-21 14:08 ` Maciej W. Rozycki
2003-08-21 14:14 ` Vojtech Pavlik
2003-08-21 14:33 ` Maciej W. Rozycki
2003-08-21 14:44 ` Andries Brouwer
2003-08-21 15:03 ` Maciej W. Rozycki
2003-08-21 15:29 ` Vojtech Pavlik
2003-08-16 13:01 ` Maciej W. Rozycki
2003-08-15 12:46 ` Neil Brown
2003-08-15 12:54 ` Vojtech Pavlik
2003-08-15 13:52 ` Andries Brouwer
2003-08-15 14:13 ` Vojtech Pavlik
2003-08-16 7:57 ` Neil Brown
2003-08-18 16:01 ` Vojtech Pavlik
2003-08-19 11:40 ` Neil Brown
2003-08-19 11:50 ` Vojtech Pavlik
2003-08-19 23:59 ` Neil Brown
2003-08-20 22:36 ` Andries Brouwer
2003-08-20 22:58 ` Jamie Lokier
2003-08-20 23:52 ` Andries Brouwer
2003-08-21 0:03 ` Jamie Lokier
2003-08-21 0:33 ` Andries Brouwer
2003-08-21 1:36 ` Jamie Lokier
2003-08-21 8:08 ` Vojtech Pavlik
2003-08-21 8:06 ` Vojtech Pavlik
2003-08-21 11:40 ` Maciej W. Rozycki
2003-08-21 12:48 ` Andries Brouwer
2003-08-21 13:22 ` Jamie Lokier
2003-08-21 13:29 ` Maciej W. Rozycki
2003-08-21 8:01 ` Vojtech Pavlik
2003-08-22 0:27 ` Andries Brouwer
2003-08-22 7:33 ` Vojtech Pavlik
2003-08-25 4:22 ` Jamie Lokier
2003-08-25 8:22 ` Vojtech Pavlik
2003-08-25 19:36 ` Jamie Lokier
2003-09-03 8:06 ` Pavel Machek
2003-08-22 13:35 ` Maciej W. Rozycki
-- strict thread matches above, loose matches on Subject: below --
2003-08-16 15:15 John Bradford
2003-08-18 11:53 ` Maciej W. Rozycki
2003-08-19 19:37 John Bradford
2003-08-19 23:58 ` Jamie Lokier
2003-08-20 5:59 John Bradford
2003-08-20 15:17 ` Jamie Lokier
2003-08-21 12:11 John Bradford
2003-08-21 12:26 ` Vojtech Pavlik
2003-08-23 12:30 Norman Diamond
2003-08-25 4:24 ` Jamie Lokier
2003-08-25 12:15 ` Norman Diamond
2003-08-25 8:45 John Bradford
2003-08-25 12:47 John Bradford
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=16188.27810.50931.158166@gargle.gargle.HOWL \
--to=neilb@cse.unsw.edu.au \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.