web-dev-qa-db-ja.com

カスタムudev hwdbルールが機能しません

私はEFIモードでインストールされたubuntu 14.04を使用しています、すべての外部USBキーボードのためにマッピングする簡単なudevルールを書き込もうとしました capslock 脱出のため。私は多くのvimを使用し、キーボードを頻繁に抜き差しするので、これにより物事が大幅に簡素化されます。だから私はそのようなファイルを作った別のチュートリアルに従って

cat /etc/udev/hwdb.d/61-keyboard-local.hwdb


keyboard:usb:v*p*
keyboard:usb:v046dpc30e*
    KEYBOARD_KEY_58=esc

それから私は実行しました

udevadm hwdb --update

しかし、それは機能しません。 USBキーボードの最初の一般的なルールを2倍にマッピングしました

keyboard:usb:v*p*

そして、私がすでに差し込んでいたもののために

keyboard:usb:v046dpc30e*

特定の仕事はうまくいくかもしれないが、残念ながらうまくいかないと思った。

だから私は間違っているものをデバッグしようとしましたが、他のチュートリアルに従ってこれを実行してください:

udevadm --debug test /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:046D:C30E.0007/input/input20
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:         5740456 bytes
header size             80 bytes
strings            1262416 bytes
nodes              4477960 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-gnupg2.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/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/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/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-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-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-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
rules contain 196608 bytes tokens (16384 * 12 bytes), 33727 bytes strings
18818 strings (164973 bytes), 15727 de-duplicated (134338 bytes), 3092 trie nodes used
device 0x15f81b0 has devpath '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:046D:C30E.0007/input/input20'
device 0x1600050 filled with db file data
device 0x15ff420 has devpath '/devices/virtual/dmi/id'
value '[dmi/id]sys_vendor' is 'Hewlett-Packard'
IMPORT builtin 'usb_id' /lib/udev/rules.d/40-libgphoto2-6.rules:3
device 0x15ff420 has devpath '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:046D:C30E.0007'
device 0x1605e30 has devpath '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0'
/sys/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0: if_class 3 protocol 0
device 0x1607b80 has devpath '/devices/pci0000:00/0000:00:14.0/usb3/3-2'
device 0x1608170 has devpath '/devices/pci0000:00/0000:00:14.0/usb3'
device 0x1608550 has devpath '/devices/pci0000:00/0000:00:14.0'
device 0x1608930 has devpath '/devices/pci0000:00'
IMPORT builtin 'input_id' /lib/udev/rules.d/50-udev-default.rules:10
capabilities/ev raw kernel attribute: 120013
capabilities/abs raw kernel attribute: 0
capabilities/rel raw kernel attribute: 0
capabilities/key raw kernel attribute: 1000000000007 ff800000000007ff febeffdff3cfffff 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
device 0x15ff420 filled with db file data
RUN 'kmod load $env{MODALIAS}' /lib/udev/rules.d/80-drivers.rules:5
unable to create temporary db file '/run/udev/data/+input:input20.tmp': Permission denied
.INPUT_CLASS=kbd
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:046D:C30E.0007/input/input20
EV=120013
ID_BUS=usb
ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_2_1_0
ID_INPUT=1
ID_INPUT_KEY=1
ID_INPUT_KEYBOARD=1
ID_MODEL=HID_compliant_keyboard
ID_MODEL_ENC=HID\x20compliant\x20keyboard
ID_MODEL_ID=c30e
ID_PATH=pci-0000:00:14.0-usb-0:2:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_0
ID_REVISION=0180
ID_SERIAL=Logitech_HID_compliant_keyboard
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030101:030000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Logitech
ID_VENDOR_ENC=Logitech
ID_VENDOR_ID=046d
KEY=1000000000007 ff800000000007ff febeffdff3cfffff fffffffffffffffe
LED=7
MODALIAS=input:b0003v046DpC30Ee0110-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,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw
MSC=10
NAME="Logitech HID compliant keyboard"
PHYS="usb-0000:00:14.0-2/input0"
PRODUCT=3/46d/c30e/110
PROP=0
SUBSYSTEM=input
TAGS=:seat:
UDEV_LOG=7
UNIQ=""
USEC_INITIALIZED=3550400
run: 'kmod load input:b0003v046DpC30Ee0110-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,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw'
unload module index

どのようにデバッグして動作させることができますか?

6
gregor

形式はKEYBOARD_KEY_<hex scan code>です。 「evtest」を使用して、正しいスキャンコードを見つけます。それを実行し、適切なデバイスを選択して、スキャンコードが必要なキーを押します。次のようなものを探してください:

Event: time 1410505361.975680, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1410505361.975680, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 1

MSC_SCANの後にコードを配置したいので、私のキーボードでは70039です。これはすべてのUSBキーボードに当てはまると思います。

また、後:

udevadm hwdb --update

必要なもの:

udevadm trigger

新しいマッピングをアクティブにします。

5
megahallon

同様の問題がありました。私にとって問題は実際にここにあります:

kmod load $env{MODALIAS}' /lib/udev/rules.d/80-drivers.rules:5

あなたが望むのは他のルールだと思うが、あなたが得ているのはこれだ:

kmod load input:b0003v046DpC30Ee0110-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,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw

追加し直してください:

DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{builtin}="kmod load $env{MODALIAS}"

80-drivers.rulesの5行目で、得られるものを確認します。

0
Brian Bunker