Skip to contentSkip to conversation

Bug#594089: keyboard-configuration: caps lock keycode problem

DISCUSSION Samuel Thibault 5 participants 19 messages Oct 24, 2010 – Oct 29, 2010 4 messages not in the archive HID

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20100903235540.GA9149@const

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

The short story is: Tom's keyboard sends all that when he presses caps lock:

press: 0x3a 0xe0 0x66
repeat: 0x3a
release: 0xba 0xe0 0xe6

0xe0 0x66 happens to be the "favorites" key on his keyboard with internet navigation keys. I thus believe there's a bug in his keyboard that needs to be filtered at the kernel level.

The long story can be read on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594089

Quoted 3 lines · Tom Vier, le Mon 13 Sep 2010 14:07:29 -0400, a écrit :

Here's xev from Stable. It looks like in Testing that some of the extra key codes that show up in showkey are getting interpreted as additional key presses in Testing's xorg but not Stable's.

Yes, as I said in a previous mail, squeeze Xorg now interprets the internet scancodes by default, while it wouldn't in lenny and previous, thus not showing the bug.

Samuel

#5 lore raw
Quoted 7 lines · Samuel Thibault

The short story is: Tom's keyboard sends all that when he presses caps lock:

press: 0x3a 0xe0 0x66
repeat: 0x3a
release: 0xba 0xe0 0xe6

Quoted 5 lines

0xe0 0x66 happens to be the "favorites" key on his keyboard with internet navigation keys. I thus believe there's a bug in his keyboard that needs to be filtered at the kernel level.

The long story can be read on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594089

Hmm, the question is whether the real "favorites" key send the same usage and the fake one after caps lock. Any chance Tom could locate evtest utility and see what MSC_SCAN events being emitted?

Thanks.

Signature · 1 line
Dmitry
#6 lore raw
Quoted 12 lines · Dmitry Torokhov
Quoted 11 lines · Samuel Thibault

The short story is: Tom's keyboard sends all that when he presses caps lock:

press: 0x3a 0xe0 0x66
repeat: 0x3a
release: 0xba 0xe0 0xe6

0xe0 0x66 happens to be the "favorites" key on his keyboard with internet navigation keys. I thus believe there's a bug in his keyboard that needs to be filtered at the kernel level.

Quoted 7 lines
Quoted 1 line

The long story can be read on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594089

Hmm, the question is whether the real "favorites" key send the same usage and the fake one after caps lock. Any chance Tom could locate evtest utility and see what MSC_SCAN events being emitted?

Thanks.

Sure. Here's caps-lock:

Event: time 1288013671.633008, -------------- Report Sync ------------
Event: time 1288013674.171812, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.171853, type 1 (Key), code 58 (CapsLock), value 1
Event: time 1288013674.171862, -------------- Report Sync ------------
Event: time 1288013674.172210, type 17 (LED), code 1 (CapsLock), value 1
Event: time 1288013674.299553, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.299580, type 1 (Key), code 58 (CapsLock), value 0
Event: time 1288013674.299593, -------------- Report Sync ------------

Right-shift (the other problem key):

Event: time 1288013798.388025, -------------- Report Sync ------------
Event: time 1288013800.742088, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.742130, type 1 (Key), code 54 (RightShift), value 1
Event: time 1288013800.742142, -------------- Report Sync ------------
Event: time 1288013800.861777, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.861812, type 1 (Key), code 54 (RightShift), value 0
Event: time 1288013800.861824, -------------- Report Sync ------------

--
Tom Vier <[email protected]>
Senior Net/Sys Admin
Triad Systems Engineering, Inc.

#7 lore raw
Quoted 34 lines · Tom Vier, le Mon 25 Oct 2010 09:37:26 -0400, a écrit :
Quoted 12 lines · Dmitry Torokhov
Quoted 11 lines · Samuel Thibault

The short story is: Tom's keyboard sends all that when he presses caps lock:

press: 0x3a 0xe0 0x66
repeat: 0x3a
release: 0xba 0xe0 0xe6

0xe0 0x66 happens to be the "favorites" key on his keyboard with internet navigation keys. I thus believe there's a bug in his keyboard that needs to be filtered at the kernel level.

Quoted 6 lines
Quoted 2 lines

The long story can be read on
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594089

