10

I installed Fedora 26 and noticed that the Internal keyboard is behaving a bit weird. Keys are getting pressed all the time.

I use an external keyboard, so I can do without the built-in one.

P.S : This is not a duplicate of How to disable laptop keyboard on plugging in a USB keyboard? as the answer is for Xorg and not for wayland

3 Answers 3

7

I'm not able to try this, but perhaps you can "grab" input from the unwanted device using evtest so that they are not delivered to other processes. Find the device from ls /dev/input/by-id/. For example, I have /dev/input/by-id/usb-05f3_0007-event-kbd which is a symbolic link to ../event2. Presumably for a built-in keyboard there should be a similar non-usb "kbd". You can then try

sudo evtest --grab /dev/input/event2

on the appropriate file or link.

8
  • Sorry for the late reply, but when I run ls /dev/input/by-id the following devices are shown. usb-SIGMACHIP_Usb_Mouse-event-mouse@ usb-_USB_Keyboard-event-if01@ usb-Vimicro_corp._Lenovo_EasyCamera-event-if00@ usb-SIGMACHIP_Usb_Mouse-mouse@ usb-_USB_Keyboard-event-kbd@ If I disable kdb keyboard the external keyboard stops working, and when I try to disable the if01 nothing happens, and both keyboards work like magic. Jul 30, 2017 at 2:04
  • Sorry for the late reply, but Jul 30, 2017 at 2:09
  • Your other keyboard might be listed as /dev/input/by-path/platform*kbd.
    – meuh
    Jul 30, 2017 at 12:53
  • Nop, still does not work, Jul 31, 2017 at 3:39
  • sudo evtest --grab /dev/input/by-path/platform-i8042-serio-0-event-kbd does the trick for me. Apr 6, 2022 at 20:36
4

How to disable the keyboard with udev

This will allow you to disable the keyboard with udev rules, without a process running in the background all the time.

  1. Run sudo evtest. This will list the device and the name of all your input device. If the device is /dev/input/eventX, then your "device event number" is X. For example, my internal keyboard is listed as:

    /dev/input/event4:  AT Translated Set 2 keyboard
    

    So my "device event number" is 4.

  2. evtest asks you the "device event number". Type it in (in my case it is 4) and press ENTER. Make sure the events of the keyboard are captured, then close the process with CTRL+C

  3. Run

    udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/input/eventX)
    

    where /dev/input/eventX is the device found previously. This will list udev rules that match the device and its parent. See archlinux udev documentation for more details.

    In my case this lists:

    Udevadm info starts with the device specified by the devpath and then
    walks up the chain of parent devices. It prints for every device
    found, all possible attributes in the udev rules key format.
    A rule to match, can be composed by the attributes of the device
    and the attributes from one single parent device.
    
      looking at device '/devices/platform/i8042/serio0/input/input4/event4':
        KERNEL=="event4"
        SUBSYSTEM=="input"
        DRIVER==""
        ATTR{power/control}=="auto"
        ATTR{power/runtime_active_time}=="0"
        ATTR{power/runtime_status}=="unsupported"
        ATTR{power/runtime_suspended_time}=="0"
    
      looking at parent device '/devices/platform/i8042/serio0/input/input4':
        KERNELS=="input4"
        SUBSYSTEMS=="input"
        DRIVERS==""
        ATTRS{capabilities/abs}=="0"
        ATTRS{capabilities/ev}=="120013"
        ATTRS{capabilities/ff}=="0"
        ATTRS{capabilities/key}=="10000 c020000000000 0 0 700f02000003 3802078f870f401 febfffdfffefffff fffffffffffffffe"
        ATTRS{capabilities/led}=="7"
        ATTRS{capabilities/msc}=="10"
        ATTRS{capabilities/rel}=="0"
        ATTRS{capabilities/snd}=="0"
        ATTRS{capabilities/sw}=="0"
        ATTRS{id/bustype}=="0011"
        ATTRS{id/product}=="0001"
        ATTRS{id/vendor}=="0001"
        ATTRS{id/version}=="ab41"
        ATTRS{inhibited}=="0"
        ATTRS{name}=="AT Translated Set 2 keyboard"
        ATTRS{phys}=="isa0060/serio0/input0"
        ATTRS{power/control}=="auto"
        ATTRS{power/runtime_active_time}=="0"
        ATTRS{power/runtime_status}=="unsupported"
        ATTRS{power/runtime_suspended_time}=="0"
        ATTRS{properties}=="0"
        ATTRS{uniq}==""
    
      looking at parent device '/devices/platform/i8042/serio0':
        KERNELS=="serio0"
        SUBSYSTEMS=="serio"
        DRIVERS=="atkbd"
        ATTRS{bind_mode}=="auto"
        ATTRS{description}=="i8042 KBD port"
        ATTRS{drvctl}=="(write-only)"
        ATTRS{err_count}=="0"
        ATTRS{extra}=="0"
        ATTRS{firmware_id}=="PNP: PNP0303"
        ATTRS{force_release}=="369-370"
        ATTRS{id/extra}=="00"
        ATTRS{id/id}=="00"
        ATTRS{id/proto}=="00"
        ATTRS{id/type}=="06"
        ATTRS{power/control}=="auto"
        ATTRS{power/runtime_active_time}=="0"
        ATTRS{power/runtime_status}=="unsupported"
        ATTRS{power/runtime_suspended_time}=="0"
        ATTRS{power/wakeup}=="disabled"
        ATTRS{power/wakeup_abort_count}==""
        ATTRS{power/wakeup_active}==""
        ATTRS{power/wakeup_active_count}==""
        ATTRS{power/wakeup_count}==""
        ATTRS{power/wakeup_expire_count}==""
        ATTRS{power/wakeup_last_time_ms}==""
        ATTRS{power/wakeup_max_time_ms}==""
        ATTRS{power/wakeup_total_time_ms}==""
        ATTRS{scroll}=="0"
        ATTRS{set}=="2"
        ATTRS{softraw}=="1"
        ATTRS{softrepeat}=="0"
    
      looking at parent device '/devices/platform/i8042':
        KERNELS=="i8042"
        SUBSYSTEMS=="platform"
        DRIVERS=="i8042"
        ATTRS{driver_override}=="(null)"
        ATTRS{power/control}=="auto"
        ATTRS{power/runtime_active_time}=="0"
        ATTRS{power/runtime_status}=="unsupported"
        ATTRS{power/runtime_suspended_time}=="0"
    
      looking at parent device '/devices/platform':
        KERNELS=="platform"
        SUBSYSTEMS==""
        DRIVERS==""
        ATTRS{power/control}=="auto"
        ATTRS{power/runtime_active_time}=="0"
        ATTRS{power/runtime_status}=="unsupported"
        ATTRS{power/runtime_suspended_time}=="0"
    
  4. Build a udev rule that match you device and its parent, and that only. Make sure it is run last by naming it with a high number at the start.

    Once you matched the device, set its LIBINPUT_IGNORE_DEVICE option to anything other than 0 (for example, 1). See the libinput guide on ignoring specific devices for more details.

    For example, here is my /etc/udev/rules.d/99-ignore-my-device.rules:

    KERNELS=="input4", SUBSYSTEMS=="input", ATTRS{id/product}=="0001", ATTRS{id/vendor}=="0001", ATTRS{id/version}=="ab41", ENV{LIBINPUT_IGNORE_DEVICE}="1"
    
  5. Reboot your device. udev rules are applied only to newly connected devices, not to devices already connected.

Done!

0

I have the same problem. Wayland compositor creates an abstract for the keyboard so all client couldn't see the hardware keyboard. I tried as below and it works:

sudo libinput list-devices

In my case, in my case, it leads to /dev/input/event6. Then you can use evtest as meuh's answer.

2
  • BTW, you can also just run evtest, and it will list all event devices.
    – dirkt
    Aug 10, 2017 at 5:50
  • @dirkt evtest lists both the vendor ID and product ID of my integrated keyboard as 0x1 May 17, 2022 at 6:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .