Installing Fedora 8 (Werewolf) on a ThinkPad X61 Tablet

From ThinkWiki
Revision as of 20:38, 29 December 2007 by Ctorres1300 (Talk | contribs) (Adding key information)
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 needs 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

Hint:

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
EndSection

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

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


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"
 EndSection

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
EndSection


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 my custom patched binary rpm. You should be able to install it via
# rpm -U linuxwacom-0.7.8.3-4multitouch.fc8.i386.rpm
Now if the RPM install 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
wget http://luke.no-ip.org/x60tablet/examples/rotate
chmod ugo+x rotate
pushd /usr/local/bin
ln -s /usr/local/src/X61_XF86/rotate
popd
popd


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.

tabletgroup:x:501:cristina,root


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.
Template:Rootcmd

##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.

NOTE!
Directions under construction. Additional comments on this work should be emailed Cristina at ctorres1300 at gmail.com.