Hmm, the question is whether the real "favorites" key send the same usage and the fake one after caps lock. Any chance Tom could locate evtest utility and see what MSC_SCAN events being emitted?

Sure. Here's caps-lock:

Event: time 1288013671.633008, -------------- Report Sync ------------
Event: time 1288013674.171812, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.171853, type 1 (Key), code 58 (CapsLock), value 1
Event: time 1288013674.171862, -------------- Report Sync ------------
Event: time 1288013674.172210, type 17 (LED), code 1 (CapsLock), value 1
Event: time 1288013674.299553, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.299580, type 1 (Key), code 58 (CapsLock), value 0
Event: time 1288013674.299593, -------------- Report Sync ------------

Right-shift (the other problem key):

Quoted 7 lines

Event: time 1288013798.388025, -------------- Report Sync ------------
Event: time 1288013800.742088, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.742130, type 1 (Key), code 54 (RightShift), value 1
Event: time 1288013800.742142, -------------- Report Sync ------------
Event: time 1288013800.861777, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.861812, type 1 (Key), code 54 (RightShift), value 0
Event: time 1288013800.861824, -------------- Report Sync ------------

Could you also post results when pressing the "favorite" and the "prev" internet keys of your keyboard?

Samuel
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 43 lines · Samuel Thibault
Quoted 34 lines · Tom Vier, le Mon 25 Oct 2010 09:37:26 -0400, a écrit :
Quoted 12 lines · Dmitry Torokhov
Quoted 11 lines · Samuel Thibault

The short story is: Tom's keyboard sends all that when he presses caps lock:

press: 0x3a 0xe0 0x66
repeat: 0x3a
release: 0xba 0xe0 0xe6

0xe0 0x66 happens to be the "favorites" key on his keyboard with internet navigation keys. I thus believe there's a bug in his keyboard that needs to be filtered at the kernel level.

Quoted 6 lines
Quoted 2 lines

The long story can be read on
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594089

Hmm, the question is whether the real "favorites" key send the same usage and the fake one after caps lock. Any chance Tom could locate evtest utility and see what MSC_SCAN events being emitted?

Sure. Here's caps-lock:

Event: time 1288013671.633008, -------------- Report Sync ------------
Event: time 1288013674.171812, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.171853, type 1 (Key), code 58 (CapsLock), value 1
Event: time 1288013674.171862, -------------- Report Sync ------------
Event: time 1288013674.172210, type 17 (LED), code 1 (CapsLock), value 1
Event: time 1288013674.299553, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.299580, type 1 (Key), code 58 (CapsLock), value 0
Event: time 1288013674.299593, -------------- Report Sync ------------

Right-shift (the other problem key):

Quoted 7 lines

Event: time 1288013798.388025, -------------- Report Sync ------------
Event: time 1288013800.742088, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.742130, type 1 (Key), code 54 (RightShift), value 1
Event: time 1288013800.742142, -------------- Report Sync ------------
Event: time 1288013800.861777, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.861812, type 1 (Key), code 54 (RightShift), value 0
Event: time 1288013800.861824, -------------- Report Sync ------------

Quoted 3 lines

Could you also post results when pressing the "favorite" and the "prev" internet keys of your keyboard?

Actually, if these are all the events that evtest reports when pressing CapsLock then I am confused where the "favorites" ghost press is coming from... They are not emitted by the device. Do you have a funky keymap loaded somewhere? Also, was 'showkey -s' issued while in X or in the text console?

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw
Quoted 10 lines · Dmitry Torokhov
Quoted 3 lines · Samuel Thibault

Could you also post results when pressing the "favorite" and the "prev" internet keys of your keyboard?

Actually, if these are all the events that evtest reports when pressing CapsLock then I am confused where the "favorites" ghost press is coming from... They are not emitted by the device. Do you have a funky keymap loaded somewhere? Also, was 'showkey -s' issued while in X or in the text console?

Console. I just ran it now and caps-lock has the same codes as "favorites" and right-shift has the same as "previous". So it's not an X problem.

--
Tom Vier <[email protected]>
Senior Net/Sys Admin
Triad Systems Engineering, Inc.

#10 lore raw
In reply to Samuel Thibault
Quoted 43 lines · Samuel Thibault
Quoted 34 lines · Tom Vier, le Mon 25 Oct 2010 09:37:26 -0400, a écrit :
Quoted 12 lines · Dmitry Torokhov
Quoted 11 lines · Samuel Thibault

