LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-27-2014, 05:10 PM   #1
lopid
Member
 
Registered: Jun 2008
Posts: 156

Rep: Reputation: Disabled
Question xinput as another user


My basic question is: How do I set an xinput property on another user's X server?

I have a udev rule that runs a custom script when a particular USB device (a mouse) connects. The script runs, and all it does is set an xinput property, thus:

Code:
xinput set-prop 10 'Device Accel Constant Deceleration' 1.8
The xinput command is correct, it works when I run it in a terminal under X. However, it does not work when run from udev, ie. outside of X. I've tried prepending the DISPLAY environment (and even XAUTHORITY). My Google-fu is stretched to the limit on this one.

(I know about setting the mouse sensitivity et al via various GUIs, but I swap the mouse between two computers often and the above configured property resets itself whenever the mouse is reconnected, hence the udev rule. xset doesn't work for this, xinput does.)

Thank you.
 
Old 05-27-2014, 07:19 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It won't.

The X server has to be active for the user (not gdm/kdm/...) before the xinput can be initialized, and the process has to have the authority to connect to the Xserver to set things like that up. Udev runs as root, and doesn't have the authority.

Now if it is already hooked up you CAN add the input to the X configuration. I'm not sure what would happen if the device wasn't hooked up though - hopefully, the feature would just not work, but the worst thing that would happen is that the X server aborts, and users would be unable to log in.

Last edited by jpollard; 05-27-2014 at 07:21 PM.
 
Old 05-28-2014, 05:16 PM   #3
lopid
Member
 
Registered: Jun 2008
Posts: 156

Original Poster
Rep: Reputation: Disabled
OK, thanks. The device will always be hooked up when my udev rule is triggered. After all, it's the hooking up that triggers it. How can I "add the input to the X configuration"? Or have I misunderstood that bit?

My next move would be to detect the particular property changing from my 1.8 value and trigger something to change it back. My final move would be to just have a cron job that sets it every few seconds, regardless.
 
Old 05-28-2014, 08:54 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
There is an xorg.conf.d directory. The directory contains segments of the full xorg.conf file that has all the optional modules included. The reason it is in segments is to allow you to override only those parts of the default that are causing problems, without having to have the full (and elaborate) configuration file.
 
Old 05-30-2014, 02:52 PM   #5
lopid
Member
 
Registered: Jun 2008
Posts: 156

Original Poster
Rep: Reputation: Disabled
Doh! That did the trick. For some reason, I was under the impression that the sensitivity would still change when plugged even after X was started. Thank you for the help.
 
  


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
Touchpad issues (Xorg/xinput) sqwert Linux - Hardware 1 01-25-2013 11:13 PM
dot-xsessionrc and xinput settings under Ubuntu Jaunty SaintDanBert Linux - Desktop 0 07-11-2010 02:04 PM
XInput 'use' values not listed in spec PaladinOfKaos Programming 1 06-04-2009 06:52 PM
GTK with Xinput support pugsley SUSE / openSUSE 0 01-26-2006 05:12 PM
gtk2 with xinput support issue MayaPT Slackware 1 07-20-2005 04:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 01:31 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