![Udev 未运行脚本](https://linux22.com/image/1048290/Udev%20%E6%9C%AA%E8%BF%90%E8%A1%8C%E8%84%9A%E6%9C%AC.png)
我试图让 udev 在连接/断开外接鼠标时禁用/启用触摸板。我不知道哪里出了问题。当我调用它时,udevadm --test
它似乎在调用我的脚本,但是当我连接/断开鼠标时什么也没有发生。这是我的规则(放置在 /etc/udev/rules.d/99-touchpad.rules 中 - 也尝试了 01,但没有效果):
#/etc/udev/rules.d/01-touchpad.rules
ACTION=="add", SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0745", ENV{REMOVE_CMD}="/opt/toggle_touch.sh 1", RUN+="/opt/toggle_touch.sh 0"
我已经运行了 idProduct 和 idVendor udevadm monitor --property
。这是我的脚本:
#!/bin/sh
export DISPLAY=":0"
xinput set-prop "DLL063E:00 06CB:2934" "Device Enabled" $1
当我手动运行脚本时,它可以工作。我可以使用脚本禁用和启用触摸板,但 udev 不会调用它。以下是我的测试输出:
udevadm test --action=add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.2/input/input31
calling: test
version 204
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: 204
file size: 5771867 bytes
header size 80 bytes
strings 1271203 bytes
nodes 4500584 bytes
load module index
read rules file: /lib/udev/rules.d/40-crda.rules
read rules file: /lib/udev/rules.d/40-gnupg.rules
read rules file: /lib/udev/rules.d/40-hyperv-hotadd.rules
read rules file: /lib/udev/rules.d/40-inputattach.rules
read rules file: /lib/udev/rules.d/40-libgphoto2-6.rules
GOTO 'libgphoto2_usb_end' has no matching label in: '/lib/udev/rules.d/40-libgphoto2-6.rules'
read rules file: /lib/udev/rules.d/40-libsane.rules
read rules file: /lib/udev/rules.d/40-usb-media-players.rules
read rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
read rules file: /lib/udev/rules.d/40-virtualbox-guest-dkms.rules
read rules file: /lib/udev/rules.d/42-usb-hid-pm.rules
read rules file: /lib/udev/rules.d/50-firmware.rules
read rules file: /lib/udev/rules.d/50-udev-default.rules
read rules file: /lib/udev/rules.d/55-dm.rules
read rules file: /lib/udev/rules.d/56-hpmud.rules
read rules file: /lib/udev/rules.d/56-lvm.rules
read rules file: /lib/udev/rules.d/60-cdrom_id.rules
read rules file: /lib/udev/rules.d/60-keyboard.rules
read rules file: /lib/udev/rules.d/60-pcmcia.rules
read rules file: /lib/udev/rules.d/60-persistent-alsa.rules
read rules file: /lib/udev/rules.d/60-persistent-input.rules
read rules file: /lib/udev/rules.d/60-persistent-serial.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
read rules file: /lib/udev/rules.d/60-persistent-storage.rules
read rules file: /lib/udev/rules.d/60-persistent-v4l.rules
read rules file: /lib/udev/rules.d/61-accelerometer.rules
read rules file: /lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules
read rules file: /lib/udev/rules.d/64-btrfs.rules
read rules file: /lib/udev/rules.d/64-xorg-xkb.rules
read rules file: /lib/udev/rules.d/66-xorg-synaptics-quirks.rules
read rules file: /lib/udev/rules.d/69-cd-sensors.rules
IMPORT found builtin 'usb_id --export %p', replacing /lib/udev/rules.d/69-cd-sensors.rules:89
read rules file: /lib/udev/rules.d/69-libmtp.rules
read rules file: /lib/udev/rules.d/69-xorg-vmmouse.rules
read rules file: /lib/udev/rules.d/69-xserver-xorg-input-wacom.rules
read rules file: /etc/udev/rules.d/70-persistent-net.rules
read rules file: /lib/udev/rules.d/70-power-switch.rules
read rules file: /lib/udev/rules.d/70-printers.rules
read rules file: /lib/udev/rules.d/70-uaccess.rules
read rules file: /lib/udev/rules.d/71-seat.rules
read rules file: /lib/udev/rules.d/73-idrac.rules
read rules file: /lib/udev/rules.d/73-seat-late.rules
read rules file: /lib/udev/rules.d/75-net-description.rules
read rules file: /lib/udev/rules.d/75-persistent-net-generator.rules
read rules file: /lib/udev/rules.d/75-probe_mtd.rules
read rules file: /lib/udev/rules.d/75-tty-description.rules
read rules file: /lib/udev/rules.d/77-mm-ericsson-mbm.rules
read rules file: /lib/udev/rules.d/77-mm-huawei-net-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-longcheer-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-nokia-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
read rules file: /lib/udev/rules.d/77-mm-qdl-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-simtech-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
read rules file: /lib/udev/rules.d/77-mm-x22x-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-zte-port-types.rules
read rules file: /lib/udev/rules.d/77-nm-olpc-mesh.rules
read rules file: /lib/udev/rules.d/78-graphics-card.rules
read rules file: /lib/udev/rules.d/78-sound-card.rules
read rules file: /lib/udev/rules.d/80-drivers.rules
read rules file: /lib/udev/rules.d/80-mm-candidate.rules
read rules file: /lib/udev/rules.d/80-udisks.rules
read rules file: /lib/udev/rules.d/80-udisks2.rules
read rules file: /lib/udev/rules.d/85-brltty.rules
read rules file: /lib/udev/rules.d/85-hdparm.rules
read rules file: /lib/udev/rules.d/85-hplj10xx.rules
read rules file: /lib/udev/rules.d/85-keyboard-configuration.rules
read rules file: /lib/udev/rules.d/85-lvm2.rules
read rules file: /lib/udev/rules.d/85-regulatory.rules
read rules file: /lib/udev/rules.d/85-usbmuxd.rules
read rules file: /lib/udev/rules.d/90-alsa-restore.rules
read rules file: /lib/udev/rules.d/90-alsa-ucm.rules
read rules file: /lib/udev/rules.d/90-libgpod.rules
read rules file: /lib/udev/rules.d/90-pulseaudio.rules
read rules file: /lib/udev/rules.d/95-cd-devices.rules
read rules file: /lib/udev/rules.d/95-kpartx.rules
read rules file: /lib/udev/rules.d/95-udev-late.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-dell.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-fujitsu.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-gateway.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-ibm.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-lenovo.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-toshiba.rules
read rules file: /lib/udev/rules.d/95-upower-csr.rules
read rules file: /lib/udev/rules.d/95-upower-hid.rules
read rules file: /lib/udev/rules.d/95-upower-wup.rules
read rules file: /lib/udev/rules.d/97-bluetooth-hid2hci.rules
read rules file: /lib/udev/rules.d/97-dmraid.rules
read rules file: /lib/udev/rules.d/99-steam-controller-perms.rules
read rules file: /etc/udev/rules.d/99-touchpad.rules
rules contain 196608 bytes tokens (16384 * 12 bytes), 36170 bytes strings
19226 strings (170160 bytes), 16030 de-duplicated (137187 bytes), 3197 trie nodes used
IMPORT builtin 'usb_id' /lib/udev/rules.d/40-libgphoto2-6.rules:3
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.2: if_class 3 protocol 0
IMPORT builtin 'input_id' /lib/udev/rules.d/50-udev-default.rules:10
capabilities/ev raw kernel attribute: 10001f
capabilities/abs raw kernel attribute: ffffff01000701ff
capabilities/rel raw kernel attribute: 40
capabilities/key raw kernel attribute: 4c37fff072ff32d bf54445600000000 c00000000000001 30f908b17c007 ffff7bfad951dfff febeffdfffefffff fffffffffffffffe
test_key: checking bit block 0 for any keys; found=1
test_key: checking bit block 64 for any keys; found=1
test_key: checking bit block 128 for any keys; found=1
test_key: checking bit block 192 for any keys; found=1
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:11
IMPORT builtin 'hwdb' returned non-zero
IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-input.rules:31
RUN 'kmod load $env{MODALIAS}' /lib/udev/rules.d/80-drivers.rules:5
RUN '/opt/toggle_touch.sh 0' /etc/udev/rules.d/99-touchpad.rules:2
unable to create temporary db file '/run/udev/data/+input:input31.tmp': Permission denied
.INPUT_CLASS=kbd
ABS=ffffff01000701ff
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.2/input/input31
EV=10001f
ID_BUS=usb
ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_2_1_2
ID_INPUT=1
ID_INPUT_KEY=1
ID_INPUT_KEYBOARD=1
ID_MODEL=Microsoft®_Nano_Transceiver_v2.0
ID_MODEL_ENC=Microsoft®\x20Nano\x20Transceiver\x20v2.0
ID_MODEL_ID=0745
ID_PATH=pci-0000:00:14.0-usb-0:2:1.2
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_2
ID_REVISION=0634
ID_SERIAL=Microsoft_Microsoft®_Nano_Transceiver_v2.0
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030101:030102:030000:
ID_USB_INTERFACE_NUM=02
ID_VENDOR=Microsoft
ID_VENDOR_ENC=Microsoft
ID_VENDOR_ID=045e
KEY=4c37fff072ff32d bf54445600000000 c00000000000001 30f908b17c007 ffff7bfad951dfff febeffdfffefffff fffffffffffffffe
MODALIAS=input:b0003v045Ep0745e0111-e0,1,2,3,4,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,8B,8C,8E,8F,90,94,96,98,9B,9C,9E,9F,A1,A3,A4,A5,A6,A7,A8,A9,AB,AC,AD,AE,B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,CE,CF,D0,D1,D2,D4,D8,D9,DB,DF,E4,E7,E8,E9,EA,EB,F0,F1,100,13A,13B,161,162,164,166,16A,16E,172,174,176,178,179,17A,17B,17C,17D,17F,180,182,183,185,188,189,18C,18D,18E,18F,190,191,192,193,195,198,199,19A,1A0,1A1,1A2,1A3,1A4,1A5,1A6,1A7,1A8,1A9,1AA,1AB,1AC,1AD,1AE,1B0,1B1,1B6,1B7,1BA,r6,a0,1,2,3,4,5,6,7,8,10,11,12,20,28,29,2A,2B,2C,2D,2E,2F,30,31,32,33,34,35,36,37,38,39,3A,3B,3C,3D,3E,m4,lsfw
MSC=10
NAME="Microsoft Microsoft® Nano Transceiver v2.0"
PHYS="usb-0000:00:14.0-2/input2"
PRODUCT=3/45e/745/111
PROP=0
REL=40
REMOVE_CMD=/opt/toggle_touch.sh 1
SUBSYSTEM=input
TAGS=:seat:
UNIQ=""
USEC_INITIALIZED=2029304924
run: 'kmod load input:b0003v045Ep0745e0111-e0,1,2,3,4,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,8B,8C,8E,8F,90,94,96,98,9B,9C,9E,9F,A1,A3,A4,A5,A6,A7,A8,A9,AB,AC,AD,AE,B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,CE,CF,D0,D1,D2,D4,D8,D9,DB,DF,E4,E7,E8,E9,EA,EB,F0,F1,100,13A,13B,161,162,164,166,16A,16E,172,174,176,178,179,17A,17B,17C,17D,17F,180,182,183,185,188,189,18C,18D,18E,18F,190,191,192,193,195,198,199,19A,1A0,1A1,1A2,1A3,1A4,1A5,1A6,1A7,1A8,1A9,1AA,1AB,1AC,1AD,1AE,1B0,1B1,1B6,1B7,1BA,r6,a0,1,2,3,4,5,6,7,8,10,11,12,20,28,29,2A,2B,2C,2D,2E,2F,30,31,32,33,34,35,36,37,38,39,3A,3B,3C,3D,3E,m4,lsfw'
run: '/opt/toggle_touch.sh 0'
unload module index
并删除:
udevadm test --action=remove /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.2/input/input31
calling: test
version 204
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: 204
file size: 5771867 bytes
header size 80 bytes
strings 1271203 bytes
nodes 4500584 bytes
load module index
read rules file: /lib/udev/rules.d/40-crda.rules
read rules file: /lib/udev/rules.d/40-gnupg.rules
read rules file: /lib/udev/rules.d/40-hyperv-hotadd.rules
read rules file: /lib/udev/rules.d/40-inputattach.rules
read rules file: /lib/udev/rules.d/40-libgphoto2-6.rules
GOTO 'libgphoto2_usb_end' has no matching label in: '/lib/udev/rules.d/40-libgphoto2-6.rules'
read rules file: /lib/udev/rules.d/40-libsane.rules
read rules file: /lib/udev/rules.d/40-usb-media-players.rules
read rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
read rules file: /lib/udev/rules.d/40-virtualbox-guest-dkms.rules
read rules file: /lib/udev/rules.d/42-usb-hid-pm.rules
read rules file: /lib/udev/rules.d/50-firmware.rules
read rules file: /lib/udev/rules.d/50-udev-default.rules
read rules file: /lib/udev/rules.d/55-dm.rules
read rules file: /lib/udev/rules.d/56-hpmud.rules
read rules file: /lib/udev/rules.d/56-lvm.rules
read rules file: /lib/udev/rules.d/60-cdrom_id.rules
read rules file: /lib/udev/rules.d/60-keyboard.rules
read rules file: /lib/udev/rules.d/60-pcmcia.rules
read rules file: /lib/udev/rules.d/60-persistent-alsa.rules
read rules file: /lib/udev/rules.d/60-persistent-input.rules
read rules file: /lib/udev/rules.d/60-persistent-serial.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
read rules file: /lib/udev/rules.d/60-persistent-storage.rules
read rules file: /lib/udev/rules.d/60-persistent-v4l.rules
read rules file: /lib/udev/rules.d/61-accelerometer.rules
read rules file: /lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules
read rules file: /lib/udev/rules.d/64-btrfs.rules
read rules file: /lib/udev/rules.d/64-xorg-xkb.rules
read rules file: /lib/udev/rules.d/66-xorg-synaptics-quirks.rules
read rules file: /lib/udev/rules.d/69-cd-sensors.rules
IMPORT found builtin 'usb_id --export %p', replacing /lib/udev/rules.d/69-cd-sensors.rules:89
read rules file: /lib/udev/rules.d/69-libmtp.rules
read rules file: /lib/udev/rules.d/69-xorg-vmmouse.rules
read rules file: /lib/udev/rules.d/69-xserver-xorg-input-wacom.rules
read rules file: /etc/udev/rules.d/70-persistent-net.rules
read rules file: /lib/udev/rules.d/70-power-switch.rules
read rules file: /lib/udev/rules.d/70-printers.rules
read rules file: /lib/udev/rules.d/70-uaccess.rules
read rules file: /lib/udev/rules.d/71-seat.rules
read rules file: /lib/udev/rules.d/73-idrac.rules
read rules file: /lib/udev/rules.d/73-seat-late.rules
read rules file: /lib/udev/rules.d/75-net-description.rules
read rules file: /lib/udev/rules.d/75-persistent-net-generator.rules
read rules file: /lib/udev/rules.d/75-probe_mtd.rules
read rules file: /lib/udev/rules.d/75-tty-description.rules
read rules file: /lib/udev/rules.d/77-mm-ericsson-mbm.rules
read rules file: /lib/udev/rules.d/77-mm-huawei-net-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-longcheer-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-nokia-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
read rules file: /lib/udev/rules.d/77-mm-qdl-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-simtech-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
read rules file: /lib/udev/rules.d/77-mm-x22x-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-zte-port-types.rules
read rules file: /lib/udev/rules.d/77-nm-olpc-mesh.rules
read rules file: /lib/udev/rules.d/78-graphics-card.rules
read rules file: /lib/udev/rules.d/78-sound-card.rules
read rules file: /lib/udev/rules.d/80-drivers.rules
read rules file: /lib/udev/rules.d/80-mm-candidate.rules
read rules file: /lib/udev/rules.d/80-udisks.rules
read rules file: /lib/udev/rules.d/80-udisks2.rules
read rules file: /lib/udev/rules.d/85-brltty.rules
read rules file: /lib/udev/rules.d/85-hdparm.rules
read rules file: /lib/udev/rules.d/85-hplj10xx.rules
read rules file: /lib/udev/rules.d/85-keyboard-configuration.rules
read rules file: /lib/udev/rules.d/85-lvm2.rules
read rules file: /lib/udev/rules.d/85-regulatory.rules
read rules file: /lib/udev/rules.d/85-usbmuxd.rules
read rules file: /lib/udev/rules.d/90-alsa-restore.rules
read rules file: /lib/udev/rules.d/90-alsa-ucm.rules
read rules file: /lib/udev/rules.d/90-libgpod.rules
read rules file: /lib/udev/rules.d/90-pulseaudio.rules
read rules file: /lib/udev/rules.d/95-cd-devices.rules
read rules file: /lib/udev/rules.d/95-kpartx.rules
read rules file: /lib/udev/rules.d/95-udev-late.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-dell.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-fujitsu.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-gateway.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-ibm.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-lenovo.rules
read rules file: /lib/udev/rules.d/95-upower-battery-recall-toshiba.rules
read rules file: /lib/udev/rules.d/95-upower-csr.rules
read rules file: /lib/udev/rules.d/95-upower-hid.rules
read rules file: /lib/udev/rules.d/95-upower-wup.rules
read rules file: /lib/udev/rules.d/97-bluetooth-hid2hci.rules
read rules file: /lib/udev/rules.d/97-dmraid.rules
read rules file: /lib/udev/rules.d/99-steam-controller-perms.rules
read rules file: /etc/udev/rules.d/99-touchpad.rules
rules contain 196608 bytes tokens (16384 * 12 bytes), 36170 bytes strings
19226 strings (170160 bytes), 16030 de-duplicated (137187 bytes), 3197 trie nodes used
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:11
IMPORT builtin 'hwdb' returned non-zero
RUN '$env{REMOVE_CMD}' /lib/udev/rules.d/95-udev-late.rules:4
ABS=ffffff01000701ff
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.2/input/input31
EV=10001f
ID_BUS=usb
ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_2_1_2
ID_INPUT=1
ID_INPUT_KEY=1
ID_INPUT_KEYBOARD=1
ID_MODEL=Microsoft®_Nano_Transceiver_v2.0
ID_MODEL_ENC=Microsoft®\x20Nano\x20Transceiver\x20v2.0
ID_MODEL_ID=0745
ID_PATH=pci-0000:00:14.0-usb-0:2:1.2
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_2
ID_REVISION=0634
ID_SERIAL=Microsoft_Microsoft®_Nano_Transceiver_v2.0
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030101:030102:030000:
ID_USB_INTERFACE_NUM=02
ID_VENDOR=Microsoft
ID_VENDOR_ENC=Microsoft
ID_VENDOR_ID=045e
KEY=4c37fff072ff32d bf54445600000000 c00000000000001 30f908b17c007 ffff7bfad951dfff febeffdfffefffff fffffffffffffffe
MODALIAS=input:b0003v045Ep0745e0111-e0,1,2,3,4,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,8B,8C,8E,8F,90,94,96,98,9B,9C,9E,9F,A1,A3,A4,A5,A6,A7,A8,A9,AB,AC,AD,AE,B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,CE,CF,D0,D1,D2,D4,D8,D9,DB,DF,E4,E7,E8,E9,EA,EB,F0,F1,100,13A,13B,161,162,164,166,16A,16E,172,174,176,178,179,17A,17B,17C,17D,17F,180,182,183,185,188,189,18C,18D,18E,18F,190,191,192,193,195,198,199,19A,1A0,1A1,1A2,1A3,1A4,1A5,1A6,1A7,1A8,1A9,1AA,1AB,1AC,1AD,1AE,1B0,1B1,1B6,1B7,1BA,r6,a0,1,2,3,4,5,6,7,8,10,11,12,20,28,29,2A,2B,2C,2D,2E,2F,30,31,32,33,34,35,36,37,38,39,3A,3B,3C,3D,3E,m4,lsfw
MSC=10
NAME="Microsoft Microsoft® Nano Transceiver v2.0"
PHYS="usb-0000:00:14.0-2/input2"
PRODUCT=3/45e/745/111
PROP=0
REL=40
REMOVE_CMD=/opt/toggle_touch.sh 1
SUBSYSTEM=input
TAGS=:seat:
UNIQ=""
USEC_INITIALIZED=2029304924
run: '/opt/toggle_touch.sh 1'
unload module index
谢谢您的帮助。
答案1
从 udev调用时xinput
,您必须设置XAUTHORITY
变量:
#!/bin/sh
export DISPLAY=":0"
export XAUTHORITY="/home/<user>/.Xauthority"
/usr/bin/xinput set-prop "DLL063E:00 06CB:2934" "Device Enabled" $1
当您直接从控制台运行脚本时,此变量已经设置,但 udev(和其他服务,如 cron)调用的脚本通常具有一组最少的环境变量,因此您必须手动设置它。