Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Attempt to disable AlpsPS/2 ALPS DualPoint Stick as an input device (via udev)
# /etc/udev/rules.d/75-input.rules
# local udev rules for input devices
ACTION!="add|change", GOTO="input_end"
# ALPS DualPoint Stick: Ignore as input device
ENV{ID_BUS}=="i8042", ENV{NAME}=="AlpsPS/2 ALPS DualPoint Stick", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
LABEL="input_end"
@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 11, 2017

What this is meant to do is remove the AlpsPS/2 ALPS DualPoint Stick from the list of input devices by unsetting ID_INPUT (the equivalent of xinput disable <id> in X, but for a Wayland session). Evidently I'm doing something wrong, because I get this as a result after rebooting:

# udevadm info -q all /sys/devices/platform/i8042/serio1/input/input9
P: /devices/platform/i8042/serio1/input/input9
E: DEVPATH=/devices/platform/i8042/serio1/input/input9
E: EV=7
E: ID_BUS=i8042
E: ID_FOR_SEAT=input-platform-i8042-serio-1
E: ID_INPUT=1
E: ID_INPUT_MOUSE=1
E: ID_INPUT_POINTINGSTICK=1
E: ID_PATH=platform-i8042-serio-1
E: ID_PATH_TAG=platform-i8042-serio-1
E: KEY=70000 0 0 0 0
E: MODALIAS=input:b0011v0002p0008e0700-e0,1,2,k110,111,112,r0,1,amlsfw
E: NAME="AlpsPS/2 ALPS DualPoint Stick"
E: PHYS="isa0060/serio1/input1"
E: PRODUCT=11/2/8/700
E: PROP=21
E: REL=3
E: SUBSYSTEM=input
E: TAGS=:seat:
E: USEC_INITIALIZED=2998293

So either my udev rule is getting ignored, or it's being overwritten by something else.

@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 11, 2017

Platform info: Ubuntu zesty, kernel 4.10.0-30, systemd 232.

@whot

This comment has been minimized.

Copy link

whot commented Aug 12, 2017

I'm assuming the missing " at the end is a copy/paste error? Try udevadm test /sys/... and check the output, if there's a syntax error it should show up

@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 12, 2017

@whot Kudos for catching the missing ", but as you correctly assume it was a C&P error.

Here's my udevadm test output:

