Disabling special keys

Matt Graham mhgraham at crow202.org
Tue Jul 12 17:03:10 MST 2022


On 2022-07-12 14:30, Jim via PLUG-discuss wrote:
> one is a printer key.  When I press it xev tells me it's sending
> the Control_L and p codes at the same time. I want to remap it
. so it sends only one keycode.  Here's what xev shows when I
> press it.
> KeyPress event,
>     state 0x10, keycode 37 (keysym 0xffe3, Control_L)
> KeyPress event,
>     state 0x14, keycode 33 (keysym 0x70, p)
> KeyRelease event,
>     state 0x14, keycode 37 (keysym 0xffe3, Control_L)
> KeyRelease event,
>     state 0x10, keycode 33 (keysym 0x70, p)
> If I disable keycode 33, the p key also doesn't work.  Is there
> some way to get it to send just one code?

If this is anything like other HID devices that I've seen that do this, 
it will not be easy.  I have a mouse where one of the extra buttons 
generates KeyPress events for Shift_L, then Meta_L, then KeyRelease 
events for ISO_Left_Tab, Meta_L, and Shift_L.  I assume that this is 
being done at a rather low level in the device.  HID things can send key 
events if they want, that's part of being HID.  There is usually no way 
(or no obvious way?) to change their multiple-key event sending.

I have not had a great deal of trouble with this because it's easy to 
not hit that button.  If I were really motivated to fix it, I'd go 
digging in /usr/src/linux/drivers/hid/ and find the file that contains 
the code for your manufacturer's devices.  Then learn the HID stuff and 
set things up so that if the scancode for this key comes in, you send 1 
event of Xfree86_Print (or whatever other keysym you think is 
appropriate) instead of Control_L and p.  Hacky, but you have the 
option.  The hid-prodikeys.c file shows an example of handling a USB 
keyboard that also has piano keys and modifier keys, it's long, but it 
may be a useful file to look at.

-- 
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.


More information about the PLUG-discuss mailing list