The short story is: Tom's keyboard sends all that when he presses caps lock:

press: 0x3a 0xe0 0x66
repeat: 0x3a
release: 0xba 0xe0 0xe6

0xe0 0x66 happens to be the "favorites" key on his keyboard with internet navigation keys. I thus believe there's a bug in his keyboard that needs to be filtered at the kernel level.

Quoted 6 lines
Quoted 2 lines

The long story can be read on
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594089

Hmm, the question is whether the real "favorites" key send the same usage and the fake one after caps lock. Any chance Tom could locate evtest utility and see what MSC_SCAN events being emitted?

Sure. Here's caps-lock:

Event: time 1288013671.633008, -------------- Report Sync ------------
Event: time 1288013674.171812, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.171853, type 1 (Key), code 58 (CapsLock), value 1
Event: time 1288013674.171862, -------------- Report Sync ------------
Event: time 1288013674.172210, type 17 (LED), code 1 (CapsLock), value 1
Event: time 1288013674.299553, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288013674.299580, type 1 (Key), code 58 (CapsLock), value 0
Event: time 1288013674.299593, -------------- Report Sync ------------

Right-shift (the other problem key):

Quoted 7 lines

Event: time 1288013798.388025, -------------- Report Sync ------------
Event: time 1288013800.742088, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.742130, type 1 (Key), code 54 (RightShift), value 1
Event: time 1288013800.742142, -------------- Report Sync ------------
Event: time 1288013800.861777, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288013800.861812, type 1 (Key), code 54 (RightShift), value 0
Event: time 1288013800.861824, -------------- Report Sync ------------

Quoted 4 lines

Could you also post results when pressing the "favorite" and the "prev" internet keys of your keyboard?

Samuel

It's returning the same codes. Maybe what's going on here is that they never worked back in Stable and someone tried to fix those keys, not realizing they're the same codes as capslock and right-shift. I'll have to test it on my Stable machine tonight to see if those keys work or not, tho.

Favorites:
Event: time 1288041423.048839, -------------- Report Sync ------------
Event: time 1288041425.068704, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288041425.068742, type 1 (Key), code 58 (CapsLock), value 1
Event: time 1288041425.068754, -------------- Report Sync ------------
Event: time 1288041425.069105, type 17 (LED), code 1 (CapsLock), value 1
Event: time 1288041425.260313, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288041425.260343, type 1 (Key), code 58 (CapsLock), value 0
Event: time 1288041425.260347, -------------- Report Sync ------------

Previous:
Event: time 1288041443.531447, -------------- Report Sync ------------
Event: time 1288041445.318877, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288041445.318915, type 1 (Key), code 54 (RightShift), value 1
Event: time 1288041445.318932, -------------- Report Sync ------------
Event: time 1288041445.438567, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288041445.438606, type 1 (Key), code 54 (RightShift), value 0
Event: time 1288041445.438629, -------------- Report Sync ------------

--
Tom Vier <[email protected]>
Senior Net/Sys Admin
Triad Systems Engineering, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
Quoted 73 lines · Tom Vier
Quoted 6 lines · Samuel Thibault
Quoted 5 lines · Tom Vier, le Mon 25 Oct 2010 09:37:26 -0400, a écrit :
Quoted 4 lines · Dmitry Torokhov
Quoted 3 lines · Samuel Thibault

The short story is: Tom's keyboard sends all that when he presses caps lock:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

press: 0x3a 0xe0 0x66
repeat: 0x3a
release: 0xba 0xe0 0xe6

0xe0 0x66 happens to be the "favorites" key on his keyboard with internet navigation keys. I thus believe there's a bug in his

keyboard

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

that needs to be filtered at the kernel level.

The long story can be read on
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594089

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Hmm, the question is whether the real "favorites" key send the same usage and the fake one after caps lock. Any chance Tom could locate evtest utility and see what MSC_SCAN events being emitted?

Sure. Here's caps-lock:

Event: time 1288013671.633008, -------------- Report Sync ------------
Event: time 1288013674.171812, type 4 (Misc), code 4 (ScanCode),

value 70039

Quoted 4 lines
Quoted 4 lines

