Friday, November 10, 2006

Fedora Core 6 on a Toshiba Tecra M7 S7331 Tablet PC

After running Fedora Core on a few desktops and laptops over the past year, I would like to share my experience of installing the latest version of Fedora on a this tablet PC in the hope that it is helpful to some one.

Here is the specification of the tablet PC
  • Intel Core Duo T2400 @ 1.83GHz, 2MB L2, 667MHz FSB
  • 1024 MB RAM PC4200 DDR2 SDRAM
  • 14.1" WXGA 1440 x 900 native resolution
  • Intel Graphics Media Accelerator 950 (GMA 950) graphics chipset - works out of the box, had to use 915resolution utility to achieve native resolution
  • 100 GB SATA HDD
  • Intel PRO / Wireless 3945ABG not yet tested. (Yes! I dont have a wireless network at work to see if the card works!)
  • Intel PRO/1000 VE Network Connection - works out of the box
  • 5 in 1 media adapter - works out of the box
  • Fingerprint Reader not yet tested
  • Touchpad pointing device - works out of the box
  • Wacom Stylus - drivers ship with FC6 but doesnt give you all you need
I resized my Windows partition by booting with Knoppix (Linux on CD ) and ntfsresize. Be sure to do a clean shutdown in your Windows partition before booting to Knoppix or ntfsresize may find inconsistencies in your NTFS partition and wont resize it. As always make sure you back up all your filess before attempting to resize your Windows partition.

The installation went smoothly without any hitches. I was very happy to see that my gigabit Ethernet adapter was recognized automatically and worked right away. If not, use the e1000 driver available here. You will need hardlink, kernel-devel and gcc to compile from source.

FC6 comes with built in support for Intel GMA 950. My system was using the default VESA driver. I was able to change it to Intel GMA 945 / 950 driver without any issues using the system-config-display (Desktop | System Settings | Display) program and the Monitor type as well. The resolution I was able to get was 1280 x 800. To achieve native resolution, I had to use the 915resolution utility. The utility lets you hack the Intel Video BIOS and lets you overwrite a display mode with resolution of your choice.

[root@localhost ~/915resolution-0.5.2]$./915resolution -l
Intel 800/900 Series VBIOS Hack : version 0.5.2

Chipset: 945GM
BIOS: TYPE 1
Mode Table Offset: $C0000 + $269
Mode Table Entries: 36

Mode 30 : 640x480, 8 bits/pixel
Mode 32 : 800x600, 8 bits/pixel
Mode 34 : 1024x768, 8 bits/pixel
Mode 38 : 1280x1024, 8 bits/pixel
Mode 3a : 1600x1200, 8 bits/pixel
Mode 3c : 1920x1440, 8 bits/pixel
Mode 41 : 640x480, 16 bits/pixel
Mode 43 : 800x600, 16 bits/pixel
Mode 45 : 1024x768, 16 bits/pixel
Mode 49 : 1280x1024, 16 bits/pixel
Mode 4b : 1600x1200, 16 bits/pixel
Mode 4d : 1920x1440, 16 bits/pixel
Mode 50 : 640x480, 32 bits/pixel
Mode 52 : 800x600, 32 bits/pixel
Mode 54 : 1024x768, 32 bits/pixel
Mode 58 : 1280x1024, 32 bits/pixel
Mode 5a : 1600x1200, 32 bits/pixel
Mode 5c : 1920x1440, 32 bits/pixel
Mode 63 : 512x771, 8 bits/pixel
Mode 64 : 512x771, 16 bits/pixel
Mode 65 : 512x771, 32 bits/pixel

I'm not going to use mode 3c, as 1920 x 1440 resolution is beyond what my display can support. I overwrote the display mode as shown below.


[root@localhost 915resolution-0.5.2]# ./915resolution 3c 1440 900 24

3c is the mode I would like to overwrite, 1440 and 900 are the horizontal and vertical resolutions respectively and 24 is the depth (24 bit). Now I list the VBIOS supported resolutions as below

[root@localhost 915resolution-0.5.2]# ./915resolution -l
Intel 800/900 Series VBIOS Hack : version 0.5.2

