$this->bbcode_second_pass_code('', '/etc/udev/rules.d/98-plugin.rules
cat /etc/udev/rules.d/98-plugin.rules
ACTION=="add", ATTRS{idVendor}=="093a", ATTRS{idProduct}=="2510", RUN+="/usr/bin/notify-send mouse inserito"')
why when i unplug then plug i get no message?
(from dmesg when i plug)
$this->bbcode_second_pass_code('', 'input: PixArt USB Optical Mouse as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5.1/1-1.5.1.4/1-1.5.1.4:1.0/0003:093A:2510.0005/input/input4
')
as suggested
$this->bbcode_second_pass_code('', 'ACTION=="add", SUBSYSTEM=="usb", ENV{XAUTHORITY}="/home/enrico/.Xauthority", ENV{DISPLAY}=":0", ATTRS{idVendor}=="093a", ATTRS{idProduct}=="2510", ENV{REMOVE_CMD}="/home/alarm/touchpadon.sh", RUN+="/home/enrico/touchpadoff.sh"
ACTION=="remove", SUBSYSTEM=="usb", ENV{XAUTHORITY}="/home/enrico/.Xauthority", ENV{DISPLAY}=":0", ATTRS{idVendor}=="093a", ATTRS{idProduct}=="2510", ENV{REMOVE_CMD}="/home/alarm/touchpadoff.sh", RUN+="/home/enrico/touchpadon.sh"
')
The script detect the mouse and enable or disable
something like this:
$this->bbcode_second_pass_code('', '#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
xinput enable $ID
or
declare -i ID
ID=`xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
xinput disable $ID
')