Event: time 1288013674.171853, type 1 (Key), code 58 (CapsLock), value 1
Event: time 1288013674.171862, -------------- Report Sync ------------
Event: time 1288013674.172210, type 17 (LED), code 1 (CapsLock), value 1
Event: time 1288013674.299553, type 4 (Misc), code 4 (ScanCode),

value 70039

Quoted 8 lines
Quoted 8 lines

Event: time 1288013674.299580, type 1 (Key), code 58 (CapsLock), value 0
Event: time 1288013674.299593, -------------- Report Sync ------------

Right-shift (the other problem key):

Event: time 1288013798.388025, -------------- Report Sync ------------
Event: time 1288013800.742088, type 4 (Misc), code 4 (ScanCode),

value 700e5

Quoted 1 line
Quoted 1 line

Event: time 1288013800.742130, type 1 (Key), code 54

(RightShift), value 1

Quoted 2 lines
Quoted 2 lines

Event: time 1288013800.742142, -------------- Report Sync ------------
Event: time 1288013800.861777, type 4 (Misc), code 4 (ScanCode),

value 700e5

Quoted 1 line
Quoted 1 line

Event: time 1288013800.861812, type 1 (Key), code 54

(RightShift), value 0

Quoted 6 lines
Quoted 1 line

Event: time 1288013800.861824, -------------- Report Sync ------------

Could you also post results when pressing the "favorite" and the "prev" internet keys of your keyboard?

Samuel

It's returning the same codes. Maybe what's going on here is that they never worked back in Stable and someone tried to fix those keys, not realizing they're the same codes as capslock and right-shift. I'll have to test it on my Stable machine tonight to see if those keys work or not, tho.

Favorites:
Event: time 1288041423.048839, -------------- Report Sync ------------
Event: time 1288041425.068704, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288041425.068742, type 1 (Key), code 58 (CapsLock), value 1
Event: time 1288041425.068754, -------------- Report Sync ------------
Event: time 1288041425.069105, type 17 (LED), code 1 (CapsLock), value 1
Event: time 1288041425.260313, type 4 (Misc), code 4 (ScanCode), value 70039
Event: time 1288041425.260343, type 1 (Key), code 58 (CapsLock), value 0
Event: time 1288041425.260347, -------------- Report Sync ------------

Quoted 9 lines

Previous:
Event: time 1288041443.531447, -------------- Report Sync ------------
Event: time 1288041445.318877, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288041445.318915, type 1 (Key), code 54 (RightShift), value 1
Event: time 1288041445.318932, -------------- Report Sync ------------
Event: time 1288041445.438567, type 4 (Misc), code 4 (ScanCode), value 700e5
Event: time 1288041445.438606, type 1 (Key), code 54 (RightShift), value 0
Event: time 1288041445.438629, -------------- Report Sync ------------

Hmm, it looks like it uses the same usages (MSC_SCAN) for CapsLock/Favorites and RightShift/Previous... What does lsusb say about the keyboard (VID/PID)?

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#12 lore raw
Quoted 3 lines · Dmitry Torokhov

Hmm, it looks like it uses the same usages (MSC_SCAN) for CapsLock/Favorites and RightShift/Previous... What does lsusb say about the keyboard (VID/PID)?

The scroll wheel on the keyboard is a separate device:

Bus 005 Device 003: ID 046d:c30a Logitech, Inc. iTouch Composite Bus 005 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse

-v:

Bus 005 Device 005: ID 046d:c30a Logitech, Inc. iTouch Composite Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10

  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc30a iTouch Composite
  bcdDevice           15.00
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 64
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 156
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 32

Bus 005 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00

  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc016 Optical Wheel Mouse
  bcdDevice            3.40
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 52
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0004 1x 4 bytes
bInterval 10

--
Tom Vier <[email protected]>
Senior Net/Sys Admin
Triad Systems Engineering, Inc.

#13 lore raw
Quoted 10 lines · Tom Vier
Quoted 3 lines · Dmitry Torokhov

Hmm, it looks like it uses the same usages (MSC_SCAN) for CapsLock/Favorites and RightShift/Previous... What does lsusb say about the keyboard (VID/PID)?

The scroll wheel on the keyboard is a separate device:

Bus 005 Device 003: ID 046d:c30a Logitech, Inc. iTouch Composite Bus 005 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse

