Comment 12 for bug 159026

Revision history for this message
Florian Hackenberger (f-hackenberger) wrote : Re: Lenovo Thinkpad x41 Tablet and X60 Tablet rotate events

The scripts as well as the rotate daemon work fine on Ubuntu Hardy on an X61t here. I modified the scripts as follows to start/stop the rotate daemon as needed. The daemon is only useful when in tablet mode, therefore starting it using an init script is not ideal IMO. Adding / removing the kernel module within the swivel scripts might not be what you want though.

----------------------------------------------------------------------------------------
#!/bin/sh
#/etc/acpi/swivel-panel-down.sh

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

for x in /tmp/.X11-unix/*; do
    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
    getXuser;
    if [ x"$XAUTHORITY" != x"" ]; then
        export DISPLAY=":$displaynum"
        if /usr/bin/xrandr --output LVDS --rotate inverted; then
                /usr/bin/xsetwacom set stylus rotate 3
        fi
        modprobe hdaps_ec
        killall rotate_daemon
        /usr/bin/rotate_daemon &
    fi
done
----------------------------------------------------------------------------------------
#!/bin/sh
#/etc/acpi/swivel-panel-down.sh

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

for x in /tmp/.X11-unix/*; do
    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
    getXuser;
    if [ x"$XAUTHORITY" != x"" ]; then
        export DISPLAY=":$displaynum"
        if /usr/bin/xrandr --output LVDS --rotate normal; then
                /usr/bin/xsetwacom set stylus rotate 0
        fi
        killall rotate_daemon
        sleep 0.5;
        modprobe -r hdaps_ec
    fi
done
----------------------------------------------------------------------------------------