Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was calibrating my touch screen, and saw that the best tool around was xinput_calibrator. So I used it. It have two options (one of which did not work), so I am here for the second. It says I should execute this command "in a script that starts with your X session":

xinput set-int-prop "3M 3M USB Touchscreen - EX II" "Evdev Axis Calibration" 32 14410 2146 14574 2115

So I tried ~/.xinitrc, ~/.xsession and ~/.xsessionrc, all of which did not exist. So I created them and the exact content was this command. The first two files made my logins fail (after I login, I fall back to the login screen).

With the last file, the calibration was functional, but only after logging in...

I need that command to run before the login dialog shows up. I thought of adding this command to the end of /etc/X11/xinit/xinitrc with no result (nothing changed). Also, I tried to add it to the end of /etc/X11/Xsession.d/40x11-common_xsessionrc (after inspecting some of the files), but the result was exactly the same as adding it to ~/.xsessionrc.

How can I make this command run before the login screen shows (is this before the window manager starts, or before the X session starts)?

Any clue will be appreciated. Thanks in advance.

(I am running Kubuntu with the default window manager, if that matters)

UPDATE As I am using Kubuntu, my display manager is kdm. As the accepted answer suggests, I edited the file /etc/kde4/kdm/Xsetup, and as mentioned here I added the command before the command that is there by default. And it works like a charm :)

share|improve this question
4  
What login manager are you using? For gdm3 you can probably use /etc/gdm3/Init/display or /etc/gdm3/Init/Default - manpages.debian.net/cgi-bin/… –  Ulrich Dangel Jul 8 '12 at 23:08

4 Answers 4

up vote 7 down vote accepted

All the files you tried to change are read after you log in. Furthermore, ~/.xinitrc and ~/.xsession are the full set of commands that run in a session; ~/.xinitrc is read if you run xinit or startx from a text mode prompt, and ~/.xsession is read if you run a “custom session” (the name may vary) from a graphical login prompt.

You need to configure your display manager, the program that shows the login prompt. For kdm, the KDE display manager, add your command to /etc/kde4/kdm/Xsetup (or /etc/kde3/kdm/Xsetup for older versions) (that's the path on Debian, I haven't verified that Kubuntu uses the same path).

For gdm (the Gnome display manager), add your command to /etc/gdm/Init/Default. For xdm (the traditional X display manager), add your command to /etc/X11/xdm/Xsetup.

share|improve this answer
    
Thanks for the explanation! I tried what you suggested without success. I located the Xsetup file (in the same path you mentioned) and added the command. The calibration did not work, but I made sure it was executed, by adding echo "w" > /test.log, and verifying /test.log did exist after reboot. Is it possible that xinput requires special "context" or something... ? –  jadkik94 Jul 10 '12 at 21:11
    
Actually, disregard the last comment. I redirected the xinput command to that file, and it seems I had added a space to the device name which made the calibration not work. You were 100% correct :) Thanks again. –  jadkik94 Jul 10 '12 at 21:19
2  
And just to complete the answer - to find out what is your display manager (not to be confused with a desktop environment) use: cat /etc/X11/default-display-manager. –  Nux Oct 23 '12 at 9:12

You could try /etc/rc.local ?

.

share|improve this answer
3  
I was concerned the script would run before X even starts (as I understood it), which would render that script useless... When does this run? –  jadkik94 Jul 8 '12 at 21:03
2  
@jadkik94 you are right this won't work as rc.local doesn't have access to the x session. –  Ulrich Dangel Jul 8 '12 at 23:04

When you have OpenSUSE you can copy your script to /etc/init.d and run insserv script name. insserv enables a script: http://man-wiki.net/index.php/8:insserv.

share|improve this answer
2  
This probably won't work as xinput needs probably X which is not available/initialized in the init scripts –  Ulrich Dangel Jul 8 '12 at 23:04

I suggest that you create your own config file, a simple example:

/usr/lib/X11/xorg.conf.d/20-calibration.conf

Filecontent:

Section "InputClass"
         Identifier "Calibration"
         MatchProduct "3M 3M USB Touchscreen - EX II"
         Option "Calibration" "14410 2146 14574 2115"
EndSection

That should do the trick.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.