# udevadm test /sys/devices/platform/i8042/serio1/input/input9
calling: test
version 232
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          232
file size:         8801854 bytes
header size             80 bytes
strings            1856302 bytes
nodes              6945472 bytes
Load module index
Found container virtualization none
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
Reading rules file: /lib/udev/rules.d/39-usbmuxd.rules
Reading rules file: /lib/udev/rules.d/40-usb-media-players.rules
Reading rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
Reading rules file: /lib/udev/rules.d/40-vm-hotadd.rules
Reading rules file: /lib/udev/rules.d/50-firmware.rules
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
Reading rules file: /lib/udev/rules.d/55-dm.rules
Reading rules file: /lib/udev/rules.d/56-lvm.rules
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-bridge-network-interface.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-crda.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-gnupg2.rules
Reading rules file: /lib/udev/rules.d/60-inputattach.rules
Reading rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
Reading rules file: /lib/udev/rules.d/60-libsane.rules
Reading rules file: /lib/udev/rules.d/60-openobex.rules
Reading rules file: /lib/udev/rules.d/60-pcmcia.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-qemu-system-common.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/60-xdiagnose.rules
Reading rules file: /etc/udev/rules.d/60_smfpautoconf_samsung.rules
Reading rules file: /lib/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
Reading rules file: /lib/udev/rules.d/61-persistent-storage-android.rules
Reading rules file: /etc/udev/rules.d/61_smfpautoconf_samsung.rules
Reading rules file: /lib/udev/rules.d/64-btrfs-dm.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/64-xorg-xkb.rules
Reading rules file: /lib/udev/rules.d/65-libwacom.rules
Reading rules file: /lib/udev/rules.d/66-xorg-synaptics-quirks.rules
Reading rules file: /lib/udev/rules.d/69-cd-sensors.rules
Reading rules file: /lib/udev/rules.d/69-libmtp.rules
Reading rules file: /lib/udev/rules.d/69-lvm-metad.rules
Reading rules file: /lib/udev/rules.d/69-wacom.rules
Reading rules file: /lib/udev/rules.d/69-yubikey.rules
Reading rules file: /lib/udev/rules.d/70-android-tools-adb.rules
Reading rules file: /lib/udev/rules.d/70-android-tools-fastboot.rules
Reading rules file: /lib/udev/rules.d/70-debian-uaccess.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /etc/udev/rules.d/70-persistent-net.rules
Reading rules file: /lib/udev/rules.d/70-power-switch.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/70-uaccess.rules
Reading rules file: /lib/udev/rules.d/70-udev-acl.rules
Reading rules file: /lib/udev/rules.d/71-power-switch-proliant.rules
Reading rules file: /lib/udev/rules.d/71-seat.rules
Reading rules file: /lib/udev/rules.d/71-u-d-c-gpu-detection.rules
Reading rules file: /lib/udev/rules.d/73-seat-late.rules
Reading rules file: /lib/udev/rules.d/73-special-net-names.rules
Reading rules file: /lib/udev/rules.d/73-usb-net-by-mac.rules
Reading rules file: /etc/udev/rules.d/75-input.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/77-mm-cinterion-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-dell-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-ericsson-mbm.rules
Reading rules file: /lib/udev/rules.d/77-mm-haier-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-huawei-net-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-longcheer-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-mtk-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-nokia-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
Reading rules file: /lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
Reading rules file: /lib/udev/rules.d/77-mm-qdl-device-blacklist.rules
Reading rules file: /lib/udev/rules.d/77-mm-simtech-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-telit-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
Reading rules file: /lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
Reading rules file: /lib/udev/rules.d/77-mm-x22x-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-zte-port-types.rules
Reading rules file: /lib/udev/rules.d/78-graphics-card.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-debian-compat.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-ifupdown.rules
Reading rules file: /lib/udev/rules.d/80-iio-sensor-proxy.rules
Reading rules file: /lib/udev/rules.d/80-libinput-device-groups.rules
Reading rules file: /lib/udev/rules.d/80-mm-candidate.rules
Reading rules file: /lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /lib/udev/rules.d/80-udisks2.rules
Reading rules file: /lib/udev/rules.d/84-nm-drivers.rules
Reading rules file: /lib/udev/rules.d/85-brltty.rules
Reading rules file: /lib/udev/rules.d/85-hdparm.rules
Reading rules file: /lib/udev/rules.d/85-keyboard-configuration.rules
Reading rules file: /lib/udev/rules.d/85-nm-unmanaged.rules
Reading rules file: /lib/udev/rules.d/85-regulatory.rules
Reading rules file: /lib/udev/rules.d/90-alsa-restore.rules
Reading rules file: /lib/udev/rules.d/90-console-setup.rules
Reading rules file: /lib/udev/rules.d/90-libinput-model-quirks.rules
Reading rules file: /lib/udev/rules.d/90-pulseaudio.rules
Reading rules file: /lib/udev/rules.d/92-libccid.rules
Reading rules file: /lib/udev/rules.d/95-cd-devices.rules
Reading rules file: /lib/udev/rules.d/95-kpartx.rules
Reading rules file: /lib/udev/rules.d/95-upower-csr.rules
Reading rules file: /lib/udev/rules.d/95-upower-hid.rules
Reading rules file: /lib/udev/rules.d/95-upower-wup.rules
Reading rules file: /lib/udev/rules.d/97-hid2hci.rules
Reading rules file: /etc/udev/rules.d/99-libsane-samsungmfp.rules
Reading rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 38547 bytes strings
28540 strings (236992 bytes), 24728 de-duplicated (202258 bytes), 3813 trie nodes used
value '[dmi/id]sys_vendor' is 'TOSHIBA'
value '[dmi/id]sys_vendor' is 'TOSHIBA'
IMPORT builtin 'input_id' /lib/udev/rules.d/50-udev-default.rules:14
capabilities/ev raw kernel attribute: 7
capabilities/abs raw kernel attribute: 0
capabilities/rel raw kernel attribute: 3
capabilities/key raw kernel attribute: 70000 0 0 0 0
properties raw kernel attribute: 21
test_key: checking bit block 0 for any keys; found=0
test_key: checking bit block 64 for any keys; found=0
test_key: checking bit block 128 for any keys; found=0
test_key: checking bit block 192 for any keys; found=0
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:15
IMPORT builtin 'hwdb' returned non-zero
IMPORT builtin 'path_id' /lib/udev/rules.d/71-seat.rules:49
RUN 'kmod load $env{MODALIAS}' /lib/udev/rules.d/80-drivers.rules:5
created db file '/run/udev/data/+input:input9' for '/devices/platform/i8042/serio1/input/input9'
ACTION=add
DEVPATH=/devices/platform/i8042/serio1/input/input9
EV=7
ID_BUS=i8042
ID_FOR_SEAT=input-platform-i8042-serio-1
ID_INPUT=1
ID_INPUT_MOUSE=1
ID_INPUT_POINTINGSTICK=1
ID_PATH=platform-i8042-serio-1
ID_PATH_TAG=platform-i8042-serio-1
KEY=70000 0 0 0 0
MODALIAS=input:b0011v0002p0008e0700-e0,1,2,k110,111,112,r0,1,amlsfw
NAME="AlpsPS/2 ALPS DualPoint Stick"
PHYS="isa0060/serio1/input1"
PRODUCT=11/2/8/700
PROP=21
REL=3
SUBSYSTEM=input
TAGS=:seat:
USEC_INITIALIZED=3000989
run: 'kmod load input:b0011v0002p0008e0700-e0,1,2,k110,111,112,r0,1,amlsfw'
Unload module index
Unloaded link configuration context.

