0

I am new to udev and want to create a symlink to /dev/input/eventX in case it is the USB mouse input I want. I want to match all USB mouses and create the symlink unless it two particular inputs.

evtest gives me:

/dev/input/event0:  waveshare HDMI/VGA/AV RTD2660H Viedo Board
/dev/input/event1:  Logitech M325
/dev/input/event2:  Logitech M705

I want to create a symlink to any device that is not both 0 and 2nd devices in the given evtest example. The reason is because touchscreen I am using is simulating mouse events and I want it to make sure I'm not using that as an input. Furthermore, I want to input the symlink to an embedded Qt application.

The problem here is Logitech M705 and Logitech M325 are created by the same exact device. They only differ in ATTR{name}, in SUBSYSTEM=="input".

Touchscreen device I want to avoid:

looking at device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:0483:5710.0004/input/input0':
    KERNEL=="input0"
    SUBSYSTEM=="input"
    DRIVER==""
    ATTR{uniq}=="49930F713438"
    ATTR{properties}=="0"
    ATTR{phys}=="usb-0000:01:00.0-1.4/input0"
    ATTR{name}=="waveshare HDMI/VGA/AV RTD2660H Viedo Board"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:0483:5710.0004':
    KERNELS=="0003:0483:5710.0004"
    SUBSYSTEMS=="hid"
    DRIVERS=="hid-generic"
    ATTRS{country}=="00"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0':
    KERNELS=="1-1.4:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{authorized}=="1"
    ATTRS{bInterfaceSubClass}=="00"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4':
    KERNELS=="1-1.4"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bcdDevice}=="0200"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{manufacturer}=="waveshare"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="12"
    ATTRS{idProduct}=="5710"
    ATTRS{urbnum}=="198"
    ATTRS{devnum}=="5"
    ATTRS{product}=="HDMI/VGA/AV RTD2660H Viedo Board"
    ATTRS{maxchild}=="0"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="0483"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{serial}=="49930F713438"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="1.4"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0420"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="3431"
    ATTRS{urbnum}=="48"
    ATTRS{devnum}=="2"
    ATTRS{product}=="USB2.0 Hub"
    ATTRS{maxchild}=="4"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="2109"
    ATTRS{version}==" 2.10"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="1"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0419"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{manufacturer}=="Linux 4.19.71 xhci-hcd"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="0002"
    ATTRS{urbnum}=="22"
    ATTRS{devnum}=="1"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{maxchild}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{serial}=="0000:01:00.0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="0"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"
...

Logitech M705 I want to avoid:

looking at device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:046D:C52B.0003/0003:046D:101B.0006/input/input10':
    KERNEL=="input10"
    SUBSYSTEM=="input"
    DRIVER==""
    ATTR{uniq}=="101b-0d-48-d4-1e"
    ATTR{properties}=="0"
    ATTR{phys}=="usb-0000:01:00.0-1.1:2"
    ATTR{name}=="Logitech M705"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:046D:C52B.0003/0003:046D:101B.0006':
    KERNELS=="0003:046D:101B.0006"
    SUBSYSTEMS=="hid"
    DRIVERS=="logitech-hidpp-device"
    ATTRS{country}=="00"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:046D:C52B.0003':
    KERNELS=="0003:046D:C52B.0003"
    SUBSYSTEMS=="hid"
    DRIVERS=="logitech-djreceiver"
    ATTRS{country}=="00"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2':
    KERNELS=="1-1.1:1.2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{authorized}=="1"
    ATTRS{bInterfaceSubClass}=="00"
    ATTRS{bInterfaceNumber}=="02"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1':
    KERNELS=="1-1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}=="RQR12.01_B0019"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bcdDevice}=="1201"
    ATTRS{bNumInterfaces}==" 3"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{manufacturer}=="Logitech"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="12"
    ATTRS{idProduct}=="c52b"
    ATTRS{urbnum}=="315"
    ATTRS{devnum}=="3"
    ATTRS{product}=="USB Receiver"
    ATTRS{maxchild}=="0"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="98mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="046d"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="1.1"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0420"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="3431"
    ATTRS{urbnum}=="48"
    ATTRS{devnum}=="2"
    ATTRS{product}=="USB2.0 Hub"
    ATTRS{maxchild}=="4"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="2109"
    ATTRS{version}==" 2.10"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="1"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0419"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{manufacturer}=="Linux 4.19.71 xhci-hcd"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="0002"
    ATTRS{urbnum}=="22"
    ATTRS{devnum}=="1"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{maxchild}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{serial}=="0000:01:00.0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="0"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"
...

Device I want to create symlink for:

looking at device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:046D:C52B.0003/0003:046D:400A.0005/input/input9':
    KERNEL=="input9"
    SUBSYSTEM=="input"
    DRIVER==""
    ATTR{uniq}=="400a-88-72-8f-94"
    ATTR{properties}=="0"
    ATTR{phys}=="usb-0000:01:00.0-1.1:1"
    ATTR{name}=="Logitech M325"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:046D:C52B.0003/0003:046D:400A.0005':
    KERNELS=="0003:046D:400A.0005"
    SUBSYSTEMS=="hid"
    DRIVERS=="logitech-hidpp-device"
    ATTRS{country}=="00"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2/0003:046D:C52B.0003':
    KERNELS=="0003:046D:C52B.0003"
    SUBSYSTEMS=="hid"
    DRIVERS=="logitech-djreceiver"
    ATTRS{country}=="00"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.2':
    KERNELS=="1-1.1:1.2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{authorized}=="1"
    ATTRS{bInterfaceSubClass}=="00"
    ATTRS{bInterfaceNumber}=="02"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1':
    KERNELS=="1-1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}=="RQR12.01_B0019"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bcdDevice}=="1201"
    ATTRS{bNumInterfaces}==" 3"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{manufacturer}=="Logitech"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="12"
    ATTRS{idProduct}=="c52b"
    ATTRS{urbnum}=="315"
    ATTRS{devnum}=="3"
    ATTRS{product}=="USB Receiver"
    ATTRS{maxchild}=="0"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="98mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="046d"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="1.1"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0420"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="3431"
    ATTRS{urbnum}=="48"
    ATTRS{devnum}=="2"
    ATTRS{product}=="USB2.0 Hub"
    ATTRS{maxchild}=="4"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="2109"
    ATTRS{version}==" 2.10"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="1"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0419"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{manufacturer}=="Linux 4.19.71 xhci-hcd"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{authorized}=="1"
    ATTRS{speed}=="480"
    ATTRS{idProduct}=="0002"
    ATTRS{urbnum}=="22"
    ATTRS{devnum}=="1"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{maxchild}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{serial}=="0000:01:00.0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{tx_lanes}=="1"
    ATTRS{devspec}=="          (null)"
    ATTRS{ltm_capable}=="no"
    ATTRS{devpath}=="0"
    ATTRS{busnum}=="1"
    ATTRS{quirks}=="0x0"
...

Any guidance is appreciated as to how I can proceed. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.