Thanks Tom. This device is handled by drivers/hid/hid-lg.c sub-driver and there seem to be a few issues there, still I do not see how they can produce the results you are seeing.

First of all, the device appears to use duplicate usages for CapsLock/Favorites and RightShift/Previous so we better set up the duplicate usages quirk. I wonder how the other OS copes with diferent keys using the same usages. Jiri, any ideas?

Also, based on evtest data I only see presses/releases for one key (Caps Lock, Right Shift, etc.) I do not see the presses for the additional keys in the evtest stream so I am baffled as to where the additional scancode is coming from... Do you have some funky keymap loaded? Anything interesting in dumpkeys?

Signature · 14 lines
Dmitry

Input: hid-lgff - mark Logitech Elite as having duplicate reports

From: Dmitry Torokhov <[email protected]>

Also make sure we clear bits when mapping keys to ensure that
hid-input will not try to "add" more keycodes.

Signed-off-by: Dmitry Torokhov <[email protected]>
---

 drivers/hid/hid-lg.c |   59 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 19 deletions(-)
drivers/hid/hid-lg.c +40 -19
index b629fba..2979b68 100644
@@ -78,8 +78,8 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 	return rdesc;
 }
 
-#define lg_map_key_clear(c)	hid_map_usage_clear(hi, usage, bit, max, \
-		EV_KEY, (c))
+#define lg_map_key_clear(c) \
+	hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c))
 
 static int lg_ultrax_remote_mapping(struct hid_input *hi,
 		struct hid_usage *usage, unsigned long **bit, int *max)
@@ -88,6 +88,7 @@ static int lg_ultrax_remote_mapping(struct hid_input *hi,
 		return 0;
 
 	set_bit(EV_REP, hi->input->evbit);
+
 	switch (usage->hid & HID_USAGE) {
 	/* Reported on Logitech Ultra X Media Remote */
 	case 0x004: lg_map_key_clear(KEY_AGAIN);	break;
@@ -168,8 +169,10 @@ static int lg_wireless_mapping(struct hid_input *hi, struct hid_usage *usage,
 	case 0x102a: lg_map_key_clear(KEY_BACK);		break;
 	case 0x102b: lg_map_key_clear(KEY_CYCLEWINDOWS);	break;
 	case 0x102d: lg_map_key_clear(KEY_WWW);			break;
-	/* The following two are 'Start/answer call' and 'End/reject call'
-	   on the MX3200 */
+	/*
+	 * The following two are 'Start/answer call' and 'End/reject call'
+	 * on the MX3200
+	 */
 	case 0x1031: lg_map_key_clear(KEY_OK);			break;
 	case 0x1032: lg_map_key_clear(KEY_CANCEL);		break;
 	case 0x1041: lg_map_key_clear(KEY_BATTERY);		break;
@@ -195,17 +198,35 @@ static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 		struct hid_field *field, struct hid_usage *usage,
 		unsigned long **bit, int *max)
 {
-	/* extended mapping for certain Logitech hardware (Logitech cordless
-	   desktop LX500) */
+	/*
+	 * Extended mapping for certain Logitech hardware (such as
+	 * Logitech cordless desktop LX500)
+	 */
 	static const u8 e_keymap[] = {
-		  0,216,  0,213,175,156,  0,  0,  0,  0,
-		144,  0,  0,  0,  0,  0,  0,  0,  0,212,
-		174,167,152,161,112,  0,  0,  0,154,  0,
-		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-		  0,  0,  0,  0,  0,183,184,185,186,187,
-		188,189,190,191,192,193,194,  0,  0,  0
+		[ 1] = KEY_CHAT,
+		[ 3] = KEY_SOUND,
+		[ 4] = KEY_MOVE,
+		[ 5] = KEY_BOOKMARKS,
+		[10] = KEY_FILE,
+		[19] = KEY_CAMERA,
+		[20] = KEY_EXIT,
+		[21] = KEY_RECORD,
+		[22] = KEY_SCREENLOCK,
+		[23] = KEY_EJECTCD,
+		[24] = KEY_MACRO,
+		[28] = KEY_CYCLEWINDOWS,
+		[65] = KEY_F13,
+		[66] = KEY_F14,
+		[67] = KEY_F15,
+		[68] = KEY_F16,
+		[69] = KEY_F17,
+		[70] = KEY_F18,
+		[71] = KEY_F19,
+		[72] = KEY_F20,
+		[73] = KEY_F21,
+		[74] = KEY_F22,
+		[75] = KEY_F23,
+		[76] = KEY_F24,
 	};
 	unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
 	unsigned int hid = usage->hid;
@@ -233,10 +254,9 @@ static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 			return -1;
 	} else {
 		if ((quirks & LG_EXPANDED_KEYMAP) &&
-				hid < ARRAY_SIZE(e_keymap) &&
-				e_keymap[hid] != 0) {
-			hid_map_usage(hi, usage, bit, max, EV_KEY,
-					e_keymap[hid]);
+		    hid < ARRAY_SIZE(e_keymap) &&
+		    e_keymap[hid] != KEY_RESERVED) {
+			lg_map_key_clear(e_keymap[hid]);
 			return 1;
 		}
 	}
@@ -353,7 +373,8 @@ static const struct hid_device_id lg_devices[] = {
 		.driver_data = LG_DUPLICATE_USAGES },
 
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD),
-		.driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
+		.driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP |
+				LG_DUPLICATE_USAGES },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500),
 		.driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
 
