Forum Linux.débutant Comment inverser l'ordre de /dev/input/js0 et /dev/input/js1 ?

Posté par  . Licence CC By‑SA.
Étiquettes :
1
15
oct.
2013

Bonjour,

Je possède deux joysticks : l'un est branché en permanence (usb), l'autre est "branché" ponctuellement (bluetooth). Je me retrouve donc avec /dev/input/js0 assigné au périphérique usb et éventuellement /dev/input/js1 en pour le bluetooth.

Ça ne m'arrange pas ; j'aimerais que mon périphérique usb soit assigné par défaut à /dev/input/js1 pour que le bluetooth puisse être assigné à /dev/input/js0 quand je le connecte.

Après quelques recherches, j'ai tenté de créer la règle udev suivante pour le périphérique usb :

cat /etc/udev/rules.d/10-local.rules
SUBSYSTEM=="input", KERNEL=="js[0-9]*", ATTRS{idVendor}=="0925", ATTRS{idProduct}=="8888", NAME:="input/js1"

Qui ne fonctionne pas. En revanche :

SUBSYSTEM=="input", KERNEL=="js[0-9]*", ATTRS{idVendor}=="0925", ATTRS{idProduct}=="8888", SYMLINK+="input/js1"

Créée bien un lien symbolique lorsque mon périphérique usb est détecté, ce qui me laisse penser qu'udev détecte correctement ma règle. Alors pourquoi l'option NAME:="input/nimportequoi" ne fonctionne pas ?

Merci !

(OS : Debian testing)

  • # Demande à udev lui même

    Posté par  . Évalué à 2.

    Remets ta ligne qui ne fonctionne pas dans les règles et ensuite, suivant la version du package udev installé, utilise "udevtest" ou bien encore "udevadm test", je te laisse voir la doc. de ces outils qui te sortiront plein de ligne permettant de debbuger les règles udev.
    Ensuite poste le résultat ici pour que l'on puisse de donner d'autres pistes.

    • [^] # Re: Demande à udev lui même

      Posté par  . Évalué à 1.

      Merci pour ta remarque. Un peu au pif je tente un :

      :~# udevadm test --action=add `udevadm info -q path -n /dev/input/js0`
      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:         5632867 bytes
      header size             80 bytes
      strings            1260755 bytes
      nodes              4372032 bytes
      load module index
      read rules file: /etc/udev/rules.d/10-local.rules
      read rules file: /lib/udev/rules.d/40-hplip.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_support.rules
      read rules file: /lib/udev/rules.d/60-cdrom_id.rules
      read rules file: /lib/udev/rules.d/60-crda.rules
      read rules file: /lib/udev/rules.d/60-fuse.rules
      read rules file: /lib/udev/rules.d/60-gnupg.rules
      read rules file: /lib/udev/rules.d/60-inputattach.rules
      read rules file: /lib/udev/rules.d/60-joystick.rules
      read rules file: /lib/udev/rules.d/60-libgphoto2-2.rules
      read rules file: /lib/udev/rules.d/60-libsane.rules
      read rules file: /lib/udev/rules.d/60-nvidia-kernel-common.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-md-raid.rules
      read rules file: /lib/udev/rules.d/64-xorg-xkb.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: /lib/udev/rules.d/70-android-tools-fastboot.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-udev-acl.rules
      read rules file: /lib/udev/rules.d/75-cd-aliases-generator.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-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-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-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-net-name-slot.rules
      read rules file: /lib/udev/rules.d/80-networking.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-hdparm.rules
      read rules file: /lib/udev/rules.d/85-hplj10xx.rules
      read rules file: /lib/udev/rules.d/85-hwclock.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/91-permissions.rules
      read rules file: /lib/udev/rules.d/95-cd-devices.rules
      read rules file: /lib/udev/rules.d/95-keyboard-force-release.rules
      read rules file: /lib/udev/rules.d/95-keymap.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 393216 bytes tokens (32768 * 12 bytes), 40143 bytes strings
      29385 strings (248198 bytes), 25682 de-duplicated (211759 bytes), 3704 trie nodes used
      NAME="input/js1" ignored, kernel device nodes can not be renamed; please fix it in /etc/udev/rules.d/10-local.rules:5
      IMPORT builtin 'input_id' /lib/udev/rules.d/50-udev-default.rules:4
      capabilities/ev raw kernel attribute: 20001b
      capabilities/abs raw kernel attribute: 30027
      capabilities/rel raw kernel attribute: 0
      capabilities/key raw kernel attribute: fff00000000 0 0 0 0
      test_key: checking bit block 0 for any keys; found=0
      test_key: checking bit block 64 for any keys; found=0
      test_key: checking bit block 128 for any keys; found=0
      test_key: checking bit block 192 for any keys; found=0
      RUN '/lib/udev/jscal-restore %E{DEVNAME}' /lib/udev/rules.d/60-joystick.rules:2
      IMPORT builtin 'usb_id' /lib/udev/rules.d/60-persistent-input.rules:7
      /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0: if_class 3 protocol 0
      LINK 'input/by-id/usb-WiseGroup._Ltd_MP-8888_USB_Joypad-joystick' /lib/udev/rules.d/60-persistent-input.rules:22
      IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-input.rules:31
      LINK 'input/by-path/pci-0000:00:1a.0-usb-0:1.4:1.0-joystick' /lib/udev/rules.d/60-persistent-input.rules:32
      RUN 'udev-acl --action=$env{ACTION} --device=$env{DEVNAME}' /lib/udev/rules.d/70-udev-acl.rules:74
      MODE 0664 /lib/udev/rules.d/91-permissions.rules:108
      handling device node '/dev/input/js0', devnum=c13:0, mode=0664, uid=0, gid=0
      preserve permissions /dev/input/js0, 020664, uid=0, gid=0
      preserve already existing symlink '/dev/char/13:0' to '../input/js0'
      found 'c13:0' claiming '/run/udev/links/\x2finput\x2fby-id\x2fusb-WiseGroup._Ltd_MP-8888_USB_Joypad-joystick'
      creating link '/dev/input/by-id/usb-WiseGroup._Ltd_MP-8888_USB_Joypad-joystick' to '/dev/input/js0'
      preserve already existing symlink '/dev/input/by-id/usb-WiseGroup._Ltd_MP-8888_USB_Joypad-joystick' to '../js0'
      found 'c13:0' claiming '/run/udev/links/\x2finput\x2fby-path\x2fpci-0000:00:1a.0-usb-0:1.4:1.0-joystick'
      creating link '/dev/input/by-path/pci-0000:00:1a.0-usb-0:1.4:1.0-joystick' to '/dev/input/js0'
      preserve already existing symlink '/dev/input/by-path/pci-0000:00:1a.0-usb-0:1.4:1.0-joystick' to '../js0'
      .INPUT_CLASS=joystick
      ACTION=add
      DEVLINKS=/dev/input/by-id/usb-WiseGroup._Ltd_MP-8888_USB_Joypad-joystick /dev/input/by-path/pci-0000:00:1a.0-usb-0:1.4:1.0-joystick
      DEVNAME=/dev/input/js0
      DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input53/js0
      ID_BUS=usb
      ID_INPUT=1
      ID_INPUT_JOYSTICK=1
      ID_MODEL=MP-8888_USB_Joypad
      ID_MODEL_ENC=MP-8888\x20USB\x20Joypad
      ID_MODEL_ID=8888
      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=0300
      ID_SERIAL=WiseGroup._Ltd_MP-8888_USB_Joypad
      ID_TYPE=hid
      ID_USB_DRIVER=usbhid
      ID_USB_INTERFACES=:030000:
      ID_USB_INTERFACE_NUM=00
      ID_VENDOR=WiseGroup._Ltd
      ID_VENDOR_ENC=WiseGroup.\x2cLtd
      ID_VENDOR_ID=0925
      MAJOR=13
      MINOR=0
      SUBSYSTEM=input
      TAGS=:udev-acl:
      USEC_INITIALIZED=9015553569
      run: '/lib/udev/jscal-restore /dev/input/js0'
      run: 'udev-acl --action=add --device=/dev/input/js0'
      unload module index
      

      NAME="input/js1" ignored, kernel device nodes can not be renamed; please fix it in /etc/udev/rules.d/10-local.rules:5
      

      zut.

      Une idée ?

      • [^] # Re: Demande à udev lui même

        Posté par  . Évalué à 1.

        Après une brève recherche sur google (seulement 3 pages de résultats, facile), un gentil utilisateur a tout bien résumé ici : je me suis basé sur de vieux exemples pour écrire mes règles, NAME ne fonctionne plus que pour les interfaces réseau désormais.

        Brillant :/

Suivre le flux des commentaires

Note : les commentaires appartiennent à celles et ceux qui les ont postés. Nous n’en sommes pas responsables.