Lenovo N700 mouse function as kbd too - how to disable only the keyboard, not the mouse

Peter Hutterer peter.hutterer at who-t.net
Fri Jan 13 00:54:24 UTC 2017


On Fri, Jan 13, 2017 at 10:10:37AM +1100, Weiwu Zhang wrote:
> 
> Hello. Lenovo N700 is the first device that I ever used which report itself as both a keyboard and mouse.
> 
> [    14.668] (II) config/udev: Adding input device Lenovo Mice N700 (/dev/input/event16)
> [    14.669] (**) Lenovo Mice N700: Applying InputClass "evdev pointer catchall"
> [    14.669] (**) Lenovo Mice N700: Applying InputClass "evdev keyboard catchall"
> [    14.669] (II) Using input driver 'evdev' for 'Lenovo Mice N700'
> [    14.669] (**) Lenovo Mice N700: always reports core events
> [    14.669] (**) evdev: Lenovo Mice N700: Device: "/dev/input/event16"
> ...
> [    14.684] (--) evdev: Lenovo Mice N700: Found x and y relative axes
> [    14.684] (--) evdev: Lenovo Mice N700: Found keys
> [    14.684] (II) evdev: Lenovo Mice N700: Configuring as mouse
> [    14.684] (II) evdev: Lenovo Mice N700: Configuring as keyboard
> [    14.684] (II) evdev: Lenovo Mice N700: Adding scrollwheel support
> ...
> [    14.684] (II) XINPUT: Adding extended input device "Lenovo Mice N700" (type: KEYBOARD, id 16)
> [    14.684] (**) Option "xkb_rules" "evdev"
> [    14.685] (**) Option "xkb_model" "pc105"
> [    14.685] (**) Option "xkb_layout" "us"
> [    14.685] (**) Option "xkb_variant" "altgr-intl"
> [    14.685] (WW) Option "xkb_options" requires a string value
> 
> It has a Windows key on it that I hit by accident from time to time, and
> randomly produces keystroke 'c'. So I intend to disable those.
> 
> Section "InputClass"
>     Identifier     "Useless Windows Key"
>     MatchIsKeyboard "on"
>     MatchProduct   "Lenovo Mice N700"
> EndSection

fwiw, this second doesn't actually do anything, it merely matches for
keyboard and the product name but i doesn't change anything. you can drop
it.
 
> Result: despite I have "MatchIsKeyboard", that xorg.conf.d/snippet.conf
> disabled both the mouse and the Windows key on it.

did you have an option Ignore or something in that section?
the problem is that MatchIsKeyboard matches *any* device that is a keyboard,
regardless of what other properties the device has. the evdev driver inits
one X device with both pointer and keyboard properties, you can't easily
disable the keyboard bits.

If you're using a recent xf86-input-libinput driver you'd get two x devices
and you can then disable the keyboard one (at runtime only though, not with
a config).

> I tried to be creative with this:
> 
> Section "InputClass"
>     Identifier     "Useless Windows Key"
>     MatchIsKeyboard "on"
>     Option "XkbModel" "pc101" # default to pc104
> EndSection

that's sort-of the right direction but changing the model won't work for
keys that are common keys (like "c"). what keycd does the key send? KEY_C?
(evemu-record will tell you). What you'll need to do is write a custom xkb
section that maps c to VoidSymbol and apply that to that specific keyboard.
I'm not sure there's some good documentation out there on how to do that
though :(

another option would also be to add a custom hwdb entry in the style of
60-keyboard.hwdb that matches the device to remove the scancode->keycode
binding and map the key to nothing. that way you solve it at the kernel
level.

Cheers,
   Peter

> 
> But surprisingly, althoug this configuration option is accepted according to
> Xorg.0.log, Windows key still works:
> 
> [   972.908] (II) evdev: Lenovo Mice N700: Configuring as mouse
> [   972.908] (II) evdev: Lenovo Mice N700: Configuring as keyboard
> [   972.908] (**) Option "config_info" "udev:/sys/devices/virtual/misc/uhid/0005:17EF:6060.0003/input/input24/event16"
> [   972.908] (II) XINPUT: Adding extended input device "Lenovo Mice N700" (type: KEYBOARD, id 16)
> [   972.908] (**) Option "xkb_rules" "evdev"
> [   972.908] (**) Option "xkb_model" "pc101"
> [   972.908] (**) Option "xkb_layout" "us"
> [   972.909] (**) Option "xkb_variant" "altgr-intl"
> 
> This problem was posted on UbuntuForums with no solution:
> https://ubuntuforums.org/showthread.php?t=2349070
> 
> Thanks!
> 


More information about the xorg mailing list