The ultimate goal here is to turn on/off touchpad on mouse plug, so I'm trying to get some property of my mouse and my touchpad from udev database, using udevadm but I don't get how this working and unfortunately the manpage isn't clear enough to me…
$ lsb_release -irc Distributor ID: Debian Release: 8.4 Codename: jessie
Here is the kind of information I'm looking for :
KERNEL=="input16"
SUBSYSTEM=="input"
DRIVER==""
ATTR{name}=="Bluetooth Laser Travel Mouse"
ATTR{phys}=="5c:e0:c5:9d:63:fd"
ATTR{uniq}=="00:07:61:ec:be:5c"
ATTR{properties}=="0"
From here I have tried this :
$ udevadm info -a /sys/devices/pci0000\:00/0000\:00\:1c.3/0000\:03\:00.0/usb2/2-1/2-1\:1.0/0003\:1EA7\:0064.0002/input/input25/mouse1/`
and i'm getting this
Unknown device, absolute path in /dev/ or /sys expected.
If I monitor, I get this result:
$ udevadm monitor -k -s input
monitor will print the received events for:
KERNEL - the kernel uevent
KERNEL[4375.486738] remove /devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0002/input/input25/mouse1 (input)
KERNEL[4375.496500] remove /devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0002/input/input25/event11 (input)
KERNEL[4375.532441] remove /devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0002/input/input25 (input)
KERNEL[4377.840574] add /devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0003/input/input26 (input)
KERNEL[4377.840667] add /devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0003/input/input26/mouse1 (input)
KERNEL[4377.840759] add /devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0003/input/input26/event11 (input)
So I have also tried this:
$ udevadm info -a -p /sys/devices/pci0000\:00/0000\:00\:1c.3/0000\:03\:00.0/usb2/2-1/2-1\:1.0/0003\:1EA7\:0064.0002/input/input25/
and this
$ udevadm info -a -p /devices/pci0000\:00/0000\:00\:1c.3/0000\:03\:00.0/usb2/2-1/2-1\:1.0/0003\:1EA7\:0064.0002/input/input25/
and get this result
syspath not found
The only way I manage to get some property is using this command:
$ udevadm info --query=all --name=/dev/input/mouse1
And I get this but, I don't have the attribute I'm looking for…(ie ATTR{name}
)
P: /devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0003/input/input26/mouse1 N: input/mouse1 S: input/by-id/usb-1ea7_2.4G_Wireless_Mouse-mouse S: input/by-path/pci-0000:03:00.0-usb-0:1:1.0-mouse E: DEVLINKS=/dev/input/by-id/usb-1ea7_2.4G_Wireless_Mouse-mouse /dev/input/by-path/pci-0000:03:00.0-usb-0:1:1.0-mouse E: DEVNAME=/dev/input/mouse1 E: DEVPATH=/devices/pci0000:00/0000:00:1c.3/0000:03:00.0/usb2/2-1/2-1:1.0/0003:1EA7:0064.0003/input/input26/mouse1 E: ID_BUS=usb E: ID_INPUT=1 E: ID_INPUT_MOUSE=1 E: ID_MODEL=2.4G_Wireless_Mouse E: ID_MODEL_ENC=2.4G\x20Wireless\x20Mouse E: ID_MODEL_ID=0064 E: ID_PATH=pci-0000:03:00.0-usb-0:1:1.0 E: ID_PATH_TAG=pci-0000_03_00_0-usb-0_1_1_0 E: ID_REVISION=0200 E: ID_SERIAL=1ea7_2.4G_Wireless_Mouse E: ID_TYPE=hid E: ID_USB_DRIVER=usbhid E: ID_USB_INTERFACES=:030102: E: ID_USB_INTERFACE_NUM=00 E: ID_VENDOR=1ea7 E: ID_VENDOR_ENC=1ea7 E: ID_VENDOR_ID=1ea7 E: MAJOR=13 E: MINOR=33 E: SUBSYSTEM=input E: USEC_INITIALIZED=77840674
So clearly I've a misunderstanding on how to query udev to get the attribute of a device.
Hope I'm clear enough if anyone has an idea where I'm mistaking any input is welcome !
Thanks !
Matth.