Page 1 of 1

Problem with ACPI events while docking.

Posted: Thu Oct 09, 2008 9:23 am
by Szelek
Hi.
I recently bought port replicator II, and it works great, but i have a question. I know that there is a possibility to automatically switch view to attached display (for example) when docking, using ACPI events. I have set all the other FN+Fx events, but I don't know how to make this thing working.
Thanks in advance.

Szelek

Posted: Fri Oct 10, 2008 9:52 pm
by lightweight
Its a little tricky to trigger an event with docking because (at least on X60s and X61s with Ultrabase) acpi_listen doesn't return anything useable. I always have power on my dock, though, so instead I just added a check when ACPI detects the AC adapter. You could save this as, say, /etc/acpi/ac.d/90-dock.sh

Code: Select all

#!/bin/sh
#requires thinkpad_acpi
STATUS=`/bin/cat /sys/devices/platform/thinkpad_acpi/subsystem/devices/dock.0/docked`

# if its docked,do this
if [ $STATUS -eq 1 ] ; then
        # replace with however you enable your external monitor
        /usr/bin/xrandr --output VGA --auto
        # do whatever else you want.

# if its undocked, do this
else
        /usr/bin/xrandr --output VGA --off
fi
There's got to be a better way to do this, I just don't know how -- anybody know the ACPI event for docking and undocking?