Friday, October 29, 2010

Multitouch driver on WeTab

Update Feb 26 2011 please refer to http://wetabz.blogspot.com/2011/02/wetab-ubuntu-installation.html or full details on installing and running Ubuntu on WeTab with touchscreen enabled.
------------------------------------------------------------------------------------------------------------------------------------Update: The directions from the bottom of the More on Multitouch post should be all that is needed. I'm keeping the one below just for record.

I'm still having a hard time with this. My knowledge of Linux internals is not what it should be, I've gotten halfway through the LFS book twice but never had the patience to see it through. In any case, I've followed a bunch of threads around about using the eGalaxTouchDriver but nothing works, I just keep ending up with the cursor jumping up to the upper left corner of the screen when I touch it under Ubuntu Maverick, Lucid and Meego netbook release.

I've started sniffing around the system for clues on how WeTab OS does things. Here are some of my findings:

/etc/X11/xorg.conf.d/99-calibration.conf

ection "InputClass"
Identifier "default"
Driver "evdev"
EndSection

Section "InputClass"
Identifier "calibration"
MatchProduct "eGalax Inc. USB TouchController"
Option "Calibration" "-5 4100 59 4100"
EndSection

This looks like we're depending on evdev for input support...but there's more.

lsusb gives the following output:

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 011: ID 12d1:1404 Huawei Technologies Co., Ltd.
Bus 002 Device 007: ID 04f2:b213 Chicony Electronics Co., Ltd
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 0eef:72a1 D-WAV Scientific Co., Ltd
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Note the 2nd record from the bottom: Bus 003 Device 002: ID 0eef:72a1 D-WAV Scientific Co., Ltd. Most websites mention that there should also exist 'egalax...' at the end of the given string, not sure if that matters.

Futhermore looking at xinput -list output we get the following:

-Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ eGalax Inc. USB TouchController id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ USB 2.0 Camera id=12 [slave keyboard (3)]
↳ Asus Laptop extra buttons id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
↳ USB Keyboard id=9 [slave keyboard (3)]
↳ USB Keyboard id=10 [slave keyboard (3)]

For more info on the eGalax device we issue:

xinput -list-props 11

Device 'eGalax Inc. USB TouchController':
Device Enabled (132): 1
Device Accel Profile (252): 0
Device Accel Constant Deceleration (253): 1.000000
Device Accel Adaptive Deceleration (255): 1.000000
Device Accel Velocity Scaling (256): 10.000000
Evdev Reopen Attempts (248): 10
Evdev Axis Inversion (257): 0, 0
Evdev Axis Calibration (258): -5, 4100, 59, 4100
Evdev Axes Swap (259): 0
Axis Labels (260): "Abs X" (250), "Abs Y" (251), "None" (0), "None" (0), "None" (0)
Button Labels (261): "Button Unknown" (249), "Button Unknown" (249), "Button Unknown" (249), "Button Wheel Up" (136), "Button Wheel Down" (137)
Evdev Middle Button Emulation (262): 2
Evdev Middle Button Timeout (263): 50
Evdev Wheel Emulation (264): 0
Evdev Wheel Emulation Axes (265): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (266): 10
Evdev Wheel Emulation Timeout (267): 200
Evdev Wheel Emulation Button (268): 4
Evdev Drag Lock Buttons (269): 0

Ok let's see what xorg has to say about all this:

cat /var/log/Xorg.0.log |grep -i egalax

[ 11.935] (II) config/udev: Adding input device eGalax Inc. USB TouchController (/dev/input/event6)
[ 11.935] (**) eGalax Inc. USB TouchController: Applying InputClass "default"
[ 11.935] (**) eGalax Inc. USB TouchController: Applying InputClass "calibration"
[ 11.935] (**) eGalax Inc. USB TouchController: always reports core events
[ 11.935] (**) eGalax Inc. USB TouchController: Device: "/dev/input/event6"
[ 11.940] (II) eGalax Inc. USB TouchController: Found absolute axes
[ 11.940] (II) eGalax Inc. USB TouchController: Found x and y absolute axes
[ 11.940] (II) eGalax Inc. USB TouchController: Found absolute touchscreen
[ 11.940] (II) eGalax Inc. USB TouchController: Configuring as touchscreen
[ 11.940] (**) eGalax Inc. USB TouchController: YAxisMapping: buttons 4 and 5
[ 11.940] (**) eGalax Inc. USB TouchController: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[ 11.940] (II) XINPUT: Adding extended input device "eGalax Inc. USB TouchController" (type: TOUCHSCREEN)
[ 11.940] (II) eGalax Inc. USB TouchController: initialized for absolute axes.
[ 11.941] (II) config/udev: Adding input device eGalax Inc. USB TouchController (/dev/input/mouse0)
[ 11.941] (**) eGalax Inc. USB TouchController: Applying InputClass "default"
[ 11.941] (**) eGalax Inc. USB TouchController: Applying InputClass "calibration"
[ 11.941] (**) eGalax Inc. USB TouchController: always reports core events
[ 11.941] (**) eGalax Inc. USB TouchController: Device: "/dev/input/mouse0"
[ 11.950] (EE) PreInit returned NULL for "eGalax Inc. USB TouchController"
[ 2400.623] (II) eGalax Inc. USB TouchController: Device reopened after 1 attempts.
[ 3907.858] (II) config/udev: removing device eGalax Inc. USB TouchController
[ 3907.860] (II) eGalax Inc. USB TouchController: Close
[ 3990.426] (II) config/udev: Adding input device eGalax Inc. USB TouchController (/dev/input/mouse0)
[ 3990.426] (**) eGalax Inc. USB TouchController: Applying InputClass "default"
[ 3990.426] (**) eGalax Inc. USB TouchController: Applying InputClass "calibration"
[ 3990.426] (**) eGalax Inc. USB TouchController: always reports core events
[ 3990.426] (**) eGalax Inc. USB TouchController: Device: "/dev/input/mouse0"
[ 3990.437] (EE) PreInit returned NULL for "eGalax Inc. USB TouchController"
[ 3990.437] (II) config/udev: Adding input device eGalax Inc. USB TouchController (/dev/input/event6)
[ 3990.437] (**) eGalax Inc. USB TouchController: Applying InputClass "default"
[ 3990.437] (**) eGalax Inc. USB TouchController: Applying InputClass "calibration"
[ 3990.437] (**) eGalax Inc. USB TouchController: always reports core events
[ 3990.437] (**) eGalax Inc. USB TouchController: Device: "/dev/input/event6"
[ 3990.440] (II) eGalax Inc. USB TouchController: Found absolute axes
[ 3990.440] (II) eGalax Inc. USB TouchController: Found x and y absolute axes
[ 3990.440] (II) eGalax Inc. USB TouchController: Found absolute touchscreen
[ 3990.440] (II) eGalax Inc. USB TouchController: Configuring as touchscreen
[ 3990.440] (**) eGalax Inc. USB TouchController: YAxisMapping: buttons 4 and 5
[ 3990.440] (**) eGalax Inc. USB TouchController: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[ 3990.440] (II) XINPUT: Adding extended input device "eGalax Inc. USB TouchController" (type: TOUCHSCREEN)
[ 3990.440] (II) eGalax Inc. USB TouchController: initialized for absolute axes.

