linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Input issues - key down with no key up
@ 2003-08-23 12:30 Norman Diamond
  2003-08-25  4:24 ` Jamie Lokier
  0 siblings, 1 reply; 75+ messages in thread
From: Norman Diamond @ 2003-08-23 12:30 UTC (permalink / raw)
  To: linux-kernel

Although I cannot keep up with the list, I saw this.
"Jamie Lokier" <jamie@shareable.org> asked John Bradford:

> So do the Japanese keys fail to work in Windows, too, without a
> special driver?

I cannot answer for John Bradford's particularly odd keyboard, but can
answer for ordinary Japanese PS/2 and Japanese USB keyboards.

If a Monopolysoft Windows system is running with a US-101 keyboard driver,
then in principle the Japanese keys produce no input, they are ignored, they
are no-ops.  The US-101 driver can be combined with the US layout driver to
match an actual US keyboard, or combined with a German layout driver to
match an actual German keyboard, etc.  If the US layout driver is used but
the keyboard is actually Japanese then the hankaku/zenkaku key produces
input of ` and ~ or something like that, because the US keyboard has that
key in that place.  If the German layout driver is used but the keyboard is
actually Japanese then I don't know if something similar might happen.

For non-Japanese versions of Windows 95 or 98 or NT4, there are hacks, not
supported by Microsoft, to combine the US-101 driver with the Japanese
layout driver copied from the corresponding Japanese version of Windows 95
or 98 or NT4.  In these cases the Japanese keys might or might not produce
input, depending on other random software and settings.

For Japanese versions of Windows 95 or 98 or NT4, of course the Japanese
keys do produce input.  Of course the Japanese layout driver is involved.  I
don't recall if the lower-level keyboard driver has a name that
distinguishes it from the US-101 driver, but the binaries are almost
certainly different.

For Windows 2000 and XP, essentially the same drivers are available in both
Japanese and non-Japanese versions of the OS, though Japanese Windows 2000
includes some extra compounding of hacks to work around one particular
installation-time bug instead of fixing the installation-time bug.  Anyway,
the Japanese-106 keyboard driver is a competitor of the US-101 keyboard
driver.  If the US-101 keyboard driver is installed then the Japanese layout
driver doesn't work even if it's selected, except in the case of the
compounded hack just mentioned.  If the Japanese-106 keyboard driver is
installed then I think it's possible to install either the US-101 layout
driver or Japanese-106 layout driver.  When the Japanese-106 layout driver
is running, of course the Japanese keys produce input.  When the US-101
layout driver is running, the Japanese keys are no-ops, except that the
hankaku/zenkaku key produces ` and ~ for same reason as earlier.

If a USB keyboard is used with an OS that has USB drivers (i.e. not NT4 or
early 95) then I think the OS is smart enough to figure out the actual
layout of the keyboard, at least sometimes.  Then the Japanese keys might
produce input even when the user expected them to be no-ops.  But if the
Japanese IME isn't running then I think the input will still turn into
no-ops, just a bit later in the chain of events than they would otherwise.

If you consider the Japanese-106 driver to be more special than the US-101
driver, then the answer to your question is usually yes, but you need an
attitude adjustment  :-)  If the US-101 driver can be hacked to work with a
larger number of national or linguistic layouts than the Japanese-106 driver
can, then the US-101 driver is the one that's special  :-)


^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Input issues - key down with no key up
@ 2003-08-25 12:47 John Bradford
  0 siblings, 0 replies; 75+ messages in thread
From: John Bradford @ 2003-08-25 12:47 UTC (permalink / raw)
  To: jamie, ndiamond; +Cc: linux-kernel

> > Do you know what the Japanese keys do under Linux?
>
> I don't recall them doing anything under Linux.  I think I've read some
> people say that the Japanese keys yield spaces for them

That is a peculiarity of my keyboard, as far as I know, and it only
happens in Set 2, because the Japanese keys are indistinguishable from
the space bar in that mode.  Normal Japanese keyboards produce
distinct codes for the Japanese keys in Set 2, which do nothing by
default on the Linux console.

John.

^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Input issues - key down with no key up
@ 2003-08-25  8:45 John Bradford
  0 siblings, 0 replies; 75+ messages in thread
From: John Bradford @ 2003-08-25  8:45 UTC (permalink / raw)
  To: jamie, vojtech; +Cc: aebr, linux-kernel, neilb, vojtech

> > > >   Serge van den Boom reports that his LiteOn MediaTouch Keyboard
> > > >   has 18 additional keys: Suspend, Coffee, WWW, Calculator, Xfer,
                                           ^^^^^^
What does that do?

> I'll give you a kernel/module option to disable the forced up effect if
> you have a perfect keyboard. You can then also enable the untranslated
> mode and set 3. But the default will be translated set 2 with forced
> keyups if a key is not repeating.

Exactly - code to accomodate any PS/2 keyboard that doesn't do
untranslated set 3 is a workaround, in my opinion.  People with
perfect keyboards should be able to benefit from the simplicity they
allow.  Obviously 'set 2 + workarounds' needs to be the default,
because of the hardware in existance, but there is still an advantage
to using set 3 where possible.

John.

^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Input issues - key down with no key up
@ 2003-08-21 12:11 John Bradford
  2003-08-21 12:26 ` Vojtech Pavlik
  0 siblings, 1 reply; 75+ messages in thread
