Die Debian-9-Udev-Tastaturregel funktioniert nicht

839
user3728501

Jedes Mal, wenn ich meinen Bildschirm sperre / meine Tastatur entferne und ihn wieder einsteckt (usb), wird die Wiederholrate der Tastatur zurückgesetzt. Ich versuche das zu korrigieren, indem ich eine Udev-Regel erstellt.

Ich habe eine Regel erstellt in /etc/udev/rules.dnannte 21_persistent-local.ruleses enthält:

ACTION=="add", SUBSYSTEM=="usb", ATTRS=="413c", ATTRS=="2106", RUN+="/home/user/keyboard-connect-test-script.sh" 

keyboard-connect-test-script.sh enthält:

echo "keyboard connected" >> /home/user/keyboard.log 

Ich habe mich chmod +xauf dieses Skript beworben und die Datei keyboard.logexistiert.

Ich bin gelaufen sudo udevadm control --reload-rulesund es gibt keine offensichtlichen Fehler in udevadm test --action=add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:413C:2106.001C/input/input40denen produziert:

calling: test version 235 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: 235 file size: 9212225 bytes header size 80 bytes strings 1931297 bytes nodes 7280848 bytes Load module index Failed to read $container of PID 1, ignoring: Permission denied Found container virtualization none. timestamp of '/etc/systemd/network' changed timestamp of '/lib/systemd/network' changed Ignoring /lib/systemd/network/80-container-ve.network, because it's not a regular file with suffix .link. Ignoring /lib/systemd/network/80-container-vz.network, because it's not a regular file with suffix .link. Ignoring /lib/systemd/network/80-container-host0.network, because it's not a regular file with suffix .link. Parsed configuration file /lib/systemd/network/99-default.link Created link configuration context. timestamp of '/etc/udev/rules.d' changed Reading rules file: /etc/udev/rules.d/21_persistent-local.rules 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/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-hpmud.rules Reading rules file: /lib/udev/rules.d/60-block.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-fuse.rules Reading rules file: /lib/udev/rules.d/60-input-id.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-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-sensor.rules Reading rules file: /lib/udev/rules.d/60-serial.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/69-cd-sensors.rules Reading rules file: /lib/udev/rules.d/69-libmtp.rules Reading rules file: /lib/udev/rules.d/69-wacom.rules Reading rules file: /lib/udev/rules.d/70-debian-uaccess.rules Reading rules file: /lib/udev/rules.d/70-joystick.rules Reading rules file: /lib/udev/rules.d/70-mouse.rules Reading rules file: /lib/udev/rules.d/70-power-switch.rules Reading rules file: /lib/udev/rules.d/70-printers.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/71-seat.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: /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-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-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-hdparm.rules Reading rules file: /lib/udev/rules.d/85-hplj10xx.rules Reading rules file: /lib/udev/rules.d/85-hwclock.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-libgpod.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/95-cd-devices.rules Reading rules file: /lib/udev/rules.d/95-dm-notify.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/99-systemd.rules rules contain 393216 bytes tokens (32768 * 12 bytes), 36236 bytes strings 28450 strings (232117 bytes), 24709 de-duplicated (199623 bytes), 3742 trie nodes used IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:14 IMPORT builtin 'hwdb' returned non-zero IMPORT builtin 'input_id' /lib/udev/rules.d/60-input-id.rules:5 capabilities/ev raw kernel attribute: 120013 capabilities/abs raw kernel attribute: 0 capabilities/rel raw kernel attribute: 0 capabilities/key raw kernel attribute: 1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe properties raw kernel attribute: 0 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 'usb_id' /lib/udev/rules.d/60-persistent-input.rules:11 /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0: if_class 3 protocol 0 IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-input.rules:35 RUN 'kmod load $env' /lib/udev/rules.d/80-drivers.rules:5 .INPUT_CLASS=kbd .MM_USBIFNUM=00 ACTION=add DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:413C:2106.001E/input/input42 EV=120013 ID_BUS=usb ID_FOR_SEAT=input-pci-0000_00_1a_0-usb-0_1_4_1_0 ID_INPUT=1 ID_INPUT_KEY=1 ID_INPUT_KEYBOARD=1 ID_MODEL=Dell_QuietKey_Keyboard ID_MODEL_ENC=Dell\x20QuietKey\x20Keyboard ID_MODEL_ID=2106 ID_PATH=pci-0000:00:1a.0-usb-0:1.4:1.0 ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_4_1_0 ID_REVISION=0101 ID_SERIAL=DELL_Dell_QuietKey_Keyboard ID_TYPE=hid ID_USB_DRIVER=usbhid ID_USB_INTERFACES=:030101: ID_USB_INTERFACE_NUM=00 ID_VENDOR=DELL ID_VENDOR_ENC=DELL ID_VENDOR_ID=413c KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe LED=7 MODALIAS=input:b0003v413Cp2106e0110-e0,1,4,11,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,8C,8E,96,98,9E,9F,A1,A3,A4,A5,A6,AD,B0,B1,B2,B3,B4,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw MSC=10 NAME="DELL Dell QuietKey Keyboard" PHYS="usb-0000:00:1a.0-1.4/input0" PRODUCT=3/413c/2106/110 PROP=0 SUBSYSTEM=input TAGS=:seat: UNIQ="" USEC_INITIALIZED=422868148985 run: 'kmod load input:b0003v413Cp2106e0110-e0,1,4,11,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,8C,8E,96,98,9E,9F,A1,A3,A4,A5,A6,AD,B0,B1,B2,B3,B4,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw' Unload module index Unloaded link configuration context. 

Ich habe die Codes idVendorund idProductvon erhalten lsusb -v, deren relevanter Abschnitt ist:

Bus 001 Device 024: ID 413c:2106 Dell Computer Corp. Dell QuietKey Keyboard Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0  bDeviceProtocol 0  bMaxPacketSize0 8 idVendor 0x413c Dell Computer Corp. idProduct 0x2106 Dell QuietKey Keyboard bcdDevice 1.01 iManufacturer 1  iProduct 2  iSerial 0  bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 34 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0  bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 1 Boot Interface Subclass bInterfaceProtocol 1 Keyboard iInterface 0  HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 65 Report Descriptors:  ** UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 10 

Ich habe die Tastatur jedoch mehrmals entfernt und wieder angeschlossen, und die keyboard.logDatei ist noch leer.

0

1 Antwort auf die Frage

2
user3728501

Das Problem war, dass dem Bash-Skript der Shebang fehlte.

keyboard-connect-test-script.sh Gewechselt zu:

#!/bin/bash echo "keyboard connected" >> /home/user/keyboard.log 

Es funktioniert jetzt, wird jedoch keyboard connectedzweimal für jedes Unplug / Plug-Ereignis wiederholt . Warum?

Es ist gut, dass Sie Ihre eigene Frage beantwortet haben. Aber das letzte "Warum?" sollte eine separate Frage sein. Alternativ (sofern keine anderen Antworten auf Ihre ursprüngliche Frage zutreffen), können Sie diese Antwort löschen und die Frage umformulieren (bearbeiten). Sie werden also gefragt, "warum zweimal?". ohne die ursprüngliche Ausgabe zu erwähnen. Kamil Maciorowski vor 6 Jahren 1
@ KamilMaciorowski Es ist eigentlich irrelevant, wäre aber schön zu wissen. user3728501 vor 6 Jahren 0
Wahrscheinlich gibt es zwei Kernel-Events, die Ihren Kriterien entsprechen. Verwenden Sie "udevadm monitor --udev --property", um zu sehen, welche Ereignisse Sie beim Einstecken der Tastatur erhalten. dirkt vor 6 Jahren 0