finally for good measure I had a look at the loaded modules:
lsmod

Module Size Used by
hid_egalax 2819 0
ath3k 1869 0
fuse 48766 2
uvcvideo 46234 0
pega_ext 2136 0
i2c_dev 4425 0
nls_utf8 989 0
ath9k 59197 0
ath9k_common 4376 1 ath9k
option 12705 0
ath9k_hw 260533 2 ath9k,ath9k_common
ath 7006 2 ath9k,ath9k_hw
usb_wwan 8028 1 option
mac80211 182073 2 ath9k,ath9k_common
usbserial 27143 2 option,usb_wwan
i2c_i801 7159 0
joydev 7182 0
cfg80211 113917 4 ath9k,ath9k_common,ath,mac80211
asus_laptop 11967 0
crystalhd 75313 0
battery 8542 0
sparse_keymap 2393 1 asus_laptop

hid_egalax caught my eye and I ran modinfo

filename: /lib/modules/2.6.35.3-10341.1.4-wetab/kernel/drivers/hid/hid-egalax.ko
license: GPL
description: eGalax dual-touch panel
author: Stephane Chatty
alias: hid:b0003v00000EEFp000072A1
alias: hid:b0003v00000EEFp0000726B
alias: hid:b0003v00000EEFp0000480D
depends:
vermagic: 2.6.35.3-10341.1.4-wetab SMP preempt mod_unload PENTIUMM

Looks like a kernel module.
To confirm how relevant, I ran a modprobe -r hid_egalax and sure enough, my touchscreen went dead. Thankfully my USB keyboard was close and I reloaded the module into the kernel.

Naturally the next thing to do is to look up the author and see what he has to say about all this: http://patchwork.ozlabs.org/patch/46894/in the thread Stephane gives us an answer:

"in order to have the driver up and running, two modifications are
necessary in the hid subsystem:

1. the one described below, in hid.h. This is required for a whole
bunch of multitouch devices but obviously it has to be done only once.

2. the addition of the device's (VendorID, ProductID) couple to a
black list in the hid subsystem's core, so that the new driver can
manage it. This involves changes in hid-ids.h and hid-core.c, for
every new driver.

If hid is compiled as a module, this is fairly straightfowrad. If, as
in Ubuntu, it is statically compiled in the kernel, it means that one
needs to recompile the kernel each time they add a new multitouch
driver.

I was hoping that at least the first patch would be taken into
account for 2.6.33 so as to save work for a lot of people, but it
looks like the patch came too late in the process."

This was sometime in March, a lot might have happened since. The next question is whether this loadable module can be loaded into the other kernel, and how that would be done, where do we get the code for it...too many questions. Well I gotta sleep now, more about this soon, if anyone has a bright idea, please share!



Update Nov 11:
The following forum post discusses enabling touch on On Ubuntu for the WeTab: https://bugs.launchpad.net/utouch/+bug/670795
https://bugs.launchpad.net/ubuntu/+source/utouch-grail/+bug/667802

It looks like the following two packages are needed, I haven't had a chance to test this out yet.
hid-egalax-dkms_1.0.3_all.deb 
hid-dkms_1.0.5_all.deb 


Some glitch with cursor lodging on rthe last touch position still remains to be solved.

2 comments:

  1. Wonderful. Please keep posting on your experiences with this process. I would love more information on getting Meego or Ubuntu working with a multi-touch slate.

    ReplyDelete
  2. Hey dmkerr,
    Will do. I'm still stumped there with the WeTab especially because I was having a load of trouble booting from my USB flash sticks. I'm not sure if it has to do with the sticks themselves or what but booting up was never consistent, so far the past few posts I've begun exploring the features of the on-board (on disk...) OS. With regards to slates running multi-touch, I found one resource on how to get Ubuntu 10.10 running with multitouch on a joojoo tablet: http://txzone.net/2010/10/joojoo-and-multitouch-on-ubuntu-10-10/

    I've also had some feedback from a forum (http://web.archiveorange.com/archive/v/LLXmLJ5N072pepPkhmoO) regarding multitouch on Maverick but for some reason I'm having trouble getting it to work with the WeTab...

    ReplyDelete