*this section has been added to the “aliencam’s Customized Ubuntu Setup Guide” page. Visit the articles page to read that article.
I just now got around to setting up automatic rotation and the accelerometer, thanks to Karol Krizka at www.krizka.net. This section of the guide is mostly copied from a few entries on this blog, as I was unable to figure out all of this stuff on my own (yes I know, I’m being lazy.)
Accelerometer
The first thing you need to do is set up the accelerometer. Doing this in Ubnutu Hardy no longer requires recompiling a kernel, which is pretty awesome.
just to make sure everything will work, in a terminal do:
sudo modprobe hdaps_ec
sudo modprobe tp_smapi
If those commands don’t return any errors, then you are in good shape.
you should then edit the kernel modules loaded on startup (if you want this to always work) to include those two.
sudo gedit /etc/modules
and add the two lines:
hdaps_ec
tp_smapi
then save and close gedit.
Test everything to make sure it is working properly
install hdaps-utils in synaptic or in the terminal with:
sudo apt-get install hdaps-utils
then run the accelerometer test by either pressing alt-F2, or running “hdaps-gl” in a terminal. Then make sure that the image reflects the actual rotation of the laptop (for example, does tilting it forward make the picture of the laptop tilt forward?). If not, go HERE and follow the troubleshooting section. Hopefully though, everything will work and you can continue on to the screen rotation.
If you don’t want automatic screen rotation, or you just want to play around with this some more, you can do things like play Neverball which is like super monkey balls (install it from the add/remove programs program, or synaptic). But I don’t know of much else (I believe the hard drive protection is not working without a recompiled kernel at the moment).
Screen Rotation
Add the python-xrandr PPA repo by opening up the “Software Sources” program and adding the following line to the “Third Party Sources” list, or by adding the line to the bottom of /etc/apt/sources.list
deb ppa.launchpad.net/displayconfig-gtk/ubuntu gutsy main
Then do:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install wacom-tools python-xrandr
Next download the atorotate.py script written by Krizka from here (sorry for posting someone else’s script, but I don’t know how to write python anyway, that’s a project for another day) and move it to /usr/local/bin. For example, if you downloaded it to your desktop the code would be:
sudo mv /home/$USERNAME/Desktop/autorotate.py /usr/local/bin replacing “$USERNAME” with your username.
Then make sure it is executable:
sudo chmod +x /usr/local/bin/autorotate.py
create a file for “tabletmode” with the command:
sudo touch /etc/tabletmode
To create files that make an acpi event for putting the tablet up and down, first do:
sudo gedit /etc/acpi/events/swivel-down
and enter into that file:
# called when tablet screen swivels down (into tablet mode)
event=ibm/hotkey HKEY 00000080 00005009
action=echo tablet > /etc/tabletmode
Then,
sudo gedit /etc/acpi/events/swivel-up
and enter:
# called when tablet screen swivels up (into laptop mode)
event=ibm/hotkey HKEY 00000080 0000500a
action=echo laptop > /etc/tabletmode
Once this is finished, you have to restart ACPI (this does not restart your computer)
sudo /etc/init.d/acpid restart
< --! Then edit /etc/gdm/Init/Default in order to get the python script to run on startup (including before login)
sudo gedit /etc/gdm/Init/Default
then before the line that reads “exit0” add:
/usr/local/bin/autorotate.py& –>
Then add /usr/local/bin/autorotate.py to your “sessions” startup menu (System > Preferences > Sessions). This will make the autorotate startup script run at login. I previously had instructions to run this before the login, but this means that it runs even in a failsafe gnome session, and it caused me many problems starting up after a crash.
Save all of your work and then run the following to restart GDM (this does log you out of your computer):
sudo /etc/init.d/gdm restart
Many thanks to the following posts on krizka.net for this information. I did not know how to do the accelerometer or screen rotation before reading these.
www.krizka.net/2008/02/13/thinkpad-x61-tablet-automatic-screen-rotation-under-linux/
www.krizka.net/2008/01/23/thinkpad-x61-tablet-tilt-detection-and-ubuntu-hardy-heron/
The only issue I have found so far is that with automatic screen rotation, you must first disable compiz graphics. If you have the CompizFusion Icon in your system tray (as I recommend below), all you need to do before you flop your screen is right-click on the CompizFusion Icon, choose “select window manager” and choose “metacity”. Then when you are through with your rotated shenanigans, simply change the window manager back to Compiz.
–aliencam
Recent Comments