Looks like the rules file in /etc is being picked up, but the ID_* variables just aren't applied correctly.

@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 12, 2017

Aaaargh. Looks like it's choking on the / in ENV{NAME}.

Now using this line, and the rules get properly applied.

ENV{ID_BUS}=="i8042", ENV{NAME}=="*ALPS DualPoint Stick*", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 12, 2017

... but the original purpose isn't served; Wayland still considers the stick a working input device.

@whot

This comment has been minimized.

Copy link

whot commented Aug 13, 2017

You rebooted after applying everything? Just running udevadm test doesn't actually apply it, you still need to get libinput to pick it up again. libinput list-devices would help too to check if libinput still picks it up.

@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 13, 2017

@whot sure, rebooted several times. This my udevadm info:

$ sudo udevadm info -q all /sys/devices/platform/i8042/serio1/input/input9
P: /devices/platform/i8042/serio1/input/input9
E: DEVPATH=/devices/platform/i8042/serio1/input/input9
E: EV=7
E: ID_BUS=i8042
E: ID_FOR_SEAT=input-platform-i8042-serio-1
E: ID_PATH=platform-i8042-serio-1
E: ID_PATH_TAG=platform-i8042-serio-1
E: KEY=70000 0 0 0 0
E: MODALIAS=input:b0011v0002p0008e0700-e0,1,2,k110,111,112,r0,1,amlsfw
E: NAME="AlpsPS/2 ALPS DualPoint Stick"
E: PHYS="isa0060/serio1/input1"
E: PRODUCT=11/2/8/700
E: PROP=21
E: REL=3
E: SUBSYSTEM=input
E: TAGS=:seat:
E: USEC_INITIALIZED=3014396

And here's libinput-list-devices for comparison:

$ sudo libinput-list-devices 
[...]
Device:           AlpsPS/2 ALPS DualPoint Stick
Kernel:           /dev/input/event6
Group:            9
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a
[...]
@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 13, 2017

If it's of interest, here is my list of installed and available libinput-related packages:

$ apt search libinput
Sorting... Done
Full Text Search... Done
consolation/zesty 0.0.4-1 amd64
  linux console pointer support for copy-paste

libinput-bin/zesty,now 1.6.3-1ubuntu1 amd64 [installed]
  input device management and event handling library - udev quirks

libinput-dev/zesty 1.6.3-1ubuntu1 amd64
  input device management and event handling library - development files

libinput-pad-dev/zesty 1.0.3-1 amd64
  On-screen Input Pad to Send Characters with Mouse - dev

libinput-pad-xtest/zesty 1.0.3-1 amd64
  On-screen Input Pad to Send Characters with Mouse - xtest

libinput-pad1/zesty 1.0.3-1 amd64
  On-screen Input Pad to Send Characters with Mouse - libs

libinput-tools/zesty,now 1.6.3-1ubuntu1 amd64 [installed]
  input device management and event handling library - command line tools

libinput10/zesty,now 1.6.3-1ubuntu1 amd64 [installed]
  input device management and event handling library - shared library

libinput7/now 0.10.0-1 amd64 [installed,local]
  input device management and event handling library - shared library