#14 lore raw
Quoted 5 lines · Dmitry Torokhov, le Wed 27 Oct 2010 02:10:29 -0700, a écrit :

Also, based on evtest data I only see presses/releases for one key (Caps Lock, Right Shift, etc.) I do not see the presses for the additional keys in the evtest stream so I am baffled as to where the additional scancode is coming from... Do you have some funky keymap loaded? Anything interesting in dumpkeys?

Err, since the duplicates appear in scancodes already, is the content of dumpkeys really involved?

Samuel
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw
Quoted 10 lines · Samuel Thibault
Quoted 5 lines · Dmitry Torokhov, le Wed 27 Oct 2010 02:10:29 -0700, a écrit :

Also, based on evtest data I only see presses/releases for one key (Caps Lock, Right Shift, etc.) I do not see the presses for the additional keys in the evtest stream so I am baffled as to where the additional scancode is coming from... Do you have some funky keymap loaded? Anything interesting in dumpkeys?

Err, since the duplicates appear in scancodes already, is the content of dumpkeys really involved?

Evtest data does not show any additional events, so the additional scancodes must be coming from the legacy keyboard driver.

Signature · 1 line
Dmitry
#16 lore raw
Quoted 12 lines · Dmitry Torokhov, le Wed 27 Oct 2010 08:06:26 -0700, a écrit :

On Oct 27, 2010, at 5:05 AM, Samuel Thibault <[email protected]> wrote:

Dmitry Torokhov, le Wed 27 Oct 2010 02:10:29 -0700, a écrit :

Also, based on evtest data I only see presses/releases for one key (Caps Lock, Right Shift, etc.) I do not see the presses for the additional keys in the evtest stream so I am baffled as to where the additional scancode is coming from... Do you have some funky keymap loaded? Anything interesting in dumpkeys?

Quoted 5 lines

Err, since the duplicates appear in scancodes already, is the content of dumpkeys really involved?

Evtest data does not show any additional events, so the additional scancodes must be coming from the legacy keyboard driver.

Sure, but dumpkeys shows the table from scancodes to keycodes, not from input events to scancodes.

Samuel
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw
Quoted 13 lines · Samuel Thibault
Quoted 12 lines · Dmitry Torokhov, le Wed 27 Oct 2010 08:06:26 -0700, a écrit :

On Oct 27, 2010, at 5:05 AM, Samuel Thibault <[email protected]> wrote:

Dmitry Torokhov, le Wed 27 Oct 2010 02:10:29 -0700, a écrit :

Also, based on evtest data I only see presses/releases for one key (Caps Lock, Right Shift, etc.) I do not see the presses for the additional keys in the evtest stream so I am baffled as to where the additional scancode is coming from... Do you have some funky keymap loaded? Anything interesting in dumpkeys?

Quoted 8 lines
Quoted 5 lines

Err, since the duplicates appear in scancodes already, is the content of dumpkeys really involved?

Evtest data does not show any additional events, so the additional scancodes must be coming from the legacy keyboard driver.

Sure, but dumpkeys shows the table from scancodes to keycodes, not from input events to scancodes.