Chipset: 945GM
BIOS: TYPE 1
Mode Table Offset: $C0000 + $269
Mode Table Entries: 36

Mode 30 : 640x480, 8 bits/pixel
Mode 32 : 800x600, 8 bits/pixel
Mode 34 : 1024x768, 8 bits/pixel
Mode 38 : 1280x1024, 8 bits/pixel
Mode 3a : 1600x1200, 8 bits/pixel
Mode 3c : 1440x900, 24 bits/pixel
Mode 41 : 640x480, 16 bits/pixel
Mode 43 : 800x600, 16 bits/pixel
Mode 45 : 1024x768, 16 bits/pixel
Mode 49 : 1280x1024, 16 bits/pixel
Mode 4b : 1600x1200, 16 bits/pixel
Mode 4d : 1440x900, 16 bits/pixel
Mode 50 : 640x480, 32 bits/pixel
Mode 52 : 800x600, 32 bits/pixel
Mode 54 : 1024x768, 32 bits/pixel
Mode 58 : 1280x1024, 32 bits/pixel
Mode 5a : 1600x1200, 32 bits/pixel
Mode 5c : 1440x900, 32 bits/pixel
Mode 63 : 512x771, 8 bits/pixel
Mode 64 : 512x771, 16 bits/pixel
Mode 65 : 512x771, 32 bits/pixel

Note that the resolution has been updated in mode 3c, 4d and 5c at various depths (bits /pixel). I added this resolution to my /etc/X11/xorg.conf and restarted my X server to see if my display resolution changes. As always backup your xorg.conf file before making any changes.


------snip---------
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1440x900" "1280x1024" "1280x960" "1280x800" "1152x864" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
------snip---------


Restart X by Ctrl+Alt+Backspace or by killing Xorg process. If all is fine, you should be able to see the display at higher resolution (1440 x 900). Since this change to the VBIOS is temporary add this change to the /etc/rc.d/rc.local script to apply this change to VBIOS during boot.


#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/bin/915resolution 3c 1440 900 24

Stylus and Tablet Mode:
The linuxwacom project, supports wacom made tablets under Linux. Starting FC4, Fedora ships with linuxwacom drivers by default. The tablet is recognized as a serial device in tablet PC's. Use the setserial utility to add the tablet as a serial device.

setserial /dev/ttyS0 port 0x0338 irq 4 autoconfig

Now that we have added the tablet as a serial device, use the wacdump program that ships with FC6 to see if the stylus is working.

[root@localhost ~]# wacdump -f c100 /dev/ttyS0


