I own a Thinkpad with an UltraBase (a docking station). My operating system is Ubuntu 10.10. Now, I would like to react on the "docking" event by setting the resolution of my external display correctly. Here is what I've done already:
$ udevadm info -a -p /sys/devices/platform/dock.0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/platform/dock.0':
KERNEL=="dock.0"
SUBSYSTEM=="platform"
DRIVER==""
ATTR{modalias}=="platform:dock"
ATTR{docked}=="0"
ATTR{flags}=="16"
ATTR{uid}=="0"
ATTR{type}=="dock_station"
looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""
Then, I've created a udev-rule:
$ cat /etc/udev/rules.d/99-docking.rules
KERNEL=="dock.0", ATTR{docked}=="1", RUN+="/usr/local/sbin/dock.sh"
The script /usr/local/sbin/dock.sh is as follows:
#!/bin/sh
# turn external display on, internal off
echo "hello world" >> "/home/hoppe/udev.out"
/usr/bin/xrandr --output LVDS1 --off
/usr/bin/xrandr --output DP2 --mode "1920x1080"
echo "hello world" >> "/home/hoppe/udev.out"
exit
Both echo-commands are execute without any problems. Also, while calling the script manually, the resolution is set correctly. What have I done wrong?
export XAUTHORITY=/home/$USERNAME/.Xauthority export DISPLAY=:0 – labrassbandito Jun 12 '11 at 12:31