LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-08-2021, 11:42 AM   #1
pingu_penguin
Member
 
Registered: Aug 2004
Location: pune
Distribution: Slackware
Posts: 350

Rep: Reputation: 60
help with udev


Hi,
I have a Terios P4 wireless gamepad.
I have already paired it to the pc via a usbbluetooth dongle.
I just need to disable the touchpad of the gamepad upon connecting it via bluetooth, so it doesn't interfere ingame. So I wrote a script , which is as simple as :

#!/bin/bash
#
xinput set-prop 16 "Device Enabled" 0

The problem is that, with my limited bluetooth experience, the script is not getting triggered via a udev rule.
My udev rule is :

ACTION=="add", SUBSYSTEMS=="bluetooth", ATTRS{DEVNAME}=="/dev/hidraw4", RUN+="/home/pingu/scripts/terios_disable_touchpad.sh"

The script runs correctly if run seperately/independently.

Where am I going wrong with this ? Any pointers/help is appreciated.

Thanks.
 
Old 08-09-2021, 04:33 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
That will require extensive troubleshooting & testing: finding the right triggers etc.
Check out this article.
 
Old 08-09-2021, 05:22 AM   #3
pingu_penguin
Member
 
Registered: Aug 2004
Location: pune
Distribution: Slackware
Posts: 350

Original Poster
Rep: Reputation: 60
I managed to resolve this matter via settings in the xfce menu (duh).
After connecting my gamepad , start/applications menu -> settings -> mouse and touchpad , dropdown box in devices tab will show touchpad , disable it. (silly me)

But I hope to resolve it through a udev rule someday.

Thanks.
 
Old 08-09-2021, 05:50 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Running xinput may take too long for udev - you might have to offload it to a systemd unit. Which of course you will also have to write. Settings would be my go-to while it works.
 
Old 08-09-2021, 05:59 AM   #5
pingu_penguin
Member
 
Registered: Aug 2004
Location: pune
Distribution: Slackware
Posts: 350

Original Poster
Rep: Reputation: 60
Does udev run scripts as root by default ?
I ran the script as root but it showed "cannot connect to X display" or something.
So I added a "export DISPLAY=:0.0" to the very beginning of the script and it ran.

I tried a hell lot of variations of udev rules including ATTRS{DEVPATH}, ATTRS{DEVNAME} etc and none of them worked.
Playing games, the KISS philosophy simply wins by disabling it using gui settings.
 
Old 08-09-2021, 08:53 AM   #6
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Sorry, discard it.

Last edited by shruggy; 08-09-2021 at 08:55 AM.
 
Old 08-09-2021, 12:08 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by pingu_penguin View Post
Does udev run scripts as root by default ?
I ran the script as root but it showed "cannot connect to X display" or something.
So I added a "export DISPLAY=:0.0" to the very beginning of the script and it ran.

I tried a hell lot of variations of udev rules including ATTRS{DEVPATH}, ATTRS{DEVNAME} etc and none of them worked.
Playing games, the KISS philosophy simply wins by disabling it using gui settings.
The article I linked addresses all this.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UDEV: Unable to run a command line interface script after USB automount using udev mohamr2 Linux - Embedded & Single-board computer 8 08-16-2011 10:39 AM
[SOLVED] Chose udev for services... udev starts twice... hotplug fails flipjarg Linux - Newbie 2 09-19-2010 12:49 PM
UDEV - SBLive(emu10k) - Mandriva hangs at UDEV during boot.....still! Grrr. peterlowrie Linux - Hardware 2 05-23-2010 06:37 PM
current users - udev-128 - don't forget rc.udev.new! tobyl Slackware 3 10-08-2008 03:28 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration