I have the following script to define the button mappings of my Wacom Intuos S 2:
/usr/local/bin/wacom_intuos_s_2_pad_button_mapping.sh
#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/scriptim/.Xauthority
/usr/bin/sleep 1 # wait for device to be ready
/usr/bin/xsetwacom set 'Wacom Intuos S 2 Pad pad' Button 1 'key -'
/usr/bin/xsetwacom set 'Wacom Intuos S 2 Pad pad' Button 3 'key +'
/usr/bin/xsetwacom set 'Wacom Intuos S 2 Pad pad' Button 8 'key +Ctrl z -Ctrl'
/usr/bin/xsetwacom set 'Wacom Intuos S 2 Pad pad' Button 9 'key +Ctrl +Shift z -Ctrl -Shift'
This script works fine if I run it manually.
My goal is to run this script automatically whenever the pad is plugged in. I tried that with the following udev
rule:
/etc/udev/rules.d/10-wacom_intuos_s_2_pad.rules
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="056a", ATTRS{idProduct}=="033b", RUN+="/usr/local/bin/wacom_intuos_s_2_pad_button_mapping.sh"
However, the script does not map the buttons if I plug in the pad.
Im running Arch Linux (5.5.10-arch1-1
)
$ lsusb
...
Bus 004 Device 015: ID 056a:033b Wacom Co., Ltd CTL-490 [Intuos Draw (S)]
...
$ udevadm info -a -n hidraw0
...
looking at parent device '/devices/pci0000:00/0000:00:10.0/usb4/4-2':
KERNELS=="4-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{bcdDevice}=="0100"
ATTRS{bmAttributes}=="80"
ATTRS{bMaxPower}=="498mA"
ATTRS{manufacturer}=="Wacom Co.,Ltd."
ATTRS{quirks}=="0x0"
ATTRS{maxchild}=="0"
ATTRS{bNumInterfaces}==" 3"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{devpath}=="2"
ATTRS{ltm_capable}=="no"
ATTRS{busnum}=="4"
ATTRS{devnum}=="15"
ATTRS{tx_lanes}=="1"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{speed}=="12"
ATTRS{version}==" 2.00"
ATTRS{product}=="Intuos PS"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{idVendor}=="056a"
ATTRS{configuration}==""
ATTRS{devspec}=="(null)"
ATTRS{urbnum}=="174"
ATTRS{bConfigurationValue}=="1"
ATTRS{removable}=="unknown"
ATTRS{rx_lanes}=="1"
ATTRS{idProduct}=="033b"
...
$ udevadm test --action="add" /devices/pci0000:00/0000:00:10.0/usb4/4-2
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.
Load module index
Parsed configuration file /usr/lib/systemd/network/99-default.link
Created link configuration context.
Reading rules file: /usr/lib/udev/rules.d/10-dm.rules
Reading rules file: /etc/udev/rules.d/10-wacom_intuos_s_2_pad.rules
...
Reading rules file: /usr/lib/udev/rules.d/65-libwacom.rules
...
Reading rules file: /usr/lib/udev/rules.d/wacom.rules
Invalid inotify descriptor.
DEVPATH=/devices/pci0000:00/0000:00:10.0/usb4/4-2
DEVNAME=/dev/bus/usb/004/015
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=56a/33b/100
TYPE=0/0/0
BUSNUM=004
DEVNUM=015
MAJOR=189
MINOR=398
ACTION=add
SUBSYSTEM=usb
ID_VENDOR=Wacom_Co._Ltd.
ID_VENDOR_ENC=Wacom\x20Co.\x2cLtd.
ID_VENDOR_ID=056a
ID_MODEL=Intuos_PS
ID_MODEL_ENC=Intuos\x20PS
ID_MODEL_ID=033b
ID_REVISION=0100
ID_SERIAL=Wacom_Co._Ltd._Intuos_PS
ID_BUS=usb
ID_USB_INTERFACES=:030000:030102:
ID_VENDOR_FROM_DATABASE=Wacom Co., Ltd
ID_MODEL_FROM_DATABASE=CTL-490 [Intuos Draw (S)]
ID_PATH=pci-0000:00:10.0-usb-0:2
ID_PATH_TAG=pci-0000_00_10_0-usb-0_2
USEC_INITIALIZED=4102997566
run: '/usr/local/bin/wacom_intuos_s_2_pad_button_mapping.sh'
Unload module index
Unloaded link configuration context.
$ journalctl -xe
Mar 22 17:38:55 scriptim systemd-udevd[5927]: 1-1: Process '/usr/local/bin/wacom_intuos_s_2_pad_button_mapping.sh' failed with exit code 255.
chmod +x
) ? – Kate Mar 22 '20 at 15:13xf86-input-wacom
driver. – Kate Mar 22 '20 at 15:46printf 'from udev: PATH=%s\n' "$PATH" > /dev/kmsg; /usr/bin/env > /tmp/udev
. If the script runs, it will show the$PATH
in the kernel log and write the environment to/tmp/udev
. – Nathaniel M. Beaver Mar 26 '20 at 20:13$PATH
for the environment of the udev rule? Based on thejournalctl -xe
output it looks like the script is running, it's just exiting with a failure code. – Nathaniel M. Beaver Mar 27 '20 at 02:18exit 17
or similar at the end and see if the exit code changes. – Nathaniel M. Beaver Mar 27 '20 at 02:29exit 17
at the end. – Scriptim Mar 27 '20 at 11:43$DISPLAY
is set. See what happens when it's not set:unset DISPLAY; xsetwacom set 'Wacom Intuos S 2 Pad pad' Button 1 'key -'
– Arkadiusz Drabczyk Mar 27 '20 at 13:02$?
, it's 255, so it might be it. – Arkadiusz Drabczyk Mar 27 '20 at 13:10DISPLAY
. However, when I setDISPLAY
(andXAUTHORITY
), there is no error message in the journal anymore, but the buttons still don't work. – Scriptim Mar 27 '20 at 16:31$?
after eachxsetwacom
, the script is running in the background of course so try something likeecho $? >> /tmp/XWACOM_RESULTS
– Arkadiusz Drabczyk Mar 27 '20 at 17:13unset DISPLAY; /usr/local/bin/wacom_intuos_s_2_pad_button_mapping.sh
– Arkadiusz Drabczyk Mar 27 '20 at 17:14xsetwacom
command (so four times) as you advised. After plugging in the Pad, the file contains 64 lines with0
. The buttons still don't work, though. – Scriptim Mar 30 '20 at 17:44