xserver-xorg-input-libinput/zesty,now 0.25.0-0ubuntu1 amd64 [installed,automatic]
  X.Org X server -- libinput input driver

xserver-xorg-input-libinput-dev/zesty,zesty 0.25.0-0ubuntu1 all
  X.Org X server -- libinput input driver (development headers)
@whot

This comment has been minimized.

Copy link

whot commented Aug 15, 2017

ok, the problem is that libinput checks the hierarchy for those tags, starting with the event node. I suspect with your rule the tag is still set on the event node, because that node doesnt have NAME or ID_BUS. Try
ATTRS{name}=="*ALPS DualPoint Stick", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}="" instead. There's no ENVS in udev so we have to look at the raw attributes instead. You can check for ATTRS{id/bustype}=="0011" too but the name check only allows for one device anyway, so what's the point :)

@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 16, 2017

@whot Matching on just ATTRS{name} doesn't apply the udev rule at all. I changed it to ATTR{name}, because that is what udevadm info -a suggests, and that does unset the ID_* variables, but still doesn't appear to hide the device from libinput.

udev rules:

$ sudo cat /etc/udev/rules.d/75-input.rules
# local udev rules for input devices

ACTION!="add|change", GOTO="input_end"

# ALPS DualPoint Stick: Ignore as input device
ATTR{NAME}=="*ALPS DualPoint Stick*", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""

LABEL="input_end"

udevadm info after reboot:

$ sudo udevadm info -q all /sys/devices/platform/i8042/serio1/input/input8
P: /devices/platform/i8042/serio1/input/input8
E: DEVPATH=/devices/platform/i8042/serio1/input/input8
E: EV=7
E: ID_BUS=i8042
E: ID_FOR_SEAT=input-platform-i8042-serio-1
E: ID_PATH=platform-i8042-serio-1
E: ID_PATH_TAG=platform-i8042-serio-1
E: KEY=70000 0 0 0 0
E: MODALIAS=input:b0011v0002p0008e0700-e0,1,2,k110,111,112,r0,1,amlsfw
E: NAME="AlpsPS/2 ALPS DualPoint Stick"
E: PHYS="isa0060/serio1/input1"
E: PRODUCT=11/2/8/700
E: PROP=21
E: REL=3
E: SUBSYSTEM=input
E: TAGS=:seat:
E: USEC_INITIALIZED=3008571

libinput-list-devices:

Device:           AlpsPS/2 ALPS DualPoint Stick
Kernel:           /dev/input/event5
Group:            6
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

And of course, the stick does remain enabled in a Wayland session.

@whot

This comment has been minimized.

Copy link

whot commented Aug 16, 2017

Note that there's a difference between ATTR and ATTRS - the former cannot work because it'll never match the event node. But that's the device we care about. ATTRS is supposed to search upwards from the current device, so it should have worked. Not sure what's going on there.

The device you need to run udevadm against is /sys/class/input/eventX - whichever is the event node (event5 in the above output), not the input node.

@fghaas

This comment has been minimized.

Copy link
Owner Author

fghaas commented Aug 17, 2017

@whot OK, I have no idea what I did differently this time, but I changed my udev rule back to matching on ATTRS{name} again, and now things appear to be working. The stick pointer seems to have been permanently disabled and is now off, including in a Wayland session. Thanks for the help!

@msjyoo

This comment has been minimized.

Copy link

msjyoo commented Apr 11, 2018

Hello, thanks for the script! This technique also works with hwdb like so:

# /etc/udev/hwdb.d/98-latitude-trackpoint-disable.hwdb
# Dell Latitude E7470
# AlpsPS/2 ALPS DualPoint Stick
# udevadm info -a -q all /sys/devices/platform/i8042/serio1/input/input3
evdev:input:b0011v0002p0008e0800-e0,1,2,3,k110,111,112,r0,1,a18,mlsfw
 ID_INPUT=0
 ID_INPUT_MOUSE=0
 ID_INPUT_POINTINGSTICK=0

Afterwards run below to update the hwdb database and reload.

systemd-hwdb update
udevadm trigger
@psarraf

This comment has been minimized.

Copy link

psarraf commented May 10, 2018

The following udev rule worked for me. You can use wildcards in the device name. The rule is case sensitive, i.e., ATTRS{name} works but ATTRS{NAME} does not.

# ALPS DualPoint Stick: Ignore as input device
ATTRS{name}=="*DualPoint Stick", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.