[SOLVED] udev rule why is not working?

Ask questions about Arch Linux ARM. Please search before making a new topic.

[SOLVED] udev rule why is not working?

Postby acconciox » Tue Apr 25, 2017 3:34 pm

Code: Select all
/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)
Code: Select all
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

Code: Select all
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:

Code: Select all
#!/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

Last edited by acconciox on Wed Apr 26, 2017 8:21 pm, edited 3 times in total.
acconciox
 
Posts: 85
Joined: Thu May 05, 2016 4:39 pm

Re: udev rule why is not working?

Postby pepedog » Tue Apr 25, 2017 7:19 pm

pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK


Return to User Questions

Who is online

Users browsing this forum: No registered users and 2 guests