You are not logged in.

#1 2014-01-20 20:18:06

will.price94
Member
From: UK
Registered: 2011-11-09
Posts: 63
Website

XRandR issues

Hello,

I've got a udev script triggering `autorandr -c` that is meant to load an xrandr configuration. This works fine if I trigger it myself inside an X session. When I try and run it outside of an X session after exporting:

DISPLAY=:0.0
XAUTHORITY=/home/will/.Xauthority

I get an error:

/usr/bin/xrandr: Configure crtc 1 failed

but this is only the case when run outside of an X session, are there some more environmental variables I need to set? I'm running the script as the same user as the X session.

Offline

#2 2014-01-22 08:21:02

ilsensine
Member
Registered: 2013-03-26
Posts: 32

Re: XRandR issues

It seems that the X session must be active for xrandr to succeed. I reproduced your problem trying to change the current mode inside a console (ctrl+alt+f1). However, if I execute someting like
sleep 5; xrandr [...]
and switch to the X screen (ctrl+alt+f7) before the 5 seconds elapse, xrandr succeeds.
Using chvt for changing the active terminal also works:
chvt 7; xrandr [...]
but I don't know if chvt is allowed within a udev script.

Offline

#3 2014-01-23 13:23:59

will.price94
Member
From: UK
Registered: 2011-11-09
Posts: 63
Website

Re: XRandR issues

Hi ilsensine,

Thanks for your response, nice observation! I've tried tried running
`sleep 5; ./some_xrandr_commands.sh` in a terminal and switching back to my terminal with the X session and the commands execute succesfully.

My udev script doesn't seem to be able to run the chvt command. I'll submit a bug report on the off chance it is one. I used to be able to run xrandr commands in udev scripts...

Offline

#4 2014-02-18 15:43:07

pngaudioguy
Member
From: Belgium
Registered: 2014-02-18
Posts: 3

Re: XRandR issues

will.price94 wrote:

I used to be able to run xrandr commands in udev scripts...

I've decided to mess around with Arch Linux after a few years of using Debian. Overall, I'm really happy with it. I like that there's only one set of init script rules (systemd) and quite a few of the programs I like to use are readily available in the standard package manager, with others readily available in the AUR.

HOWEVER, the one thing I haven't gotten working yet is transferring my nicely configured udev rule and xrandr script for when I dock my laptop at work. It worked beautifully under Debian, and I couldn't tell if I've just misconfigured something or not for how Arch likes things until I found this thread.

The symptoms are exactly the same as yours, and using the sleep or chvt lines as ilsensine noted makes the script work perfectly, except when called from the RUN+="/path/to/script" in udev.

Did you submit a bug report? I'd love to follow it to see what the developers have to say, as I also would like this exact functionality.

Offline

#5 2014-02-18 15:45:27

will.price94
Member
From: UK
Registered: 2011-11-09
Posts: 63
Website

Re: XRandR issues

Hi pngaudioguy,

I didn't submit a bug report in the end as I was unsure where this problem lays. I suggest you open a bug report on the Arch bugtracker. I'm currently on XUbuntu so wouldn't be of much use... (I switched because of this issue!)

Best of luck smile

Offline

#6 2014-02-18 15:49:51

pngaudioguy
Member
From: Belgium
Registered: 2014-02-18
Posts: 3

Re: XRandR issues

Quick response! It's not a deal breaker for me - easy enough to bind a key combination to an xrandr command, but certainly is convenient to flip open the laptop, login, and it automatically knows the extra monitor is there and places it where I like it. Suspend, turn back on at home, log in, and the system knows the monitor is gone.

That said, I think it is a significant enough use case (I highly doubt we're the only two people who use that, based on web search results) that I'll have to mess with the Arch bugtracker. I only just installed Arch about 4 hours ago, and have been fiddling with this for about an hour, so it's not like I've really pushed all that hard yet... I'll play with it more this evening and see if I didn't just leave something "Debianized."

Offline

#7 2014-02-19 08:00:16

pngaudioguy
Member
From: Belgium
Registered: 2014-02-18
Posts: 3

Re: XRandR issues

I didn't get a chance to look at this last night, but sat down to see if I could figure it out this morning in a few minutes before work. Uh, it's just working as expected this morning, with no changes from yesterday. I have created the following two files, in case anyone else has this issue - hopefully this can be of assistance.

I am using a Dell Latitude e6410, on kernel 3.12.9-2-ARCH #1 SMP PREEMPT x86_64. I have i8kutils from extra installed as it provides Dell Inspiron/Latitude specific kernel drivers and utilities.

File /etc/udev/rules.d/90-docking-station.rules

## ID 413c:2513 Dell Computer Corp. Internal USB Hub of E-Port Replicator
ACTION=="add|remove", SUBSYSTEM=="usb" ENV{ID_SERIAL}=="413c_2513", RUN+="/usr/local/bin/dock-action $env{ACTION}"

File /usr/local/bin/dock-action

#!/bin/bash
export DISPLAY=:0

case "${1}" in
"add")
	/usr/bin/sudo -u username /usr/bin/bash -c '/usr/bin/xrandr --output eDP-1 --mode 1280x800 --pos 0x0 --output DP-1 --mode 1680x1050 --pos 1280x0'
        ;;
"remove")
	/usr/bin/sudo -u username /usr/bin/bash -c '/usr/bin/xrandr --output eDP-1 --mode 1280x800 --pos 0x0 --output DP-1 --off'
        ;;
esac

# EOF

Obviously the device ID_SERIAL, resolutions, and xrandr output names would have to be modified to each local environment.

Offline

Board footer

Powered by FluxBB