web-dev-qa-db-fra.com

Ma règle personnalisée udev hwdb ne fonctionne pas

J'utilise ubuntu 14.04 installé en mode EFI, j'ai essayé d'écrire une simple règle udev qui, pour tous les claviers USB externes, mappera capslock pour échapper. J'utilise beaucoup de vim et branchez et débranchez souvent les claviers, ce qui simplifiera beaucoup les choses. Donc, après différents tutoriels, j'ai créé un tel fichier

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


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

alors j'ai exécuté

udevadm hwdb --update

mais ça ne marche pas. J'ai utilisé la première règle générale de mappage doublé pour n'importe quel clavier USB

keyboard:usb:v*p*

et pour celui que j'avais déjà branché

keyboard:usb:v046dpc30e*

je pensais que des travaux spécifiques fonctionneraient, mais malheureusement pas.

alors j'ai essayé de déboguer ce qui ne va pas et après un autre tutoriel, lancez ceci:

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

Une idée de comment je peux le déboguer et le faire fonctionner?

6
gregor

Le format est KEYBOARD_KEY_<hex scan code>. Utilisez "evtest" pour trouver le code de numérisation correct. Exécutez-le, sélectionnez le périphérique approprié et appuyez sur la touche pour laquelle vous souhaitez utiliser le code de balayage. Cherchez quelque chose comme:

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

Vous voulez que le code soit situé après MSC_SCAN, alors sur mon clavier, il est 70039, je pense que cela est vrai pour tous les claviers USB.

Aussi, après:

udevadm hwdb --update

vous avez besoin:

udevadm trigger

Pour activer le nouveau mappage.

5
megahallon

J'avais un problème similaire. Pour moi le problème est en fait ici:

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

Je suppose que ce que vous voulez, c'est une autre règle, mais vous obtenez ceci:

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

Essayez de rajouter:

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

Vers la ligne 5 de 80-drivers.rules et voyez ce que vous obtenez.

0
Brian Bunker