linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@cse.unsw.edu.au>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: Andries Brouwer <aebr@win.tue.nl>, linux-kernel@vger.kernel.org
Subject: Re: Input issues - key down with no key up
Date: Fri, 15 Aug 2003 22:46:07 +1000	[thread overview]
Message-ID: <16188.54799.675256.608570@gargle.gargle.HOWL> (raw)
In-Reply-To: message from Vojtech Pavlik on Friday August 15

On Friday August 15, vojtech@suse.cz wrote:
> 
> My proposed solution is to do an input_report_key(pressed) immediately
> followed by input_report_key(released) for these keys straight in
> atkbd.c. Possibly based on some flag in the scancode->keycode table for
> that scancode.

Something like this?

I use bit 32 in the keycode setting to mean "don't expect an 'up'
event".
It seems to work (though some of the keys actually generate 'down'
events for both the down and up transitions, so it seems that the key
is pressed twice.  I'm happy that that is just a buggy keyboard and I
can work around it).

NeilBrown


 ----------- Diffstat output ------------
 ./drivers/input/evdev.c          |   13 ++++++++++---
 ./drivers/input/keyboard/atkbd.c |    7 +++++++
 ./include/linux/input.h          |    1 +
 3 files changed, 18 insertions(+), 3 deletions(-)

diff ./drivers/input/evdev.c~current~ ./drivers/input/evdev.c
--- ./drivers/input/evdev.c~current~	2003-08-15 21:31:47.000000000 +1000
+++ ./drivers/input/evdev.c	2003-08-15 21:35:00.000000000 +1000
@@ -233,15 +233,22 @@ static int evdev_ioctl(struct inode *ino
 		case EVIOCGKEYCODE:
 			if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
 			if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
-			if (put_user(INPUT_KEYCODE(dev, t), ((int *) arg) + 1)) return -EFAULT;
+			u = (dev->keycode_noup && test_bit(t, dev->keycode_noup)) ? (1<<31) : 0;
+			if (put_user(u | INPUT_KEYCODE(dev, t), ((int *) arg) + 1)) return -EFAULT;
 			return 0;
 
 		case EVIOCSKEYCODE:
 			if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
 			if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
 			u = INPUT_KEYCODE(dev, t);
-			if (get_user(INPUT_KEYCODE(dev, t), ((int *) arg) + 1)) return -EFAULT;
-
+			if (get_user(i, ((int *) arg) + 1)) return -EFAULT;
+			INPUT_KEYCODE(dev, t) = i;
+			if (dev->keycode_noup) {
+				if (i & (1<<31))
+					set_bit(t, dev->keycode_noup);
+				else
+					clear_bit(t, dev->keycode_noup);
+			}
 			for (i = 0; i < dev->keycodemax; i++)
 				if(INPUT_KEYCODE(dev, t) == u) break;
 			if (i == dev->keycodemax) clear_bit(u, dev->keybit);

diff ./drivers/input/keyboard/atkbd.c~current~ ./drivers/input/keyboard/atkbd.c
--- ./drivers/input/keyboard/atkbd.c~current~	2003-08-15 21:35:00.000000000 +1000
+++ ./drivers/input/keyboard/atkbd.c	2003-08-15 22:12:50.000000000 +1000
@@ -112,6 +112,7 @@ static unsigned char atkbd_set3_keycode[
 
 struct atkbd {
 	unsigned char keycode[512];
+	unsigned long keycode_noup[NBITS(512)];
 	struct input_dev dev;
 	struct serio *serio;
 	char name[64];
@@ -198,6 +199,10 @@ static irqreturn_t atkbd_interrupt(struc
 			input_regs(&atkbd->dev, regs);
 			input_report_key(&atkbd->dev, atkbd->keycode[code], !atkbd->release);
 			input_sync(&atkbd->dev);
+			if (!atkbd->release && test_bit(code, atkbd->keycode_noup)) {
+				input_report_key(&atkbd->dev, atkbd->keycode[code], 0);
+				input_sync(&atkbd->dev);
+			}
 	}
 
 	atkbd->release = 0;
@@ -512,6 +517,7 @@ static void atkbd_connect(struct serio *
 	atkbd->dev.keycode = atkbd->keycode;
 	atkbd->dev.keycodesize = sizeof(unsigned char);
 	atkbd->dev.keycodemax = ARRAY_SIZE(atkbd_set2_keycode);
+	atkbd->dev.keycode_noup = atkbd->keycode_noup;
 	atkbd->dev.event = atkbd_event;
 	atkbd->dev.private = atkbd;
 
@@ -549,6 +555,7 @@ static void atkbd_connect(struct serio *
 		memcpy(atkbd->keycode, atkbd_set3_keycode, sizeof(atkbd->keycode));
 	else
 		memcpy(atkbd->keycode, atkbd_set2_keycode, sizeof(atkbd->keycode));
+	memset(atkbd->keycode_noup, 0, sizeof(atkbd->keycode_noup));
 
 	atkbd->dev.name = atkbd->name;
 	atkbd->dev.phys = atkbd->phys;

diff ./include/linux/input.h~current~ ./include/linux/input.h
--- ./include/linux/input.h~current~	2003-08-15 21:31:47.000000000 +1000
+++ ./include/linux/input.h	2003-08-15 21:35:00.000000000 +1000
@@ -778,6 +778,7 @@ struct input_dev {
 	unsigned int keycodemax;
 	unsigned int keycodesize;
 	void *keycode;
+	unsigned long *keycode_noup;
 
 	unsigned int repeat_key;
 	struct timer_list timer;

  parent reply	other threads:[~2003-08-15 12:46 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-15  5:16 Input issues - key down with no key up Neil Brown
2003-08-15  7:46 ` 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 [this message]
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
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.54799.675256.608570@gargle.gargle.HOWL \
    --to=neilb@cse.unsw.edu.au \
    --cc=aebr@win.tue.nl \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).