I am just wondering if some of the translation is leaking even though the keyboard is in raw mode...

OK, scratch that... Are there any other input devices? Anything connected via uinput and listening? What does /proc/bus/input/devices show? Maybe if Tom could compile and load evbug module it would show us where the additional events are coming form, becaus ethey surely are not generated by the keyboard itself (otherwise we'd have seen them in evtest output for that device).

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#18 lore raw
Quoted 8 lines · Dmitry Torokhov
Quoted 3 lines · Samuel Thibault

Dmitry Torokhov, le Wed 27 Oct 2010 08:06:26 -0700, a écrit :
Sure, but dumpkeys shows the table from scancodes to keycodes, not from input events to scancodes.

I am just wondering if some of the translation is leaking even though the keyboard is in raw mode...

Quoted 6 lines

OK, scratch that... Are there any other input devices? Anything connected via uinput and listening? What does /proc/bus/input/devices show? Maybe if Tom could compile and load evbug module it would show us where the additional events are coming form, becaus ethey surely are not generated by the keyboard itself (otherwise we'd have seen them in evtest output for that device).

Minor correction to what I wrote earlier about the scroll wheel. That is actually my mouse. It says Dell but it's really made by Logitech.

I just tried the console and what's funny is Favorites actually works as Capslock and Previous works as right-shift. X has the opposite problem.

In case anyone missed it, Debian Stable works fine with this keyboard. The keyboard on the working Stable machine is exactly the same (same usb id's). I'm not familiar with the input stack, but in case it is a kernel problem, the difference is:

Stable dist, working:
Linux zero 2.6.26-2-amd64 #1 SMP Thu Sep 16 15:56:38 UTC 2010 x86_64 GNU/Linux

Testing dist, not working:
Linux tom 2.6.32-5-amd64 #1 SMP Fri Sep 17 21:50:19 UTC 2010 x86_64 GNU/Linux

/proc/bus/input/devices on the problem machine:

I: Bus=0017 Vendor=0001 Product=0001 Version=0100
N: Name="Macintosh mouse button emulation"
P: Phys=
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=mouse0 event0
B: EV=7
B: KEY=70000 0 0 0 0
B: REL=3

I: Bus=0003 Vendor=046d Product=c016 Version=0110
N: Name="Logitech Optical USB Mouse"
P: Phys=usb-0000:00:13.0-1/input0
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-1/5-1:1.0/input/input1
U: Uniq=
H: Handlers=mouse1 event1
B: EV=17
B: KEY=70000 0 0 0 0
B: REL=103
B: MSC=10

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input4
U: Uniq=
H: Handlers=kbd event4
B: EV=3
B: KEY=10000000000000 0

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=LNXPWRBN/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input5
U: Uniq=
H: Handlers=kbd event5
B: EV=3
B: KEY=10000000000000 0

I: Bus=0010 Vendor=001f Product=0001 Version=0100
N: Name="PC Speaker"
P: Phys=isa0061/input0
S: Sysfs=/devices/platform/pcspkr/input/input6
U: Uniq=
H: Handlers=kbd event6
B: EV=40001
B: SND=6

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.0/input/input9
U: Uniq=
H: Handlers=kbd event2
B: EV=120013
B: KEY=1000000000007 ff800000000007ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=1f

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.1/input/input10
U: Uniq=
H: Handlers=kbd mouse2 event3
B: EV=17
B: KEY=fffffffffffff f8403340000 60d8fafd01d008 1f000000000000 0
B: REL=103
B: MSC=10

--
Tom Vier <[email protected]>
Senior Net/Sys Admin
Triad Systems Engineering, Inc.

#19 lore raw
Quoted 40 lines · Tom Vier
Quoted 8 lines · Dmitry Torokhov
Quoted 3 lines · Samuel Thibault

Dmitry Torokhov, le Wed 27 Oct 2010 08:06:26 -0700, a écrit :
Sure, but dumpkeys shows the table from scancodes to keycodes, not from input events to scancodes.

I am just wondering if some of the translation is leaking even though the keyboard is in raw mode...

Quoted 6 lines

OK, scratch that... Are there any other input devices? Anything connected via uinput and listening? What does /proc/bus/input/devices show? Maybe if Tom could compile and load evbug module it would show us where the additional events are coming form, becaus ethey surely are not generated by the keyboard itself (otherwise we'd have seen them in evtest output for that device).

Minor correction to what I wrote earlier about the scroll wheel. That is actually my mouse. It says Dell but it's really made by Logitech.

I just tried the console and what's funny is Favorites actually works as Capslock and Previous works as right-shift. X has the opposite problem.

In case anyone missed it, Debian Stable works fine with this keyboard. The keyboard on the working Stable machine is exactly the same (same usb id's). I'm not familiar with the input stack, but in case it is a kernel problem, the difference is:

Stable dist, working:
Linux zero 2.6.26-2-amd64 #1 SMP Thu Sep 16 15:56:38 UTC 2010 x86_64 GNU/Linux

Testing dist, not working:
Linux tom 2.6.32-5-amd64 #1 SMP Fri Sep 17 21:50:19 UTC 2010 x86_64 GNU/Linux

/proc/bus/input/devices on the problem machine:

...

Quoted 12 lines

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.0/input/input9
U: Uniq=
H: Handlers=kbd event2
B: EV=120013
B: KEY=1000000000007 ff800000000007ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=1f

Quoted 11 lines

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.1/input/input10
U: Uniq=
H: Handlers=kbd mouse2 event3
B: EV=17
B: KEY=fffffffffffff f8403340000 60d8fafd01d008 1f000000000000 0
B: REL=103
B: MSC=10

Hmm, this keyboard registers 2 input devices... I wonder, if you press CapsLock/Favories and RightShift/Previous and monitor both event devices with evtest - will it report events on both devices at once?

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#20 lore raw
Quoted 25 lines · Dmitry Torokhov
Quoted 12 lines

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.0/input/input9
U: Uniq=
H: Handlers=kbd event2
B: EV=120013
B: KEY=1000000000007 ff800000000007ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=1f

Quoted 11 lines

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.1/input/input10
U: Uniq=
H: Handlers=kbd mouse2 event3
B: EV=17
B: KEY=fffffffffffff f8403340000 60d8fafd01d008 1f000000000000 0
B: REL=103
B: MSC=10

Quoted 3 lines

Hmm, this keyboard registers 2 input devices... I wonder, if you press CapsLock/Favories and RightShift/Previous and monitor both event devices with evtest - will it report events on both devices at once?

I haven't really been following this thread but I think the two input devices is normal if the keyboard has multi-media keys. All the "extra" keys show up as a separate input device.

You might get the CapsLock and RightShift events on one device and the Favorites and Previous events on the other.

Hartley

#21 lore raw
Quoted 27 lines · H Hartley Sweeten
Quoted 22 lines · Dmitry Torokhov
Quoted 11 lines

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.0/input/input9
U: Uniq=
H: Handlers=kbd event2
B: EV=120013
B: KEY=1000000000007 ff800000000007ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=1f

Quoted 10 lines

I: Bus=0003 Vendor=046d Product=c30a Version=0110
N: Name="Logitech Logitech USB Keyboard"
P: Phys=usb-0000:00:13.0-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:13.0/usb5/5-2/5-2:1.1/input/input10
U: Uniq=
H: Handlers=kbd mouse2 event3
B: EV=17
B: KEY=fffffffffffff f8403340000 60d8fafd01d008 1f000000000000 0
B: REL=103
B: MSC=10

Quoted 3 lines

Hmm, this keyboard registers 2 input devices... I wonder, if you press CapsLock/Favories and RightShift/Previous and monitor both event devices with evtest - will it report events on both devices at once?

Quoted 6 lines

I haven't really been following this thread but I think the two input devices is normal if the keyboard has multi-media keys. All the "extra" keys show up as a separate input device.

You might get the CapsLock and RightShift events on one device and the Favorites and Previous events on the other.

It is normal on sane devices however in this case there are "ghost" key presses coming from an unknown source.

Signature · 1 line
Dmitry
#22 lore raw
In reply to Dmitry Torokhov
Quoted 4 lines · Dmitry Torokhov

First of all, the device appears to use duplicate usages for CapsLock/Favorites and RightShift/Previous so we better set up the duplicate usages quirk. I wonder how the other OS copes with diferent keys using the same usages. Jiri, any ideas?

That thing I have been also wondering about when introducing the quirk for duplicate usages, but I haven't really found out. It's a bit odd.

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.