You are not logged in.

#1 2014-02-06 14:42:52

Chocobo
Member
Registered: 2006-09-26
Posts: 26

Docking station hooks/scripts for monitor configuration

Hi All,

My work computer is a Latitude E6430s w/ docking station & dual monitors.  I am trying to figure out how to detect a change in docking status and configure the monitors correctly.   I have tried this udev hook:

DEVPATH=="/devices/pci0000:00/0000:00:02.0/drm/card0", ACTION=="change", RUN+="/opt/laptop-dock.sh"

and this is laptop-dock.sh:

#!/bin/sh
sleep 0.5
DOCKED=$(cat /sys/devices/platform/dock.0/docked)
case "$DOCKED" in
        "0")
       xrandr -d :0.0 --output LVDS1 --primary --auto --output HDMI2 --off --output HDMI2 --off
        ;;
        "1")
       xrandr -d :0.0 --output LVDS1 --off --output HDMI2 --primary --auto --output HDMI3 --right-of HDMI2 --auto
        ;;
esac                                                                                                                                                                               
exit 0

However this does not seem to work, especially when un-docking.

Does anyone have any suggestions? 

Thanks,
Sam

Offline

#2 2014-02-06 17:59:15

gegenschall
Member
From: Munich, Germany
Registered: 2013-10-09
Posts: 33

Re: Docking station hooks/scripts for monitor configuration

I do not know how Dell Docks work, I can only speak for Lenovo but it might be the same. As far as I understand, docking events get handled by the Kernel using the acpi module "dock" (it's built in on stock Arch kernels). They expose their stuff using ACPI input events. See if you have something similar like this under /dev/input/:

$ ls -l /dev/input/by-path
--- snip ---
lrwxrwxrwx 1 root root   9 Feb  6 03:09 platform-thinkpad_acpi-event -> ../event5
--- snip ---

With acpid you can listen for those events and configure actions. Using acpi_listen gives me the following output on dock/undock, for example:

# acpi_listen
--- snip ---
ibm/hotkey LEN0068:00 00000080 00004011 # <- Undock event
--- snip ---
ibm/hotkey LEN0068:00 00000080 00004010 # <- Dock event

Cheers

Offline

#3 2014-02-06 18:37:24

Chocobo
Member
Registered: 2006-09-26
Posts: 26

Re: Docking station hooks/scripts for monitor configuration

Hmm, unfortunately I do not think I have anything like that:

[swinchen@mainsail ~]$ ls -l /dev/input/by-path
total 0
lrwxrwxrwx 1 root root  9 Feb  6 09:32 pci-0000:00:14.0-usb-0:4.1:1.2-event-mouse -> ../event1
lrwxrwxrwx 1 root root  9 Feb  6 09:32 pci-0000:00:14.0-usb-0:4.1:1.2-mouse -> ../mouse0
lrwxrwxrwx 1 root root  9 Feb  6 09:32 pci-0000:00:14.0-usb-0:4.2:1.0-event-kbd -> ../event2
lrwxrwxrwx 1 root root  9 Feb  6 09:32 pci-0000:00:14.0-usb-0:4.2:1.1-event -> ../event3
lrwxrwxrwx 1 root root 10 Feb  6 09:32 pci-0000:00:1a.0-usb-0:1.5:1.0-event -> ../event17
lrwxrwxrwx 1 root root  9 Feb  6 09:32 platform-i8042-serio-0-event-kbd -> ../event0
lrwxrwxrwx 1 root root 10 Feb  6 09:32 platform-i8042-serio-1-event-mouse -> ../event20
lrwxrwxrwx 1 root root  9 Feb  6 09:32 platform-i8042-serio-1-mouse -> ../mouse2

From an undock/dock cycle:

[swinchen@mainsail ~]$ sudo acpi_listen
jack/lineout LINEOUT unplug
ac_adapter ACPI0003:00 00000080 00000000
battery PNP0C0A:00 00000080 00000001
battery PNP0C0A:02 00000080 00000000
processor LNXCPU:00 00000081 00000000
processor LNXCPU:01 00000081 00000000
processor LNXCPU:02 00000081 00000000
processor LNXCPU:03 00000081 00000000
 PNP0C14:00 000000d0 00000000
jack/lineout LINEOUT plug
ac_adapter ACPI0003:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001
battery PNP0C0A:02 00000080 00000000
processor LNXCPU:00 00000081 00000000
processor LNXCPU:01 00000081 00000000
processor LNXCPU:02 00000081 00000000
processor LNXCPU:03 00000081 00000000
 PNP0C14:00 000000d0 00000000

Last edited by Chocobo (2014-02-06 18:46:08)

Offline

#4 2014-02-06 19:10:52

aesiris
Member
Registered: 2012-02-25
Posts: 97

Re: Docking station hooks/scripts for monitor configuration

What do you get by udev?

udevadm monitor --property

Offline

#5 2014-02-06 19:17:36

Chocobo
Member
Registered: 2006-09-26
Posts: 26

Re: Docking station hooks/scripts for monitor configuration

aesiris wrote:

What do you get by udev?

udevadm monitor --property

Due to the length of the output I created this paste:  http://paste.openstack.org/raw/62857/

Offline

#6 2014-07-01 20:57:23

church
Member
Registered: 2014-07-01
Posts: 1

Re: Docking station hooks/scripts for monitor configuration

I couldn't find any usable hook to simply find if my Latitude e6520 is docked. Suggested  udev / acpi related debug output didn't show anything usable, but then i thought that if it has usb ports, maybe something related with them maybe used for that.
For comparing lsusb outputs when docked/undocked, apart from connected usb devs to dock's ports (didn't want to rely on them, as subject to change) found nice candidate that might be unique to dock:
  lsusb
..
Bus 001 Device 029: ID 413c:2513 Dell Computer Corp. internal USB Hub of E-Port Replicator
..

Eg. try running this in both docked & undocked state:
lsusb -d 413c:2513 2>&1 > /dev/null && notify-send -u normal docked || notify-send -u critical undocked

I'm Mint user, not archlinux's, but as this thread was one of those that i googled out about when searching about dell laptops & docking stations, thus decided to post here too.

P.S.
I guess that usb IDs / device name might differ for other Dell docking stations, but generic principle may work for them as well.

Last edited by church (2014-07-01 21:00:34)

Offline

Board footer

Powered by FluxBB