You are not logged in.
Hi everyone,
so I have a dongle for my mouse/keyboard, which also advertises as a joystick. Since this prevents me from using the real gamepads I want to get rid of it.
The following devices are created for the hardware:
/dev/input/event3 (keyboard)
/dev/input/mouse0 (mouse)
/dev/input/event4 (mouse)
/dev/input/js0 (invalid joystick)
/dev/input/event5 (invalid joystick)
These are my current udev rules:
ACTION=="add", KERNEL=="js[0-9]*", SUBSYSTEM=="input", KERNELS=="3-3:1.2", ATTRS{bInterfaceSubClass}=="00", ATTRS{bInterfaceProtocol}=="00", ATTRS{bInterfaceNumber}=="02", RUN+="/usr/bin/rm /dev/input/js%n"
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", KERNELS=="3-3:1.2", ATTRS{bInterfaceSubClass}=="00", ATTRS{bInterfaceProtocol}=="00", ATTRS{bInterfaceNumber}=="02", RUN+="/usr/bin/rm /dev/input/event%n"
These used to work, but then started preventing me from using the keyboad's media keys, so I had to fiddle around again. Now they don't work for some reason. Please don't ask me why. udev is a huge lump of voodoo to me
I toyed around with rules like this:
ACTION=="add", KERNEL=="js[0-9]*", SUBSYSTEM=="input", KERNEL=="0003:045E:0745.0006", RUN+="/usr/bin/rm /dev/input/js%n"
But the last part of the second KERNEL test changes every time the device is replugged.
Also I seem to have no way of checking which rules are applied to the device, as `udevadm test` doesn't seem to show it.
And so that you don't have to guess, here's the attribute walk of /deV/input/js0:
looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2/0003:045E:0745.0009/input/input29/js0':
KERNEL=="js0"
SUBSYSTEM=="input"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2/0003:045E:0745.0009/input/input29':
KERNELS=="input29"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{phys}=="usb-0000:00:14.0-3/input2"
ATTRS{uniq}==""
ATTRS{properties}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2/0003:045E:0745.0009':
KERNELS=="0003:045E:0745.0009"
SUBSYSTEMS=="hid"
DRIVERS=="hid-generic"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2':
KERNELS=="1-3:1.2"
SUBSYSTEMS=="usb"
DRIVERS=="usbhid"
ATTRS{bInterfaceClass}=="03"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{bNumEndpoints}=="01"
ATTRS{supports_autosuspend}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="02"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
KERNELS=="1-3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="3"
ATTRS{idVendor}=="045e"
ATTRS{speed}=="12"
ATTRS{bNumInterfaces}==" 3"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{busnum}=="1"
ATTRS{devnum}=="6"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="100mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="a0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="0656"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="20015"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Microsoft"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0745"
ATTRS{bDeviceClass}=="00"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="01"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="12"
ATTRS{bcdDevice}=="0318"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="0000:00:14.0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="122"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 3.18.5-1-ARCH xhci-hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="xHCI Host Controller"
looking at parent device '/devices/pci0000:00/0000:00:14.0':
KERNELS=="0000:00:14.0"
SUBSYSTEMS=="pci"
DRIVERS=="xhci_hcd"
ATTRS{irq}=="28"
ATTRS{subsystem_vendor}=="0x1462"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0330"
ATTRS{driver_override}=="(null)"
ATTRS{consistent_dma_mask_bits}=="64"
ATTRS{dma_mask_bits}=="64"
ATTRS{local_cpus}=="00000000,00000000,00000000,0000000f"
ATTRS{device}=="0x8c31"
ATTRS{enable}=="1"
ATTRS{msi_bus}=="1"
ATTRS{local_cpulist}=="0-3"
ATTRS{vendor}=="0x8086"
ATTRS{subsystem_device}=="0x7850"
ATTRS{numa_node}=="-1"
ATTRS{d3cold_allowed}=="1"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
I hope someone can help get this done. I'd like to be able to use both, the media keys, and the gamepads.
Chais
--
Chais
Offline
Hi, first thanks and second i have good news.
As you may have noticed KERNELS parameter usually changes and thus the rule does not apply, but the path /dev/input/by-id don't change, so:
Create a udev rule:
## /etc/udev/rules.d/99-fix-jsx-eventx.rules ##
SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0745", KERNEL=="js[0-9]*", RUN+="/usr/local/bin/fix-jsx-eventx.sh"
Then create the script to change permissions:
## /usr/local/bin/fix-jsx-eventx.sh ##
#!/bin/bash
sleep 5
chmod a-r-w "/dev/input/by-id/usb-Microsoft_Microsoft®_2.4GHz_Transceiver_v7.0-if02-event-joystick"
chmod a-r-w "/dev/input/by-id/usb-Microsoft_Microsoft®_2.4GHz_Transceiver_v7.0-if02-joystick"
The "sleep 5" is necessary because the eventX is not immediately created, making that permissions aren't applied correctly.
# chmod +x /usr/local/bin/fix-jsx-eventx.sh
After that, reload rules
# udevadm control --reload
Then replug the device and voilà! Both problems solved, get rid of fake joystick and working multimedia keys.
Bye!"
PD: Google translated...
Last edited by ThecaTTony (2015-05-01 07:43:00)
Offline