Hello!
I'm attempting to configure a hotkey on my Lenovo ThinkPad Twist (s230u) ultraportable tablet to rotate the display 90 degrees using xrandr each time the small "lock" button is pressed above the power button. I have the rotate script written and tested as working successfully.
I have the hotkey configured to trigger an ACPI event via a config file in '/etc/acpi/events/', and am able to correctly trigger the action from the hotkey ACPI event when I run 'acpid' as root from the CLI.
When I run it via 'systemctl start acpid', the ACPI action is not taken.
I've switched on debug mode by changing '/etc/sysconfig/acpid' to:
And I see the following in '/var/log/messages' when I press the hotkey:
Here are the contents of '/etc/acpi/actions/rotate.sh':
And the contents of '/usr/local/bin/rotate.sh':
Any assistance you can offer would be much appreciated. Please don't hesitate to let me know if any additional information that I may provide.
Thanks!
I'm attempting to configure a hotkey on my Lenovo ThinkPad Twist (s230u) ultraportable tablet to rotate the display 90 degrees using xrandr each time the small "lock" button is pressed above the power button. I have the rotate script written and tested as working successfully.
I have the hotkey configured to trigger an ACPI event via a config file in '/etc/acpi/events/', and am able to correctly trigger the action from the hotkey ACPI event when I run 'acpid' as root from the CLI.
When I run it via 'systemctl start acpid', the ACPI action is not taken.
I've switched on debug mode by changing '/etc/sysconfig/acpid' to:
Code:
OPTIONS=-dfl
Code:
Apr 5 13:11:18 jacraig-ucc acpid: received netlink event "ibm/hotkey LEN0068:00 00000080 00006020"
Apr 5 13:11:18 jacraig-ucc acpid: rule from /etc/acpi/events/thinkpad-lock matched
Apr 5 13:11:18 jacraig-ucc acpid: executing action "/etc/acpi/actions/rotate.sh"
Apr 5 13:11:18 jacraig-ucc acpid[3493]: Unable to connect to X server
Apr 5 13:11:18 jacraig-ucc acpid[3493]: Unable to connect to X server
Apr 5 13:11:18 jacraig-ucc acpid[3493]: Can't open display
Apr 5 13:11:18 jacraig-ucc acpid[3493]: /usr/local/bin/rotate.sh: line 21: [: ==: unary operator expected
Apr 5 13:11:18 jacraig-ucc acpid[3493]: /usr/local/bin/rotate.sh: line 26: [: ==: unary operator expected
Apr 5 13:11:18 jacraig-ucc acpid[3493]: /usr/local/bin/rotate.sh: line 31: [: ==: unary operator expected
Apr 5 13:11:18 jacraig-ucc acpid[3493]: Can't open display
Apr 5 13:11:18 jacraig-ucc acpid[3493]: Unable to connect to X server
Apr 5 13:11:18 jacraig-ucc acpid[3493]: Unable to connect to X server
Apr 5 13:11:18 jacraig-ucc acpid[3493]: acpid: action exited with status 1
Apr 5 13:11:18 jacraig-ucc acpid: action exited with status 1
Apr 5 13:11:18 jacraig-ucc acpid: 1 total rule matched
Apr 5 13:11:18 jacraig-ucc acpid: completed netlink event "ibm/hotkey LEN0068:00 00000080 00006020"
Apr 5 13:11:18 jacraig-ucc acpid[3493]: acpid: 1 total rule matched
Apr 5 13:11:18 jacraig-ucc acpid[3493]: acpid: completed netlink event "ibm/hotkey LEN0068:00 00000080 00006020"
Code:
#!/bin/bash
/usr/local/bin/rotate.sh -r
Code:
#!/bin/sh
#export DISPLAY=:0
FINGER_ID=`/bin/xinput | /bin/grep Atmel | /bin/sed 's/.*id=\([0-9]\+\).*/\1/'`
FINGER_DEV=`/bin/xinput list-props $FINGER_ID | /bin/grep /dev/input/event | /bin/sed "s/.*\\(\/dev\/input\/event[0-9]\+\).*/\1/"`
#STYLUS_ID=`/bin/xinput | /bin/grep Wacom | /bin/grep stylus | /bin/sed 's/.*id=\([0-9]\+\).*/\1/'`
#STYLUS_DEV=`/bin/xinput list-props $STYLUS_ID | /bin/grep /dev/input/event | /bin/sed "s/.*\\(\/dev\/input\/event[0-9]\+\).*/\1/"`
#ERASER_ID=`/bin/xinput | /bin/grep Wacom | /bin/grep eraser | /bin/sed 's/.*id=\([0-9]\+\).*/\1/'`
#ERASER_DEV=`/bin/xinput list-props $ERASER_ID | /bin/grep /dev/input/event | /bin/sed "s/.*\\(\/dev\/input\/event[0-9]\+\).*/\1/"`
if [ $1 == -r ]; then
if [ x${2}x == xx ]; then
XRANDR=`/bin/xrandr -q --verbose | /bin/grep " connected " | /bin/sed 's/.*) \(normal\|inverted\|left\|right\) (.*/\1/' | /bin/sed 's/normal/1/;s/left/2/;s/inverted/3/;s/right/0/'`
else
XRANDR=$2
fi
if [ $XRANDR == 1 ]; then
R=2
INVERT_X=1
INVERT_Y=0
SWAP=1
elif [ $XRANDR == 2 ]; then
R=3
INVERT_X=1
INVERT_Y=1
SWAP=0
elif [ $XRANDR == 3 ]; then
R=1
INVERT_X=0
INVERT_Y=1
SWAP=1
else
R=0
INVERT_X=0
INVERT_Y=0
SWAP=0
XRANDR=0
fi
/bin/xrandr -o $XRANDR
/bin/xinput set-prop $FINGER_ID "Evdev Axis Inversion" $INVERT_X $INVERT_Y
/bin/xinput set-prop $FINGER_ID "Evdev Axes Swap" $SWAP
# /bin/xinput set-prop $STYLUS_ID "Wacom Rotation" $R
# /bin/xinput set-prop $ERASER_ID "Wacom Rotation" $R
elif [ $1 == -i ]; then
echo $FINGER_DEV \(${FINGER_ID}\)
# echo $STYLUS_DEV \(${STYLUS_ID}\)
# echo $ERASER_DEV \(${ERASER_ID}\)
fi
Thanks!
Code:
[root@jacraig-ucc ~]# uname -a
Linux jacraig-ucc.adm.adp.vcu.edu 3.8.5-201.fc18.x86_64 #1 SMP Thu Mar 28 21:01:19 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux