Installing Fedora 8 (Werewolf) on a ThinkPad X61 Tablet

From ThinkWiki
Revision as of 22:19, 6 March 2009 by Ctorres1300 (Talk | contribs) (Getting install images)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

X61 Tablet Keywords X61 Tablet
USB Flash Drive Boot
Fedora 8 Werewolf
AHCI Enabled Install
No DVD media

Installing Fedora 8 on a X61 tablet PC.

The X61 Tablet(X61t) installs rather "easily" with some straightforward effort. I had originally tried Fedora 7, but gave up in favor of the latest new release of Fedora 8. I did not have access to DVD a burner so I used a USB HDD and flash key for the install.

Getting install images

You will need a seperate running install to get ready for the install. First get the DVD and rescue images via bittorrent from Fedora torrent.

Preparing flash drive

{{The key will hold a boot image and rescue image. If key is large enough you can put DVD image on it also without external HDD. Wipe the MBR of the usb key via the following command. (I'm assuming your key is /dev/sdc) This takes forever so you may want to skip this step, I waited.

# dd if=/dev/zero of=/dev/sdc bs=512 count=1

Use ms-sys if you don't have it try yum install ms-sys. Otherwise go the project's homepage and install it.

# ms-sys --fat32 /dev/sdc

Find you current OSes mbr.bin to setup the master boot record of the USB key.

# locate mbr.bin
# cat /usr/lib/syslinux/mbr.bin > /dev/sdc

Use fdisk or parted to make sure you've removed all preexisting partitions from the usb key try.

# /sbin/fdisk /dev/sdc


Use options:
For fdisk
N new partition
P primary 1
1 start sector
128 end sector ~

Now make a single partition (primary #1) on the key of type FAT 32 via:

# mkfs.vfat -F 32 /dev/sdc1
# mkfs.vfat -F 32 /dev/sdc2

Now make sure via parted or fdisk to set this new partition as boot-able in fdisk this is the "a" option for partition 1. dd the bootdisk.img from the DVD to /dev/sdc1

# mount -o loop Fedora-8-i386-DVD.iso /media/cdrecorder
# dd if=/media/cdrecorder/images/diskboot.img of=/dev/sdc1

Copy rescue ISO onto second USB partition just in case.

# mount /dev/sdc2 /media/usbdisk/
# sync; umount /dev/usbdisk

Unmount everything. Try using the USB key to boot the X61 Tablet. Remember to plug in the USB HDD containing the DVD iso file. Also put the ISO in the HDD / path for ease of use.

Configuring different components of X61t

Configuring X to use your tablet features

Getting basic stylus support

In this release of Fedora the linux wacom drivers are part of the distribution. They sort of work as you would expect, minus the multitouch functionality. I will discuss getting the stylus to 'just work'. Then I will explain how to get the multitouch abilities of your tablet to work also. This is significantly more involved. You won't have to do repeat the steps for multitouch support I'll give you what you need.
We need to properly configure the Xorg.conf file so do
# cp /et/etc/X11/xorg.conf /etc/X11/xorg.conf_PRE_PEN_BACKUP
Now open the file xorg.conf in your favorite editor and give it the follows sections.

Section "InputDevice"
  Driver        "wacom"
  Identifier    "stylus"
  Option        "Device"        "/dev/ttyS1"          # SERIAL ONLY
  Option        "Type"          "stylus"
  Option        "ForceDevice"   "ISDV4"               # Tablet PC ONLY

Section "InputDevice"
  Driver        "wacom"
  Identifier    "eraser"
  Option        "Device"        "/dev/ttyS1"          # SERIAL ONLY
  Option        "Type"          "eraser"
  Option        "ForceDevice"   "ISDV4"               # Tablet PC ONLY

Section "InputDevice"
  Driver        "wacom"
  Identifier    "cursor"
  Option        "Device"        "/dev/ttyS1"          # SERIAL ONLY
  Option        "Type"          "cursor"
  Option        "ForceDevice"   "ISDV4"               # Tablet PC ONLY

Also note that in your case '/dev/ttyS1' may be different. In order to determine which tty is listening to the stylus you can do: # cat /dev/ttySx
then touch the display with the stylus you should see the shell return some sort of output to your current shell.
We also need to adjust another part of the xorg.conf file. This will tell the X server what to do with the new input devices we have configured. Adjust your server layout section to look like this.

 Section "ServerLayout"
        Identifier     "single head configuration"
        Screen      0  "Screen0" 0 0
        InputDevice    "Keyboard0" "CoreKeyboard"

We need to alter it to look like this.
Section "ServerLayout"
        Identifier     "single head configuration"
        Screen 0 "Screen0"   0 0
        InputDevice    "Keyboard0" "CoreKeyboard"
#??        InputDevice    "Mouse0"    "CorePointer"
        InputDevice    "stylus"    "SendCoreEvents"
        InputDevice    "eraser"    "SendCoreEvents"
        InputDevice    "cursor"    "SendCoreEvents" 
#??        InputDevice    "pad"   # For Intuos3/Cintiq 21UX/Graphire4/Bamboo tablets

I would like to note that the '#??' marks lines which are actually required I added them in case I plug in USB mice to the system on the run. You can safely ignore these lines, and you probably should ignore them. We are now ready to test our changes to the X server and see if it all worked. You can kill the current X server via
CtrlAltBack Space
if everything is not completly broken, (syntax errors in xorg.conf file) you should be back at the graphical login, and your stylus should be able to move the mouse cursor. You can review your X configuration by opening another new shell and doing
# xsetpointer -l
which should give you input that looks like this

[root@localhost ~]# xsetpointer -l
"<default pointer>"     [XPointer]
"Keyboard0"     [XKeyboard]
"stylus"        [XExtensionDevice]
"eraser"        [XExtensionDevice]
[root@localhost ~]# 

There are many options that can be adjusted to make your stylus suit your preferences. I'll expand that later if I get around to it. Otherwise, just experiment. The command which will let you adjust your stylus traits 'on the fly' is
$ xsetwacom

Getting multitouch support with you X61 tablet

In the process of trying to get my tablet fully functional, I did a great deal of research. You will find if you have a tablet with multitouch support, the behavior given the above 'basic' X configuration is just terrible. You can't really use the stylus like you would like. The cursor is erratic. Instead you need to try a different wacom driver. Actually this is tweaked wacom driver. I'd like to thank, Russell Sears immensely for writing the patch you'll need and for helping me understand the software patching process. I've gone ahead and built a RPM using the source RPM that that is available from the fedora project homepage. I won't get into the steps to rebuild the source RPM. (I may in the future.) There is a good guide for patching SRPMS written by a guy named Brad. My directions to you is to just grab custom patched binary rpm. You should be able to install it via
# rpm -U linuxwacom-

Later breaking of multitouch support

As packages are upgrade when xorg rpm gets updated, you'll need to replace the newer wacom rpm for F 8 that is installed during the upgrade. You'll notice when this happens when you multi-touch and stylus start acting up again! You'll notice you now have linuxwacom- KILL IT. I've recompiled the patch into linuxwacom- and artifically incremented the version number. Not good, I must admit, but it works. You can get this redone RPM here. This should take care of the problems. Email me if anyone notices that this didn't work it worked on my tablet.

Now if the RPM installs correctly. Please let me know if you have trouble with it. You should have a stable stylus and useable multitouch support. You may need to install at least one additional RPM to get this patched RPM to work, I'm not sure. The RPM would be xorg-x11-server-sdk, you can get it via yum.

Setting up X61 Tablet keys

A few of the tablet keys are working out of the box after you install Fedora 8. The keys that worked out of the box for me are {key|Esc}, the 'luggage' icon key, and the directional pad. These keys all are recognized by the kernel. The keycodes of interest that need to be mapped during tablet use are the rotate button and the directional pad. As you rotate the screen, the directional pad orientation should change also. I'll discuss how to do that with existing scripts also. For reference the key codes I found were done by using a few different methods. To test for keycodes we can use
$ xev
from this you can see the keycodes as recognized by the X server. The following is a table of the codes for a few of the tablet keys.

Keymap via 'showkeys' then 'xev'
Screen Rotate  191         219
Pad Up         103         98
Pad Down       108         104
Pad Left       105         100
Pad Right      106	   102
Pad Press       28          36
Escape                       9

I prefer a global key mapping so we will edit the X server global Xmodmap file via the following commands. You should be able to just cut and paste these lines into your shell to accomplish this.

cp /etc/X11/Xmodmap    /etc/X11/Xmodmap.ORIGINAL
echo "! Custom Xmodmap for X61 Tablet PC" > /etc/X11/Xmodmap
xmodmap -pke >> /etc/X11/Xmodmap
echo "!">> /etc/X11/Xmodmap
echo "! Key code mapping for Screen Rotation -- XF86User1KB" >> /etc/X11/Xmodmap
echo "keycode 219 = XF86User1KB" >> /etc/X11/Xmodmap
echo "!">> /etc/X11/Xmodmap

Now X windows will return the keysym label of XF86User1KB. So we will setup an action to associate with the rotate tablet key. I found a really good python script for doing this by a guy named Luke. You should be able to 'install' this script cutting and pasting the following commands as root.

mkdir /usr/local/src/X61_XF86
pushd /usr/local/src/X61_XF86
chmod ugo+x rotate
pushd /usr/local/bin
ln -s /usr/local/src/X61_XF86/rotate

In order to provide access to remap keys on the go during an X session, we will need to use sudo which will allow specific users of our choice to invoke the needed key mappings when the rotate screen button is pressed. In order to control which users can rotate the display and adjust key mappings we will create a new user group to manage with the sudo tool. The group will be called 'tabletgroup' and we will include any users we want to be able to rotate the screen into this user group. Using the other entries in the /etc/group file as a guide add a line to the group file which will resemble.


Notice in the example I plan on adding root and myself as users which can in the future rotate the display. I've added root for completeness. In the future adding the rotate feature to other laptop users will be as easy as addiing the user id to the end of this line. Now you can use visudoer as root to add the following to your /etc/sudo file.
# visudoer

##Allow users to do tablet screen rotations if in this group 
%tabletgroup    ALL=(ALL)       NOPASSWD:/usr/bin/setkeycodes,/usr/local/bin/rotate

along with one other edit to the sudo file where we allow users to not be associated with a tty. This is needed so that when X invokes the rotate script on your behalf you can actually be allowed to remap the keys.

#Defaults    requiretty

, notice I've commented out the requiretty option in the sudo file.

Automagic screen rotation

To enable rotate to occur when you fold the laptop to resemble a sheet of paper you will rely on acpi which tracks the events associated with the lcd swivel. Looking in /var/log/messages immediately after swiveling and return the lcd to laptop mode you should see:

[root@localhost ~]# tail /var/log/messages | grep acpi
Dec  8 00:43:08 localhost kernel: thinkpad_acpi: unknown LID-related hotkey event: 0x5009
Dec  8 00:43:18 localhost kernel: thinkpad_acpi: unknown LID-related hotkey event: 0x500a
[root@localhost ~]# 

We can find the exact matching syntax for the event line by doing /etc/init.d/acpid stop acpid --debug

Watch the output when you swivel the screen, one you are finished Ctrl-C

Now we can create the two action files for acpid to execute for going from laptop to flat tablet we call that X61ToTablet for the reverse procedure we call it TabletToX61

Use the following commands to create these files

echo "#Event config when going to laptop to tablet mode" >> /etc/acpi/events/X61ToTablet.conf
echo "event=ibm/hotkey HKEY 00000080 00005009" >> /etc/acpi/events/X61ToTablet.conf
echo "action=/usr/local/bin/rotate tablet" >> /etc/acpi/events/X61ToTablet.conf
echo "#Event config when going to tablet to laptop mode" >> /etc/acpi/events/TabletToX61.conf
echo "event=ibm/hotkey HKEY 00000080 0000500a" >> /etc/acpi/events/TabletToX61.conf
echo "action=/usr/local/bin/rotate laptop" >> /etc/acpi/events/TabletToX61.conf

Restart the acpid service so the conf files can be used. /etc/init.d/acpid restart This should work but I find that I need to restart ACPI to get the automatic rotation working. If anyone knows how to fix this behavior let me know.

Directions under construction. If you see any glaring omissions or anything let me know. (Cristina) ctorres1300 at gmail dot com.