Добрый день!
Задача "Отключение тач пад при подключении bluetooth мыши "
сделал
udevadm monitor
включил выключал питание мыши
Спойлер
# udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[1259.640450] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/input/input47/mouse5 (input)
UDEV [1259.646443] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/input/input47/mouse5 (input)
KERNEL[1259.655483] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/input/input47/event27 (input)
UDEV [1259.657954] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/input/input47/event27 (input)
KERNEL[1259.661282] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:3585 (bluetooth)
UDEV [1259.664366] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:3585 (bluetooth)
KERNEL[1259.668447] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/input/input47 (input)
KERNEL[1259.668621] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/hidraw/hidraw2 (hidraw)
KERNEL[1259.668752] unbind /devices/virtual/misc/uhid/0005:046D:B034.0008 (hid)
KERNEL[1259.668921] remove /devices/virtual/misc/uhid/0005:046D:B034.0008 (hid)
UDEV [1259.673144] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/input/input47 (input)
UDEV [1259.675582] remove /devices/virtual/misc/uhid/0005:046D:B034.0008/hidraw/hidraw2 (hidraw)
UDEV [1259.678600] unbind /devices/virtual/misc/uhid/0005:046D:B034.0008 (hid)
UDEV [1259.680577] remove /devices/virtual/misc/uhid/0005:046D:B034.0008 (hid)
KERNEL[1261.307362] add /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:3585 (bluetooth)
UDEV [1261.309439] add /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:3585 (bluetooth)
KERNEL[1261.327624] add /devices/virtual/misc/uhid/0005:046D:B034.0009 (hid)
KERNEL[1261.327732] add /devices/virtual/misc/uhid/0005:046D:B034.0009/input/input49 (input)
KERNEL[1261.327780] add /devices/virtual/misc/uhid/0005:046D:B034.0009/input/input49/mouse5 (input)
KERNEL[1261.327843] add /devices/virtual/misc/uhid/0005:046D:B034.0009/input/input49/event27 (input)
KERNEL[1261.327885] add /devices/virtual/misc/uhid/0005:046D:B034.0009/hidraw/hidraw2 (hidraw)
KERNEL[1261.327932] bind /devices/virtual/misc/uhid/0005:046D:B034.0009 (hid)
UDEV [1261.328738] add /devices/virtual/misc/uhid/0005:046D:B034.0009 (hid)
UDEV [1261.329970] add /devices/virtual/misc/uhid/0005:046D:B034.0009/input/input49 (input)
UDEV [1261.331933] add /devices/virtual/misc/uhid/0005:046D:B034.0009/input/input49/mouse5 (input)
UDEV [1261.332610] add /devices/virtual/misc/uhid/0005:046D:B034.0009/hidraw/hidraw2 (hidraw)
UDEV [1261.352561] add /devices/virtual/misc/uhid/0005:046D:B034.0009/input/input49/event27 (input)
UDEV [1261.353865] bind /devices/virtual/misc/uhid/0005:046D:B034.0009 (hid)
выполнил
udevadm info -a -p '/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:3585'
Спойлер
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:3585':
KERNEL=="hci0:3585"
SUBSYSTEM=="bluetooth"
DRIVER==""
ATTR{power/async}=="disabled"
ATTR{power/control}=="auto"
ATTR{power/runtime_active_kids}=="0"
ATTR{power/runtime_active_time}=="0"
ATTR{power/runtime_enabled}=="disabled"
ATTR{power/runtime_status}=="unsupported"
ATTR{power/runtime_suspended_time}=="0"
ATTR{power/runtime_usage}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0':
KERNELS=="hci0"
SUBSYSTEMS=="bluetooth"
DRIVERS==""
ATTRS{power/async}=="disabled"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_kids}=="0"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_enabled}=="disabled"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0':
KERNELS=="1-7:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="btusb"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="e0"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="01"
ATTRS{bInterfaceSubClass}=="01"
ATTRS{bNumEndpoints}=="03"
ATTRS{power/async}=="enabled"
ATTRS{power/runtime_active_kids}=="0"
ATTRS{power/runtime_enabled}=="enabled"
ATTRS{power/runtime_status}=="suspended"
ATTRS{power/runtime_usage}=="0"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-7':
KERNELS=="1-7"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="e0"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="01"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 2"
ATTRS{bcdDevice}=="0010"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="2"
ATTRS{devpath}=="7"
ATTRS{idProduct}=="0a2b"
ATTRS{idVendor}=="8087"
ATTRS{ltm_capable}=="no"
ATTRS{maxchild}=="0"
ATTRS{power/active_duration}=="1965873"
ATTRS{power/async}=="enabled"
ATTRS{power/autosuspend}=="-1"
ATTRS{power/autosuspend_delay_ms}=="-1000"
ATTRS{power/connected_duration}=="1965872"
ATTRS{power/control}=="auto"
ATTRS{power/level}=="auto"
ATTRS{power/persist}=="1"
ATTRS{power/runtime_active_kids}=="0"
ATTRS{power/runtime_active_time}=="1965629"
ATTRS{power/runtime_enabled}=="enabled"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="1"
ATTRS{power/wakeup}=="disabled"
ATTRS{power/wakeup_abort_count}==""
ATTRS{power/wakeup_active}==""
ATTRS{power/wakeup_active_count}==""
ATTRS{power/wakeup_count}==""
ATTRS{power/wakeup_expire_count}==""
ATTRS{power/wakeup_last_time_ms}==""
ATTRS{power/wakeup_max_time_ms}==""
ATTRS{power/wakeup_total_time_ms}==""
ATTRS{quirks}=="0x0"
ATTRS{removable}=="fixed"
ATTRS{rx_lanes}=="1"
ATTRS{speed}=="12"
ATTRS{tx_lanes}=="1"
ATTRS{urbnum}=="122239"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{authorized_default}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="0mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0510"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="1"
ATTRS{devpath}=="0"
ATTRS{idProduct}=="0002"
ATTRS{idVendor}=="1d6b"
ATTRS{interface_authorized_default}=="1"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 5.10.198-std-def-alt1 xhci-hcd"
ATTRS{maxchild}=="12"
ATTRS{power/active_duration}=="1966005"
ATTRS{power/async}=="enabled"
ATTRS{power/autosuspend}=="-1"
ATTRS{power/autosuspend_delay_ms}=="-1000"
ATTRS{power/connected_duration}=="1966004"
ATTRS{power/control}=="auto"
ATTRS{power/level}=="auto"
ATTRS{power/runtime_active_kids}=="3"
ATTRS{power/runtime_active_time}=="1966002"
ATTRS{power/runtime_enabled}=="enabled"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="1"
ATTRS{power/wakeup}=="disabled"
ATTRS{power/wakeup_abort_count}==""
ATTRS{power/wakeup_active}==""
ATTRS{power/wakeup_active_count}==""
ATTRS{power/wakeup_count}==""
ATTRS{power/wakeup_expire_count}==""
ATTRS{power/wakeup_last_time_ms}==""
ATTRS{power/wakeup_max_time_ms}==""
ATTRS{power/wakeup_total_time_ms}==""
ATTRS{product}=="xHCI Host Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{rx_lanes}=="1"
ATTRS{serial}=="0000:00:14.0"
ATTRS{speed}=="480"
ATTRS{tx_lanes}=="1"
ATTRS{urbnum}=="66"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:14.0':
KERNELS=="0000:00:14.0"
SUBSYSTEMS=="pci"
DRIVERS=="xhci_hcd"
ATTRS{ari_enabled}=="0"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0330"
ATTRS{consistent_dma_mask_bits}=="64"
ATTRS{d3cold_allowed}=="1"
ATTRS{device}=="0x9d2f"
ATTRS{dma_mask_bits}=="64"
ATTRS{driver_override}=="(null)"
ATTRS{enable}=="1"
ATTRS{irq}=="156"
ATTRS{local_cpulist}=="0-7"
ATTRS{local_cpus}=="ff"
ATTRS{msi_bus}=="1"
ATTRS{msi_irqs/156}=="msi"
ATTRS{numa_node}=="-1"
ATTRS{power/async}=="enabled"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_kids}=="2"
ATTRS{power/runtime_active_time}=="1971665"
ATTRS{power/runtime_enabled}=="enabled"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="64"
ATTRS{power/runtime_usage}=="0"
ATTRS{power/wakeup}=="enabled"
ATTRS{power/wakeup_abort_count}=="0"
ATTRS{power/wakeup_active}=="0"
ATTRS{power/wakeup_active_count}=="0"
ATTRS{power/wakeup_count}=="0"
ATTRS{power/wakeup_expire_count}=="0"
ATTRS{power/wakeup_last_time_ms}=="0"
ATTRS{power/wakeup_max_time_ms}=="0"
ATTRS{power/wakeup_total_time_ms}=="0"
ATTRS{revision}=="0x21"
ATTRS{subsystem_device}=="0x8438"
ATTRS{subsystem_vendor}=="0x103c"
ATTRS{vendor}=="0x8086"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
ATTRS{power/async}=="enabled"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_kids}=="12"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_enabled}=="disabled"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="0"
#udevadm info -a -p '/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:3585' | grep -e "idVendor" -e "idProduct"
Спойлер
ATTRS{idProduct}=="0a2b"
ATTRS{idVendor}=="8087"
ATTRS{idProduct}=="0002"
ATTRS{idVendor}=="1d6b"
в файле /etc/udev/rules.d/76-muse.rules
Спойлер
ACTION=="add",SUBSYSTEM=="usb", ATTRS{idProduct}=="0a2b", ATTRS{idVendor}=="8087", RUN+="/usr/local/sbin/fixmouse/TouchPad.sh"
в файле скрипта /usr/local/sbin/fixmouse/TouchPad.sh
отдельно скрипт работает,
Спойлер
#!/bin/bash
read TPdevice <<< $( xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p' )
state=$( xinput list-props "$TPdevice" | grep "Device Enabled" | grep -o "[01]$" )
if [ "$state" -eq '1' ];then
xinput --disable "$TPdevice" && notify-send -i emblem-nowrite "Touchpad" "Disabled"
else
xinput --enable "$TPdevice" && notify-send -i input-touchpad "Touchpad" "Enabled"
fi
echo "added" >> /tmp/myusb.log
подскажите пожалуйста, что делаю не так ?