Skip to content

Instantly share code, notes, and snippets.

@fghaas
Last active May 10, 2018 16:55
Show Gist options
  • Save fghaas/3406be59095de212182f1803a503a64b to your computer and use it in GitHub Desktop.
Save fghaas/3406be59095de212182f1803a503a64b to your computer and use it in GitHub Desktop.
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"
@whot
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
Copy link
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
Copy link
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
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
Copy link
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
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
Copy link
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
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
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