2009-04-20

Linux on a Fujitsu U810 - Touchscreen III

Update 2009.05.12: see this newer post:
Linux on a Fujitsu U810, P1620 - Touchscreen IV


This is a replacement of my previous entries on how to get the touchscreen working; please forget about previous posts (I and II), which works better and it's easier to install and maintain.

In order to have the touchscreen working, here's the final solution where:
  • the point precision is very sharp
  • works with standard Xorg drivers
  • works after suspending / resume cycle without trouble
  • works after rotating the screen
  • works even with an external monitor connected, so the touchscreen is remapped to fit the whole screen area
  • works very nicely for clicking as well as for ink-painting/writing with ink software like xournal !!!
The solution include these steps:
  1. configure bios to tablet mode
  2. install a kernel module: u810_tablet
  3. copy two files to make the u810_tablet module load correctly at boot and when X loads
  4. install one python script and one small c program to have the touchscreen work correctly after rotation

1. configure bios to tablet mode

go into bios and select touchscreen to work in tablet mode


2 install a kernel module: u810_tablet

Latest version: 0.2.4 (2009.04.20)

Download the source code for the u810_tablet kernel module, or just download the already compiled one (for ubuntu 9.04, kernel 2.6.28).

To compile the module:

- make sure you have the linux development environment installed; I would suggest to install the packages using synaptics package manager, and select linux-headers, gcc

- uncompress the downloaded file, cd to the newly created directory and just type
# make

and as root,
# make install


To just install the already compiled module (if you compiled the module, you don't need to follow this step):

as root, copy the module file (u180_tablet.ko) to /lib/modules/`uname -r`/extra/
# cp u810_tablet.ko
/lib/modules/`uname -r`/extra/

as root, run depmod command
# depmod -a


3 copy or edit two files to make the u810_tablet module load correctly at boot and when X loads

In order to have the module load correctly at boot, as root edit the file /etc/rc.local and insert the following lines at any place (you can download rc.local here):

# Correct u810_tablet module load - start
# Author: zmiq2
# Info: spareinfo.blogspot.com

MODPATH=/sbin
RMMOD=$MODPATH/rmmod
MODPROBE=$MODPATH/modprobe

. /lib/lsb/init-functions

log_action_begin_msg "Starting u810_tablet module load"
log_progress_msg " u810_tablet module load:unload usbhid"
$RMMOD usbhid
log_progress_msg " u810_tablet module load:load u810_tablet"
$MODPROBE u810_tablet
log_progress_msg " u810_tablet module load:reload usbhid"
$MODPROBE usbhid
log_action_begin_msg "Finished u810_tablet module load"
log_end_msg 0
# Correct u810_tablet module load - end

In order to have the windowing system recognize the module, copy this file as /etc/hal/fdi/policy/u810_tablet.fdi.


4 install one python script and one small c program to have the touchscreen work correctly after rotation

Download u810_rotate_helper and u810_rotate.py.

as root,

- copy both files to /usr/bin

- make u810_rotate_helper suid:
# chmod +s /usr/bin/u810_rotate_helper


Source code for u810_rotate_helper is here. You can easily compile it yourself just running the command
gcc u810_rotate_helper.c -o u810_rotate_helper
.


Activate u810_rotate.py to start when you log into gnome

Once logged into gnome, go to System -> Preferences -> Starup Applications and add /usr/bin/u810_rotate.py to start when you log in


Reboot and enjoy the touchscreen !!

I can recommend xournal, gournal as hand-writing note taking applications (no handwriting recognition though).

You'll need to repeat step 2 every time there's a new kernel version (like if you change from 2.6.28 to 2.6.29) but not if you just stick to the same ubuntu release (where usually kernel version after upgrade goes from 2.6.28-8 to 2.6.28-11).


Pending tasks

- autorotate integrated mouse-pointer coordinates when screen is rotated. That should be easy....

- configure evdev to handle long-press as right-mouse click


If you installed a previous version detailed in a previous post

- restore your initramfs:
make sure u180_tablet is not in /etc/initramfs-tools/modules file; if it was before, remove it and as root run the command # update-initramfs -u 'all'

- restore your acpi-support file
make sure u810_tablet is not included in in the MODULES variable in /etc/default/acpi-support file


Developer notes

- currently if using rotation using xinput facilities with evdev module does not work properly, even there's a bug fix already tested that suggests that it should work, so rotation is made by the driver

- u810_tablet module parameters
orientation=normal:0|right:1|inverted:2|left:3
maxx,maxy,minx,miny (when normal)
printpos=0|1, to print via /var/log/kern.log x/y coordinates, for debugging

11 comments:

  1. Hello,

    Great work. Do you know if the package you developed would work on a Fujitsu P1620, which I believe apart from the screen resolution uses the same usb screen driver?

    Cheers,

    Marco

    ReplyDelete
  2. Hi Marco,

    I have no idea if that driver could work, but to some extend I'm willing to help you.

    Since I don't have a P1620 to test, so here are my suggestions:

    - option a) you send me your computer and I try to get it working

    - option b) you help me in debugging using your computer, by either running the programs I send you or even better, let me remote access your computer

    How does that sound to you?

    ReplyDelete
  3. Hello,

    Really great that you are willing to help. We can give option b) a try. Let me know the time that would work for you, I am located in California and generally available after 19:00 PST. You can email me at the address I used to register on your blog.

    As an FYI I got as far as getting the touch screen going in 9.04 using the recommendations on a European Ubunutu blog; added rules and modified the xorg conf file. That being said with this fix the screen response is too slow to enable real inking or writing and it requires setting the BIOS as Touchscreen rather than Tablet which makes the windows/Linux dual boot intent rather cumbersome.

    Looking forward,

    Marco

    ReplyDelete
  4. Hi Marco,

    when clicking on your name, google tell me I cannot see your email. I'd suggest you email me at my email address that appears in my profile, and we start from here.

    ReplyDelete
  5. its too well
    but i cant use it in kernel 2.6.30rc

    ReplyDelete
  6. Hi!

    Is your u810 module based on http://panic.cs-bristol.org.uk/~jules/fujitsu-u810-debian-install-notes.html ? Just curious...

    I'm working with U50x/v (japanese model) and I know how to get those keyboard lights on.

    Since 2.6.29 fujitsu-laptop has supported those and it should work if leds class module gets loaded first. But my experience tells that you have to compile leds class in kernel. after that /sys/devices/platform/fujitsu-laptop/leds should exist and under it keyboardlamps and from brightness you can switch them on.

    Anyway I'll give a try to your touchscreen instructions.

    ReplyDelete
  7. Oh. Sorry about stupid guestion. Yes it's developed from Julian's driver.

    http://bitbucket.org/bearsh/bearshoverlay/src/tip/app-misc/fjbtndrvkmod/files/acpi.patch

    For me atleast this patch is needed for compiling under arch linux. (kernel 2.6.29-1)

    ReplyDelete
  8. I noticed that the calibration was a wee-bit off.
    I saw code for dealing with some sort of calibration tool, how would I access this?

    TL:DR

    How would one calibrate it?

    ReplyDelete
  9. Hi Nicadorian,

    I'm working on a calibration tool that will be ready by next week. It's a text-based calibration tools, but it works!

    Keep tuned; I'll make a new blog entry once ready.

    ReplyDelete
  10. Is this still active? I'm eagerly awaiting any updates. If there's anything I can do to help that's just busy work, let me know.

    ReplyDelete
  11. Hi K,

    yes, this project is still active, but my understanding is that functionality with current version is OK.

    What are you awaiting in the updates?

    ReplyDelete