-f forces wacdump to use c100 (Acer C100 Tablet PC Screen as the serial device of choice. Move the tablet around to see if POS_X, POS_Y etc changes. When you press the stylus on the screen, the PRESSURE should change and so on. Now that we have the stylus working we need to add the serial device to be configured at boot. Add this to the rc.local file as shown

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/bin/915resolution 3c 1440 900 24
setserial /dev/ttyS0 port 0x0338 irq 4 autoconfig



Now, we need to configure X so that it recognizes the stylus as an additional pointing device. I modified my xorg.conf file as follows


Section "InputDevice"

# Option "Speed" "3.0"
# Option "Threshold" "2"
# Option "Tilt" "on"
# Option "BottomX" "28570"
# Option "BottomY" "21430"
#Option "DebugLevel" "10"
Identifier "cursor"
Driver "wacom"
Option "Device" "/dev/ttyS0"
Option "ForceDevice" "ISDV4"
Option "Type" "cursor"
# Option "Mode" "absolute"
EndSection

Section "InputDevice"

# Option "Tilt" "on"
# #Option "TiltInvert" "on"
# Option "Threshold" "2"
# Option "BottomX" "28570"
# Option "BottomY" "21430"
# #Option "DebugLevel" "10"
Identifier "stylus"
Driver "wacom"
Option "Device" "/dev/ttyS0"
Option "Type" "stylus"
Option "ForceDevice" "ISDV4"
Option "Button2" "3"
# Option "Mode" "absolute"
EndSection

Section "InputDevice"

# Option "Tilt" "on"
# #Option "TiltInvert" "on"
# Option "Threshold" "2"
# Option "BottomX" "28570"
# Option "BottomY" "21430"
#Option "DebugLevel" "10"
Identifier "eraser"
Driver "wacom"
Option "Device" "/dev/ttyS0"
Option "ForceDevice" "ISDV4"
Option "Type" "eraser"
Option "Button2" "3"
# Option "Mode" "absolute"
EndSection


References:
http://gentoo-wiki.com/HARDWARE_Toshiba_Tecra_M4

Tablet Mode:

You will be able to rotate the X display on the fly using the xrandr (/usr/bin/xrandr) routine that is supplied with X. The default wacom drivers shipped with FC6, do not support rotate on the fly. You will need to restart the X server every time you rotate the screen (go from laptop mode to tablet and vice versa). The newer wacom drivers support, rotatation on the fly. Get the newer drivers from the linux wacom project.
The documentation is very descriptive and very useful. I had to compile from the source and the compilation broke at some point due to a missing link. I think libwacomcfg.so.0 in /usr/lib was not pointing to libwacomcfg.so.0.0.1 in the same directory. Just create a symbolic link using the following command
ln -s ibwacomcfg.so.0.0.1 libwacomcfg.so.0

The compilation should proceed without any hitches after this. You should be able to see xsetwacom config tool supports rotate on the fly. To check try


[root@localhost ~]# /usr/bin/xsetwacom list param
TopX - Bounding rect left coordinate in tablet units.
TopY - Bounding rect top coordinate in tablet units .
BottomX - Bounding rect right coordinate in tablet units.
BottomY - Bounding rect bottom coordinate in tablet units.
Button1 - X11 event to which button 1 should be mapped.
Button2 - X11 event to which button 2 should be mapped.
Button3 - X11 event to which button 3 should be mapped.
Button4 - X11 event to which button 4 should be mapped.
Button5 - X11 event to which button 5 should be mapped.
Button6 - X11 event to which button 6 should be mapped.
Button7 - X11 event to which button 7 should be mapped.
Button8 - X11 event to which button 8 should be mapped.
Button9 - X11 event to which button 9 should be mapped.
Button10 - X11 event to which button 10 should be mapped.
Button11 - X11 event to which button 11 should be mapped.
Button12 - X11 event to which button 12 should be mapped.
Button13 - X11 event to which button 13 should be mapped.
Button14 - X11 event to which button 14 should be mapped.
Button15 - X11 event to which button 15 should be mapped.
Button16 - X11 event to which button 16 should be mapped.
Button17 - X11 event to which button 17 should be mapped.
Button18 - X11 event to which button 18 should be mapped.
Button19 - X11 event to which button 19 should be mapped.
Button20 - X11 event to which button 20 should be mapped.
Button21 - X11 event to which button 21 should be mapped.
Button22 - X11 event to which button 22 should be mapped.
Button23 - X11 event to which button 23 should be mapped.
Button24 - X11 event to which button 24 should be mapped.
Button25 - X11 event to which button 25 should be mapped.
Button26 - X11 event to which button 26 should be mapped.
Button27 - X11 event to which button 27 should be mapped.
Button28 - X11 event to which button 28 should be mapped.
Button29 - X11 event to which button 29 should be mapped.
Button30 - X11 event to which button 30 should be mapped.
Button31 - X11 event to which button 31 should be mapped.
Button32 - X11 event to which button 32 should be mapped.
DebugLevel - Level of debugging trace, default is 1.
PressCurve - Bezier curve for pressure (default is 0 0 100 100).
RawFilter - Enables and disables filtering of raw data, default is true.
Mode - Switches cursor movement mode (default is absolute).
SpeedLevel - Sets relative cursor movement speed (default is 6).
ClickForce - Sets tip/eraser pressure threshold = ClickForce*MaxZ/100 (default is 6)
Accel - Sets relative cursor movement acceleration (default is 1)
xyDefault - Resets the bounding coordinates to default in tablet units.
gimp - Turns on/off Gimp support in Xinerama-enabled multi-monitor desktop, default is on.
mmonitor - Turns on/off across monitor movement in multi-monitor desktop, default is on
TPCButton - Turns on/off Tablet PC buttons. default is off for regular tablets, on for Tablet PC.
CursorProx - Sets cursor distance and hysteresis for proximity-out in distance from the tablet. distance = value&0xffff. hysteresis = (value>>16) & 0xffff (default is 256 8)
Rotate - Sets the rotation of the tablet. Values = NONE, CW, CCW, HALF (default is NONE).
GetTabletID - Returns the tablet ID of the associated device.
GetModel - Writes tablet models to /etc/wacom.dat.

Event description format:
[CORE] [EVENT TYPE] [MODIFIERS] [CODE]
CORE: Emit core events irrespective of the SendCoreEvents setting
EVENT TYPE: the type of event to emit:
KEY: Emit a key event
BUTTON: Emit a button event
DBLCLICK: Emit a double-click button event
MODETOGGLE: Toggle absolute/relative tablet mode
MODIFIERS: Key modifiers: any combination of:
SHIFT, CONTROL, ALT, META, HYPER, SUPER
CODE: Button number or key code (see /usr/include/X11/keysymdef.h)
Examples:
xsetwacom set stylus Button1 "button 5"
xsetwacom set stylus Button3 "dblclick 1"
xsetwacom set pad Button2 "core key ctrl alt F2"
xsetwacom set pad Button10 "core key ctrl alt backspace"


You will see that Rotate option is supported. I used the following script to Rotate my X display and wacom driver on the fly. There may be more things to add to it, but it seems to be working for me. I added this script to /usr/bin where everyone can see it.


#!/bin/sh
orientation=`/usr/bin/xrandr --query | /bin/grep "Current rotation" | /usr/bin/awk '{print $4}'`
if [ "$orientation" == "normal" ]; then
/usr/bin/xrandr --orientation right
/usr/bin/xsetwacom set stylus Rotate cw
else
/usr/bin/xrandr --orientation normal
/usr/bin/xsetwacom set stylus Rotate none
fi


Lastly I configured the Rotate display hotkey to call the above script as suggested here. Works fine without any problem.

Wednesday, August 09, 2006

Who is to blame for high gas prices in the US?

If you are living in the US, you probably talk about this almost everyday. I wonder if Sun TV, has come up with some kind of news headline like "Americaavil Petrol Pancham. Pothu Makkal Beethi". I really wonder what the hue and cry is all about. I'm more surprised to hear similar comments from fellow desis who are living here. US ranks number one is world oil consumption (about 25%). According to the US Energy information Administration website an average american uses 500 gallons of gasoline a year. The average price of gasoline currently is $3.036/ gallon, and a year ago it was $2.339 / gallon. The cost difference is (3.036-2.339) * 500 = $348.50 / year. This amounts to a monthly increase of $29.04. This leads me to wonder, how a mere increase of $29 per month on their monthly expenses is too much to handle? If someone is not able to afford 30$ more a month (~1% of a $3000 monthly pay), they probably are not able to afford $300 to $400 monthly payments either. The increase in cost is not even compensated for inflation. So stop whining, and try to change the way you drive. By the way, do you know how much the countries around the world are paying for their gas?
(All prices are per gallon)
UK - $6.36
Hong Kong - $6.54
Germany - $6.10
......
India $4.13 (After Govt of India subsidy. I wonder how many Indians know that Govt of India, subsides the price of petrol, (and many other essential commodities) they pay at the pump. So, for those people who complain, that the govt is not doing anything, try to learn the facts, before talking.)
China $2.40

Here is my 50 cent. Stop driving your Gas guzzling SUVs, Hummers and pickup trucks and drive sensibly. Move closer to work or commute to work in mass transit systems. (I know a lot of people who drive more than 50 miles one way to work). Stop wasting gas or if you think that is your birth right, stop complaining about the prices. You might wonder, how Mr. Bush, is trying to combat the energy crisis. He is asking americans to turn off lights, computer monitors etc in their offices, when employee's leave home. Wow !! Do people need to be told to do all this? Isnt this common sense? Oil is the only reason why the US went to war with Iraq (in my opinion). So, dont start complaining about oil prices, and make it a pretext for a war with Iran and for god's sake dont blame China and India for the increase in gas prices. I think it is the other way around. If US was not consuming so much gasoline, the price would be cheaper around the world. So, who do you think is to blame for the high gas prices?