From: John Bradford @ 2003-08-21 12:11 UTC (permalink / raw)
  To: aebr, macro; +Cc: jamie, linux-kernel, neilb, vojtech

>  Note the translation is done outside the keyboard -- the onboard 8042
> controller is responsible for it.

How do we currently handle devices connected via bit-banging on the
parallel port,(as we have no onboard 8042 in that case)?

John

^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Input issues - key down with no key up
@ 2003-08-20  5:59 John Bradford
  2003-08-20 15:17 ` Jamie Lokier
  0 siblings, 1 reply; 75+ messages in thread
From: John Bradford @ 2003-08-20  5:59 UTC (permalink / raw)
  To: jamie, john; +Cc: aebr, linux-kernel, macro, neilb, vojtech

> > Also, the keyboard I'm using requires Set 3 to operate fully, although
> > as it's quite possible that I am the only person on the planet who
> > uses this model of keyboard with Linux, that might not be a very valid
> > argument :-).
>
> It's unfortunate if there are some keyboards that only work properly
> in one mode, and others that need the other mode, given that there is
> no way to automatically detect which keyboard is which.

It does work in Set 2, but the Japanese keys generate the same
scancode as the space bar.  Those keys are only generate unique
scancodes in Set 3.  Most Japanese keyboards do work fully in Set 2,
this one is an exception.

John.

^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Input issues - key down with no key up
@ 2003-08-19 19:37 John Bradford
  2003-08-19 23:58 ` Jamie Lokier
  0 siblings, 1 reply; 75+ messages in thread
From: John Bradford @ 2003-08-19 19:37 UTC (permalink / raw)
  To: aebr, macro; +Cc: jamie, linux-kernel, neilb, vojtech

> Etc. Set 3 is a pain. Nobody wants it, except the people who have read
> the spec only and say - look, neat, a single code for a single keystroke.
> Reality is very different.

I totally agree that in 99.9% of cases, Set 2 is a more sensible
choice than Set 3.

On the other hand, a configuration option to only support Set 3, and
not implement all of the work-arounds would shrink the kernel by a few
K, which would be nice.

Also, the keyboard I'm using requires Set 3 to operate fully, although
as it's quite possible that I am the only person on the planet who
uses this model of keyboard with Linux, that might not be a very valid
argument :-).

John.

^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Input issues - key down with no key up
@ 2003-08-16 15:15 John Bradford
  2003-08-18 11:53 ` Maciej W. Rozycki
  0 siblings, 1 reply; 75+ messages in thread
From: John Bradford @ 2003-08-16 15:15 UTC (permalink / raw)
  To: jamie, macro; +Cc: aebr, linux-kernel, neilb, vojtech

> > > > The PS/2 keyboard protocol is utterly absurd.
> > > Yep. It's a dozen or more years of hack upon a hack.
> >  Well, mode #3 with no translation in the i8042 looks quite sanely. 
> What are the known problems with mode #3, then?

It's poorly implemented by a lot of keyboards.

Has anybody actually verified that the keyboards that are presenting
the problem in quesiton are not specifically identifyable by their ID
string, or some other means - E.G. they only exist on specific, known
laptops?

My keyboard has a distinct ID, and works fine in set 3, but isn't
detected as set 3 capable.  I'll have to make a patch some time...

John

^ permalink raw reply	[flat|nested] 75+ messages in thread
* Input issues - key down with no key up
@ 2003-08-15  5:16 Neil Brown
  2003-08-15  7:46 ` Andries Brouwer
  0 siblings, 1 reply; 75+ messages in thread
From: Neil Brown @ 2003-08-15  5:16 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: linux-kernel


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)];

^ permalink raw reply	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2003-09-08 13:25 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-23 12:30 Input issues - key down with no key up Norman Diamond
2003-08-25  4:24 ` Jamie Lokier
2003-08-25 12:15   ` Norman Diamond
  -- strict thread matches above, loose matches on Subject: below --
2003-08-25 12:47 John Bradford
2003-08-25  8:45 John Bradford
2003-08-21 12:11 John Bradford
2003-08-21 12:26 ` Vojtech Pavlik
2003-08-20  5:59 John Bradford
2003-08-20 15:17 ` Jamie Lokier
2003-08-19 19:37 John Bradford
2003-08-19 23:58 ` Jamie Lokier
2003-08-16 15:15 John Bradford
2003-08-18 11:53 ` Maciej W. Rozycki
2003-08-15  5:16 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
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

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).