Sunday, October 31, 2010

Ubuntu 10.10 on a Tablet PC: HP 2730p

If you have one of these cool Tablet PC's, you probably have a Windows operating system installed on it.. Don't you think that it is time to switch to a Linux distribution?.. And that was exactly what I had been thinking for a quite time.. I got bored of all Windows applications and its neverending problems.. Additionally, I'm the kind of person who is not able to use Windows Vista =) Sooo big time!..

First of all, there is always some risks to take.. because it is difficult to be sure, if everything will function properly or not.. Well, I thought of the worst case which is using that Tablet PC as a normal laptop PC without tablet functionalities =) Ok, this is still a big risk, but anyway I decided once and went for it..

Am a fan of Ubuntu, so I wanted to install Ubuntu 10.10(latest version for now) on HP2730p.. Everything went well, Ubuntu installation was completed in 15-20 minutes.. I didn't have any driver problems, so I was in the worst case now =)

After googling around, I found some nice softwares for Tablet PCs:
  • Cellwriter: It's a grid-entry natural handwriting input panel.. And I can say that it works like a charm.. After spending 5-10 minutes for the training part, it recognizes quickly your handwriting..
  • Xournal It's an application for notetaking, sketching, keeping a journal using a stylus. It's also a very nice application that you can use for taking notes.
I also configured Gimp and InkScape by enabling tablet input devices such as stylus, eraser and cursor; which is described in Ubuntu Community page.

Everything was fine, but I realized that I had some problems related to screen rotation.. because as an example, while reading an e-book, it is better to rotate the screen.. Googled about it, many solutions many scripts.. tried many of them.. some worked but not completely.. then, I combined some solutions and finally had that feature working..

I suppose that you have "wacom-tools" package installed, if not please install it first.. Then, type on a terminal:

$ xinput --list

You'll have an output similar to that one:

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ HID 04b3:3107 id=10 [slave pointer (2)]
⎜ ↳ PS/2 Generic Mouse id=12 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
↳ Serial Wacom Tablet stylus id=15 [slave pointer (2)]
↳ Serial Wacom Tablet eraser id=14 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ CKA7240 id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ HP WMI hotkeys id=16 [slave keyboard (3)]

Important entries are represented as bold text.. Now, we will use this information to rotate the screen and related tablet input devices.. I modified these two scripts written by "Justin Linuturk Phelps", to have screen rotation functionality for my case..

1. laptopmode.sh
#!/bin/bash

xrandr -o normal && xsetwacom set "Serial Wacom Tablet stylus" Rotate none && xsetwacom set "Serial Wacom Tablet eraser" Rotate none
exit 0

This mode is your normal mode that you can use without tablet pc functionalities..

2. tabletpcmode.sh
#!/bin/bash

xrandr -o right && xsetwacom set "Serial Wacom Tablet stylus" Rotate CW && xsetwacom set "Serial Wacom Tablet eraser" Rotate CW
exit 0

This mode is your tablet mode that you can use with a screen rotation..

Replace bold texts, with the outputs that you get when listing inputs..

After saving these two files as scripts(with .sh extension), move them to /usr/local/bin folder and then, type in a terminal:
/usr/local/bin$ sudo chmod +x laptopmode.sh
/usr/local/bin$ sudo chmod +x tabletpcmode.sh

Now, these scripts are executable by the user.. It is easier to create application launchers, instead of running scripts from a terminal..
1. Right click on your Ubuntu panel, and choose "Add to Panel"..
2. Double click on "Custom Application Launcher", as a name type: "Laptop Mode" and as the command type: "laptopmode.sh". You can also change the icon of your custom application.
3. Click ok.

Do the same thing for "Tablet Mode" application launcher..

Finally, you have two icons on your panel that you can use to switch from Laptop Mode to Tablet Mode and vice-versa.. Hope this helps.. Thankfully, I made a good choice and it works perfectly.. Thanks to everyone who submitted useful information on web...