www.duskzone.it


Debian Linux on the Acer TravelMate C300 (C302XMi) tablet pc

Hi!
I decided to write this document while I was trying to get the best ouf of my tablet pc with my favourite Linux distro.
It's not complete or technically perfect, but HTH. :)
Please with "[C300]" in the subject if you find errors or have useful info to extend/refine this document.

Thankyou, and
sorry for the poor English!!
Dusk


So, this document assumes that you :

have already shrinked/removed the pre-installed WinXP system partition
- have already installed a basic Debian system (I did a 2.6 kernel install from the first CD of the current "testing" release)
- are able to get all the needed stuff from the internet in some way ("I must configure the modem to connect to the net, but to configure the modem I need to download the slmodem package... d'oh!")
- are able to install not mentioned but obviously needed stuff during the configuration process (compilers, interpreters, libs and various system tools). If you're not confident with the packaging system read the APT how-to or use Synaptic (# apt-get install synaptic).


- phase 0 - Kernel tuning
(if you want, you can skip this step and keep the debian-install kernel, but some stuff probably won't work at its best or may be missing - for example, the pre-compiled kernel is generic for 686 and not Pentium-M)
  • Download the latest stable kernel from www.kernel.org
  • If you never compiled a kernel, please read carefully the Kernel Build Howto.
  • Configure the kernel source stripping down useless stuff and choosing the right components to compile.
    You may want to refer to the debian .config of your current kernel (look in /boot) or you can start by my .config file (kernel 2.6.12.3, use make oldconfig if configuring a newer version).
    There's a lot of stuff I don't know about many (all?) kernel components, so suggestions and improvements on the configuration are welcome.
  • Compile and install the new kernel.
* Note: if you choose to skip the kernel update/compilation, you need to prepare differently your system for module compilation by installing the appropriate debian packages. AFAIK an easy way to do this is letting module-assistant do it for you.
So
   
# apt-get install module-assistant
    # module-assistant prepare


- phase 1 -
Basic stuff
Graphics and audio should work without particular tunings. You may want to install alsa-packages and configure a sound daemon, but this is out of the scope of this document. For the X configuration, I set a generic 1024x768 24bit lcd display and choose the "i810" driver for the 855GME chipset.

If something doesn't work, check you have loaded the appropriate modules and use # modconf to abilitate them if you miss someone. As far as I have experimented/read, you need

Intel 855GME graphics chipset: i830, drm, intel_agp, agpgart, intelfb (vga16fb, vgastate)
AC'97 Audio: snd_intel8x0, snd_ac97_codec, snd, soundcore (snd_pcm_oss, snd_mixer_oss, snd_pcm, snd_timer, snd_page_alloc).

About video performance, I enabled direct rendering in the kernel and it seems that it's working...
Check also that you have installed all the needed packages to have hardware acceleration!
For example, ppracer (ex tux-racer) was unplayable before I did a
    # apt-get install xlibmesa-dri
After that, runs smoothly. Yeah, there must be some better way to test this stuff that ppracer, but.. who cares. :P

Now I suggest you to enable ACPI and the processor frequency scaling, if they aren't.
# apt-get install acpi acpid
# apt-get install cpufreqd cpufrequtils
# apt-get install gnome-cpufreq-applet # if you run Gnome this is cool
Check you have loaded the appropriate modules with modconf, in the
    kernel/arch/i386/kernel/cpufreq
    kernel/drivers/acpi
sections.
For additional info about about acpi features and cpufreq governors, google is our friend.



- phase 2 - Input devices

Acer Hotkeys and special keyboard features

First, you need the Acer Hotkey driver for Linux -

# wget http://www.informatik.hu-berlin.de/~tauber/acerhk/archives/acerhk-0.5.26.tgz
# tar -xzvf acerhk-0.5.26.tgz
# cd acerhk-0.5.26
read the README and the INSTALL files and edit the Makefile if needed
# make
# cp acerhk.ko /lib/modules/`uname -r`/kernel/drivers/char/
# depmod -a
# modprobe acerhk

Now you have to bind the unknown keys to some keycodes, to be able to use them in some way.
As suggested by the Acer Hotkey driver author, we press the buttons and look at the kernel messages.

We get some messages like this pressing on-screen buttons

Aug 12 18:19:29 tablet kernel: atkbd.c: Unknown key pressed (translated set 2, code 0x6c on isa0060/serio0).
Aug 12 18:19:29 tablet kernel: atkbd.c: Use 'setkeycodes 6c <keycode>' to make it known.

and we look at /usr/include/linux/input.h to find some usable keycodes.
We may want to assign already active keycodes, as for the arrow up/down buttons that we bind to page up/page down keycodes

So if we have in input.h
#define KEY_PAGEUP        104

and pressing the up button we get from the kernel
Aug 12 18:44:00 tablet kernel: atkbd.c: Unknown key pressed (translated set 2, code 0x69 on isa0060/serio0).
Aug 12 18:44:00 tablet kernel: atkbd.c: Use 'setkeycodes 69 <keycode>' to make it known.


we can do
#setkeycodes 69 104
to make the up arrow on-screen button work as the page-up key.

I choose these codes for the other buttons:

#define KEY_COFFEE        152
    screen lock button

#define KEY_F20            95
    Fn button

#define KEY_SCREEN        0x177
    screen rotation button


Add acerhk in /etc/modules to make it auto-load on boot.
    # echo acerhk >> /etc/modules

In the phase 4 we'll assign values to special keys on every boot trough an init script.

Once that the kernel "knows" the special keys, we can assign actions to "special keys" presses. I use Gnome, so this is a task that can be easily accomplished through Application->Desktop Preferences->Keyboard Shortcuts. For example, you can set to adjust volume settings by pressing Fn+Up, Fn+Down and Fn+F8 exacly as you do in Windows, launch browser/e-mail client by pressing the two appropriate buttons, or lock the screen by pressing the "key key" on the screen.

gnome example of key bindings

If you don't like gnome you can try the 'hotkeys' daemon (# apt-get install hotkeys).


Synaptics Touch Pad

# apt-get install xfree86-driver-synaptics
# apt-get install tpconfig

You can use/edit my XF86Config-4 if you want, by the way here you are the synaptics involved chunks:

# begin XF86Config-4 #########################################################
# ... other stuff
Section "InputDevice"
        Identifier      "touchpad"
        Driver          "synaptics"

        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "auto-dev"
        Option          "LeftEdge"              "1700"
        Option          "RightEdge"             "5300"
        Option          "TopEdge"               "1700"
        Option          "BottomEdge"            "4200"
        Option          "FingerLow"             "25"
        Option          "FingerHigh"            "30"
        Option          "MaxTapTime"            "180"
        Option          "MaxTapMove"            "220"
        Option          "VertScrollDelta"       "100"
        Option          "MinSpeed"              "0.06"
        Option          "MaxSpeed"              "0.12"
        Option          "AccelFactor"           "0.0010"
        Option          "SHMConfig"             "on"
EndSection
# ... other stuff
Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          "Default Screen"
        InputDevice     "Generic Keyboard"
        InputDevice     "touchpad" "CorePointer"    # THIS LINE
        InputDevice     "cursor" "SendCoreEvents"
        InputDevice     "stylus" "SendCoreEvents"
        InputDevice     "eraser" "SendCoreEvents"
EndSection
# ... other stuff
# end XF86Config-4 #########################################################

You may want to adjust touchpad default settings.
Look at /etc/default/tpconfig for that.


Wacom Stylus Pen

Time to get the stylus working. As the Linux Wacom Project HOWTO tells us, it's to be treated as a Wacom serial device.
We have to use setserial to configure the serial device.

The magic line is

# setserial /dev/ttyS0 port 0x06f8 irq 6 uart 16550A

you can change ttyS0 to some other unused ttyS? if needed, but remember the number you choose because you'll need it while configuring X.

Of course we need to have the command performed at boot.
Debian has its own setserial script in /etc/init.d/, that reads the file /etc/serial.conf. There's also the auto-save mechanism that can interest you. (man setserial, dpkg-reconfigure setserial)

By the way, simply create/edit /etc/serial.conf inserting a line with the port configuration:

-  /etc/serial.conf:

#stylus pen
/dev/ttyS0 port 0x06f8 irq 6 uart 16550A

Now, install wacom software.

# apt-get install wacom-tools
# apt-get install wacom-kernel-source

follow the automatic configuration procedure and you'll end in having a ready-to-install debian package

cd /usr/src/modules
dpkg -i wacom-kernel-modules-2.6.12.3-acerc300_0.6.6-8_i386.deb

Time to configure X. We need to add in /etc/X11/XF86Config-4 three input devices (cursor/stylus/eraser) and enable them in the active server layout. Start from my XF86Config-4 or copy/paste this code chunks in your file.

# begin XF86Config-4 #########################################################
# ... other stuff
Section "InputDevice"
    Identifier    "cursor"
    Driver        "wacom"
    Option        "Device"        "/dev/ttyS0"
    Option        "Type"          "cursor"
    Option        "ForceDevice"   "ISDV4"
    Option        "BottomX" "28800"
    Option        "BottomY" "21760"
    Option        "Mode" "absolute"
EndSection

Section "InputDevice"
    Identifier    "stylus"
    Driver        "wacom"
    Option        "Device" "/dev/ttyS0"
    Option        "Type" "stylus"
    Option        "ForceDevice" "ISDV4"
    Option        "BottomX" "28800"
    Option        "BottomY" "21760"
    Option        "Mode" "absolute"
EndSection   

Section "InputDevice"
    Identifier "eraser"
    Driver "wacom"
    Option "Device" "/dev/ttyS0"
    Option "Type" "eraser"
    Option "ForceDevice" "ISDV4"
    Option "BottomX" "28800"
    Option "BottomY" "21760"
    Option "Mode" "absolute"
EndSection
# ... other stuff
Section "ServerLayout"
    Identifier    "Default Layout"
    Screen        "Default Screen"
    InputDevice    "Generic Keyboard"
    InputDevice    "touchpad" "CorePointer"
    InputDevice    "cursor" "SendCoreEvents" # ADD THIS
    InputDevice    "stylus" "SendCoreEvents" # THIS
    InputDevice    "eraser" "SendCoreEvents" # AND THIS
EndSection
# ... other stuff
# end XF86Config-4 #########################################################

Last thing: we need xinput (# apt-get install xinput) to enable stylus right-click.

    # xinput set-button-map stylus 1 3 2

should work.
This isn't a persistent setting and has to be performed after X startup, so I suggest you to put the command in a xsession script.
    # echo xinput set-button-map stylus 1 3 2 > /etc/X11/Xsession.d/95xinput_startstylus

    # man xsession
for info/details about xsession scripts.


- phase 3 - Communication

AC'97 Modem
It was a nice surprise to discover that the modem is perfectly working, as my previous Acer notebook had a never_got_working softmodem.

Get slmodem-2.9.10.tar.gz and the slmodem-2.9.10-abby.diff patch to make in compile under recent kernels.
This is what I did at the time of writing, maybe that now you can find a more recent no-patch-needed version on the smartlink website.

So this is what you have to do:
- extract slmodem-2.9.10.tar.gz and apply the patch
- edit the Makefile (adjust the kernel source path)
- # make
- # make install

At this time, I had the driver not capable of acquiring control of the modem device. I investigated and found that the alsa module snd_intel8x0m was controlling the modem. I wasn't able to make the modem work in alsa mode using that module (there's a specific compile switch to enable alsa support), so I put snd_intel8x0m in the module auto-load blacklist (/etc/hotplug/blacklist) to avoid it to load on boot, and rebooted. That worked. Let me know if you manage to get the modem working in alsa mode...
Now move to slmodem-2.9.10/scripts/debian, edit the slmodemd script (I only adjusted the region setting to ITALY) and move it to the /etc/init.d directory.
Use modconf to activate the slamr module (you find it in the "extra" section).
Now
    # /etc/init.d/slmodemd start
initializes the modem device (/dev/ttySL0). Of course you can add a symlink in /etc/rc?.d to the script if you want the modem be initialized on every boot.


Broadcom Gigabit Ethernet
This didn't need particular tuning.
    # modprobe tg3
or use modconf if needed, and be happy.


Intel Pro/Wireless 2200BG (IPW2200) Wi-Fi adapter
This was a bit tricky. New versions of the driver come frequently, so check the official website for updated info.
You can try to install the module "the Debian way" (# apt-get install ipw2200-source and then read docs or try with module-assistant) or ignoring the debian packaging system. I choose the last one because I needed features available only in the latest driver release, not yet Debian-packaged.

At the time of writing, these are most recent needed files to setup the IPW2200
ieee80211-1.0.3.tgz  ipw2200-1.0.6.tgz.tar  ipw2200-fw-2.3.tgz (ieee80211 subsystem, ipw2200 driver and ipw2200 firmware)
Start from 
here, find and download.
Put these three downloaded files in the same directory and let's start...

- unpack and install the ieee80211 subsystem
# tar xzvf ieee80211-1.0.3.tgz
# cd ieee80211-1.0.3
# make
# make install
# cd ..

- unpack and install the ipw2200 driver
# tar xzvf ipw2200-1.0.6.tgz.tar
# cd ipw2200-1.0.6
# make
# make install
# cd ..

- install the firmware
# cp ipw2200-fw-2.3.tgz /usr/lib/hotplug/firmware/
# cd /usr/lib/hotplug/firmware
# tar xzvf ipw2200-fw-2.3.tgz


...and finally

- turn off the "kill switch"
# echo on > /proc/driver/acerhk/wirelessled
(this needs the acerhk module loaded, look at the previous section)

- insert the module
# modprobe ipw2200

Remember that you need hotplug for the firmware loading. (apt-get install hotplug)
There's also kernel stuff that must be enabled for general wi-fi working, firmware loading and cryptography.
If you started from my .config, that stuff should be ok. Otherwise, check the readme and install files of the ieee80211 subsystem and of the ipw2200 driver for details on what to enable.
Of course you'll install the wireless-tools package to manage the adapter if you haven't already, but this is another story.

Having to write
    
# echo on|off > /proc/driver/acerhk/wirelessled
to turn on/off the kill switch is not so funny.

So let's make things a little better with some scripting, with the little ipw2200ctl script.

TODO - try to enable/disable the WLAN by its button (by Gnome2 key-bindings?)

- phase 4 - Init scripts

I did this init scripts to set the wlan/modem status and initialize the acer special keys on every boot.
I hope you find them useful - put in /etc/init.d and set them to start at some runlevel as usual.
Edit initAcerC300 to set modem and wlan adapter boot status.

ipw2200ctl
initAcerC300

initAcerC300 calls the ipw2200ctl and slmodemd scripts to enable/disable wlan and modem, and does general stuff as initializing the special keys with setkeycodes as we did in phase 2. Remember that you had already placed slmodemd script into init.d while configuring the modem, and put acerhk in /etc/modules so that it should be already loaded when calling initAcerC300.

You can generally use /etc/init.d/ipw2200ctl start | stop to enable/disable wlan. The script simply turns off/on the kill switch and loads/unloads the ipw2200 module.

Talking about auto-init stuff, remeber that we should already have setup:
- serial.conf that set the serial device of the stylus pen on boot
- an xsession script that enables right click on the stylus pen after X startup

Have I missed something? I hope not.


Software suggestions, notes and tips
I'm happy with the Gnome Desktop Environment. Here you are a screenshot of my current desktop. There are lots of useful/nice panel applets... and gdesklets are cool too.

screenshot

My favourite desktop applications are Mozilla-Firefox as browser, Mozilla-Thunderbird as e-mail client, gaim as instant messanger and X-Chat as IRC client. NVU is really quick for editing web pages without writing a single line of HTML by hand. OpenOffice is a high quality office suite.

Tablet specific stuff
- the Gimp
you can configure the pressure sensivity of the stylus devices by...
File -> Preferences; Input Devices - Configure Extended Input Devices. Set the three stylus devices to "screen" and enjoy.
- on screen keyboard
# apt-get install xvkbd
# apt-get install gok (this doesn't work on my system at the moment :/)
I suggest you to put a launcher for an on-screen keyboard to make it started easily when in tablet mode. You can see mine near the bottom left corner of the screenshot

I haven't tried yet but they should be good:
- note-keeping app: gournal
- text input app: xstroke

Dual-boot system tips
I sometimes have to use Windows (games and some windows-only-bad-emulated softwares) , so before the Linux install I resized the WinXP partition but not removed it. 
I suggest you to keep a NTFS Windows system partition (primary), a big shared FAT32 partition (primary) to put all non-system dependant stuff (mp3, movies, downloads etc) and an extended Partition in the remaining space, to put into the Linux system partition (eventually more than one) and a swap partition. The fourth primary partition, at the end of the disk, is a little Acer partition that I suggest you to don't touch, because I don't know exactly the reason it's there. I mounted read only and saw that it contains a bunch of dos system tools/ram drive stuff. May be it's used by the recovery cds to restore the system... by the way I left it where I found it - are 8 Mb worth risking? :)

NTFS is better than FAT32 (security features, less fragmentation, crypt stuff) but writing on it from Linux is unsupported/experimental because Microsoft (what a shame) never released the file system specification. This is why for the shared "data" partition I use FAT32, that can be read/written cleanly by both Win and Linux. I think there's a Linux project for writing on NTFS "wrapping" the original Windows file system subsystem/driver, but I never tried it. At the moment I can live happy without writing on NTFS and I'm afraid of corrupting the file system :)
A problem of FAT32 is the maximum single file dimension (I think around 4 Gb). So if you need, for example, to use a big DVD image and aren't able to split it in more than one file, adjust your partitioning (for example, make the NTFS partition 5 Gb bigger, make the DVD image from Windows and read/mount it from both Win/Linux from the NTFS partition).

Here's a screenshot of my current partitioning. The WinXP primary partition on the beginning, the extended partition with two linux installs on ext3 (one for testing stuff and one for my everyday use), a swap space partition and some unpartitioned space (I'm planning to play with vmware soon). After that, the big shared data partition, FAT32. At the end, the mysterious acerdata 8 Mb hidden partition.

partitioning example

Having a read/write shared partion is useful for lots of stuff.
For example I like to have mail and bookmarks shared.

This is easy using Mozilla Firefox and Mozilla Thunderbird as browser and
mail client. 
  
Thunderbird: How To Share Mail Between Windows and Linux
    http://texturizer.net/thunderbird/share_mail.html
 
Firefox: in the two Win/Linux profile folders, edit pref.js to make it point to the same bookmarks file.
Win:
    user_pref("browser.bookmarks.file", "D:\\sharedconf\\bookmarks.html");
Linux:
    user_pref("browser.bookmarks.file", "/shared/sharedconf/bookmarks.html");

These are the two non Linux partition rows in my /etc/fstab
    /dev/hda1       /mnt/ntfs       ntfs    ro,user,gid=6,umask=027 0       0
    /dev/hda2       /mnt/shared     vfat    rw,exec,gid=6,umask=000 0       0
6 is the gid of the "disk" group. This way all members of this group can work with the two partitions.

The end, for now
*should I put ads/paypal here?*
*anyone reading this page?*


DOWNLOADS:
- all-in-one archive, including this page for offline reading
- single files
    /usr/src/linux/.config
    /etc/XF86Config-4
    /etc/serial.conf
    /etc/init.d/initAcerC300

    /etc/init.d/ipw2200ctl



TO-DO / TO-CHECK:

- graphics:
    screen rotation
    video-out/dual head
    performance improvements
note: 
there's an offical Linux Driver from Intel, but I didn't try it yet
- suspend to disk/hibernate
- smart card reader / memory stick etc reader
- pcmcia
- firewire (IEEE 1394)
- bluetooth (haven't any bluetooth devices yes)


References:
Intel® PRO/Wireless 2200BG Driver for Linux
The Linux Wacom Project
Acer Hotkey driver for Linux
SmartLink Linux downloads

TuxMobil: Tablet PCs, Pen PCs and Convertibles with Linux
Linux on Laptops
Fedora Core 3 Linux on the Acer Travelmate c300 tablet PC
www.debian.org

Changelog
08/2005 - page goes online

www.duskzone.it
t