Bug 27442

Summary: Samsung NF210 QX310 QX410 QX510 SF310 SF410 SF510 RF410 RF510 RF710 touchpad / trackpad detected as PS/2 Logitech Wheel mouse
Product: Drivers Reporter: EricDP (eric)
Component: Input DevicesAssignee: drivers_input-devices
Severity: normal CC: angalad, carl, china91888, cichy69, daniel, dariuxas, devTristan, dmitry.torokhov, e.a.b.piel, edwardjski, eloi, f_padia, jrnieder, kevins, lucacolombo84, netbox253, omempoderoso, phoebegoh, sagumatra, stratman, trom303, x-3me-psk
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35 Tree: Mainline
Regression: No
Attachments: /var/log/dmesg
output of evtest
cat /proc/bus/input/devices
xinput --list
log w/ old elantech driver in 6byte EF051 handler
Tom Lin's elantech patch
Patch with two-finger scrolling
Patch with two-finger scrolling and true multi-touch support - UPDATE: appears to be broken. Feel free to hack at it, but don't use this patch if you just want the touchpad to work.
[Patch 0/1] for kernel 2.6.38-8 on Natty (Created from Mark's patch)
[Patch 1/1] for kernel 2.6.38-8 on Natty (Created from Mark's patch)
2.6.38 patch based on Mark
Left and right button for Samsung QX310 and similar.
fix pointer wobble on the ETF1059 model
Patch from Seth Forshee
Patch from Seth Forshee, v0.2

Description EricDP 2011-01-23 18:02:47 UTC
Created attachment 44892 [details]

The NF210 comes with a multi-touch touchpad, but it is not properly detected by the kernel driver. As a result, some touchpad functionality (like multi-touch) is not working, and other functionality (like tap-to-click) is not working properly--it is overly sensitive and detects clicks when the pad is slightly grazed by the palm.

My specific model is NP-NF210-A01CA, but I believe this is happening on a number of other models too. Ubuntu bug 681904 reports Samsung models QX310/QX410/QX510/SF310/SF410/SF510/NF210/RF510/RF710 are all having the same problem.

Ubuntu bug report that might be related:

Pad is detected as: 
[38017.372736] psmouse serio1: ID: 10 00 64
[38018.085779] input: PS/2 Logitech Wheel Mouse as /devices/platform/i8042/serio1/input/input8

Tested on both ubuntu and fedora kernels with same issue.

The tap-to-click is by far the most annoying. If nothing else can be fixed, just turning that off would make this netbook far more usable.

Attached boot dmesg.
Comment 1 EricDP 2011-01-23 18:05:29 UTC
Created attachment 44902 [details]
output of evtest

Output of evtest. The first left-click is actually the left button. The second and third left click are tap-to-click.
Comment 2 EricDP 2011-01-23 18:12:04 UTC
Created attachment 44912 [details]
Comment 3 EricDP 2011-01-23 18:13:58 UTC
Created attachment 44922 [details]
cat /proc/bus/input/devices
Comment 4 EricDP 2011-01-23 18:15:10 UTC
Created attachment 44932 [details]
xinput --list
Comment 5 EricDP 2011-02-03 03:53:13 UTC
Is there anything required to move this forward? Thanks!
Comment 6 Daniel Manrique 2011-02-04 22:14:17 UTC
I have a Samsung QX410 with the same touchpad and same issues as EricDP.

I did some investigating on the elantech.c source file, part of the psmouse driver.

To begin with, this touchpad responds differently to the "magic knock" sent by the driver to attempt to identify it as an Elantech touchpad. I modified the driver to see if this was the only problem and the touchpad did, indeed, work similarly to other Elantech models. Once I removed the check for the expected magic knock response, things moved forward, but the pad is still not functional.

The driver expects a response of "0x3c, 0x03, 0xc8" but this pad sends "0x3c, 0x03, 0x00".

After that the driver queries the pad for version and capabilities, this apparently returns some data, as shown here:

[ 9721.250065] elantech: Elantech version query result 0x85, 0x1b, 0x00.
[ 9721.284321] elantech: assuming hardware version 2, firmware version 133.27.0
[ 9721.318037] elantech: Synaptics capabilities query result 0x19, 0x14, 0x0c.

Once the driver recognizes the touchpad it attempts initialization, which returns no errors, however in reality the touchpad remains in relative, rather than absolute, mode; my crude confirmation for this is that the coordinates reported are small quantities if I move my finger slowly, and larger quantities if I move it quickly. Negative coordinates are reported for left or down motion, while positives are reported for up or right. No absolute coordinates are reported (for my pad, Xmax and Ymax are 1467 and 815, as reported by the Windows driver).

Also, looking at the logs, the pad generates a lot of "loss of synchronization" events, apparently because, while the driver expects 6-byte packets, the pad only sends 3-byte packets, so every once in a while the driver will be missing 3 bytes, considering this a loss of sync. This is further evidence to the fact that the pad is in relative mode, and sending only 3-byte packets as a standard PS/2 mouse does.

I attempted trying different bit values for the configuration registers in this pad, but I was unable to enable absolute mode or any other features of the pad.

As is, it only reports movement if using a single finger, if the pad senses two or three fingers, the driver reports no motion at all. Under Windows, using two fingers reports 2 sets of coordinates, 3 fingers reports a single set of coordinates. A separate value indicates number of fingers on the pad.

I'm willing to compile/test stuff to see if it works with this pad, and I'm available to provide any information needed to help the process along. If analyzing the Windows driver for this pad could help, I also have it available, although I haven't been able to find out anything from the (cursory) look I had at those files.


- Daniel Manrique
Comment 7 eric 2011-02-25 02:41:26 UTC
This issue is also happened on Lenovo G475/G570
Comment 8 f_padia 2011-03-07 12:03:12 UTC
I have the same problem on Samsung SF310 laptop. Is there anybody working on this or did I just do a stupid thing in buying this laptop???
Comment 9 EricDP 2011-03-07 15:00:57 UTC
Updated the summary to include all the different models that people are complaining about having this same problem.
Comment 10 Guillermo 2011-03-13 09:38:37 UTC
that happens too in the samsung rf410 has anybody figured our how to fix it?
Comment 11 Phoebe 2011-03-21 11:16:52 UTC
This issue occurs on the Samsung NC210 running maverick as well.
Comment 12 Mark A. Stratman 2011-03-23 14:38:09 UTC
Going further than what Daniel Manrique already posted is beyond my (current) ability with drivers, but I am willing to provide whatever assistance is requested if somebody picks up this bug.

This issue affects a wide range of laptops (basically every modern Samsung model), and renders its trackpad nearly useless. As such, I'm quite eager to help get this fixed.
Comment 13 EricDP 2011-03-24 02:10:48 UTC
I second Mark's comment--I will provide whatever assistance I can to get this fixed. I've already spent over a dozen hours trying to figure out the driver code, but it's beyond my skills. I can test drivers and provide any logs needed. Please somebody help us!
Comment 14 angalad 2011-04-04 16:06:00 UTC
I'll provide information and/or testing on an SF310 if needed. Sadly, my programming skills are not too much driver-oriented :(
Thanks in advance for your help, fearless developers.
Comment 15 f_padia 2011-04-04 18:29:57 UTC
Likewise I will happily test on SF310. I am even willing to learn how to solve this, but I literally have no idea where to start! It seems we are all doomed with useless touchpads!
Comment 16 Mark A. Stratman 2011-04-05 02:07:29 UTC
For what little it's worth, on a whim I tried forcing hw_version=1 (it assumes it's 2, based on the firmware number), and it didn't get me any further.  0x10 fails to report absolute mode.
Comment 17 Mark A. Stratman 2011-04-13 00:15:00 UTC
On the off-chance this might be useful to anyone who comes across this:

I tried this old testing/development version of the elantech driver:

I forced it past the magic knock, then forced it into each of the modes in elantech_init(), but (at my novice glance) they all appear to misbehave similarly and produce no cursor movement or clicks.

I'm attaching an example log from using the following handler packet size

psmouse->protocol_handler = elantech_process_6byte_EF051;
psmouse->pktsize = 6;
Comment 18 Mark A. Stratman 2011-04-13 00:16:18 UTC
Created attachment 54192 [details]
log w/ old elantech driver in 6byte EF051 handler
Comment 19 Kevin Smith 2011-04-19 15:53:58 UTC
This also seems to be a problem with my Samsung NF310.

I have not done kernel work, but am a programmer, and am motivated, so let me know what I can do to help.

I: Bus=0011 Vendor=0002 Product=0001 Version=0063
N: Name="PS/2 Logitech Wheel Mouse"
P: Phys=isa0060/serio1/input0
S: Sysfs=/devices/platform/i8042/serio1/input/input10
U: Uniq=
H: Handlers=mouse0 event6 
B: EV=7
B: KEY=70000 0 0 0 0 0 0 0 0
B: REL=103

   bustype : BUS_I8042
   vendor  : 0x2
   product : 0x1
   version : 99
   name    : "PS/2 Logitech Wheel Mouse"
   phys    : "isa0060/serio1/input0"
   bits ev : EV_SYN EV_KEY EV_REL
Comment 20 Mark A. Stratman 2011-04-22 04:20:21 UTC
林彥佑 (Tom Lin) has been working hard on this driver (and might still be working on it), and has a patch that seems to work with the QX410-S02.  I don't have other hardware to test it with, but there's a good chance it will work with most new Samsungs.

The touchpad is definitely in absolute mode, and has a resolution of x = (0 - 2934), y = (0 - 1630).  It can detect 0,1,2, or 3 fingers.  Pressure and tool width both give sane values.

The "magic knock" and firmware versions are hard-coded in it, so if it fails to recognize yours, just turn on debug and post back with your dmesg log and I can add them and we'll see if his changes work for yours too (or you can just modify elantech.c if you're comfortable doing that).

I haven't yet tried getting multi-touch to work, but I'll post back with more info once I try.

I'll attach Tom's patch following this.

For instructions on applying the patch, see this: http://ubuntuforums.org/showthread.php?p=9175201#post9175201  (change step 5 accordingly)

If you're using gnome/gdm, you might also need to force the touchpad on: `gconftool --set --type boolean /desktop/gnome/peripherals/touchpad/touchpad_enabled true`
Comment 21 Mark A. Stratman 2011-04-22 04:22:07 UTC
Created attachment 54962 [details]
Tom Lin's elantech patch
Comment 22 Mark A. Stratman 2011-04-22 04:27:07 UTC
The filename didn't come through, but it's a patch against linux-2.6.35
Comment 23 Tristan 2011-04-22 06:08:29 UTC
Looking pretty good. I've got the QX410-S01, which is pretty much identical to the QX410-S02. There are a couple problems with the driver so far:

* No side scrolling/two finger scrolling through the mouse gui
* Need to push moderately hard to move the mouse
* after enabling circular scrolling, I had to slam the touchpad with thor's hammer to scroll it
* one finger clicking and the other dragging? NUUUU. Any combination of fingers = death.
* no right click. Tried "synclient RBCornerButton=3", nothing. I was able to do "synclient TapButton2=3" as a temporary solution.
Comment 24 Mark A. Stratman 2011-04-22 07:01:08 UTC
The driver is definitely reporting second finger positions, and with correct values.  It uses XHAT/YHAT values with multiple fingers, and regular ABS_X/ABS_Y for single touch.
Unfortunately, I don't (yet) know why click+drag simultaneously doesn't work. My current guess is the xorg synaptics driver doesn't like this for some reason.

A possible workaround in the meantime (untested) might be to disable the lower region of the touchpad allowing for it to be used to clicking, while dragging on the upper region?

Right clicks definitely do not work at the driver level - i forgot to mention this earlier.  No matter where on the pad you click, packet[0]&0x3 is always 1. I plan to try to figure out where else this might be, if anywhere. 

To get side scrolling working, I had to set gconf value /desktop/gnome/peripherals/touchpad to 0.  synclient works though.

However, I did not get two finger scrolling to work at all.  Any tips?

To avoid pushing hard, try playing with the FingerLow and FingerHigh values with synclient.  I'm using FingerLow=5 and FingerHigh=8 right now, though it's hard to say where it should be.
Comment 25 Mark A. Stratman 2011-04-22 07:11:48 UTC
Also, RBCornerButton=3 works for right-click, but only (it seems) via a tap.
Comment 26 netikras 2011-04-22 09:56:52 UTC
hmm... it looks someone has solved that problem (I mean recognition of elantech trackpad) a year ago :) Unles I understood it wrong, this patch should be included in 2.6.35 kernel already, shouldn't it? well, at least ALLurGroceries said so.
However I have some problems applying it. At step 5 (patch -p1 < elantechpatch1/2/3/4) I get this: 

$ patch -p1 < elantechpatch1
  patching file drivers/input/mouse/elantech.c
  Hunk #1 FAILED at 666.
  1 out of 1 hunk FAILED -- saving rejects to file drivers/input/mouse/elantech.c.rej

Any ideas..?

P.S. I'm running LinuxMint10 (uname -r >> 2.6.35-28-generic) on notebook Samsung NF210-A01
Comment 27 Kevin Smith 2011-04-22 13:17:13 UTC
(In reply to comment #22)
> The filename didn't come through, but it's a patch against linux-2.6.35

If we are running 2.6.38-8, should we still be able to apply Tom Lin's patch? Would we just be able to skip the 4 other elantech-related patches because (theoretically) they would already be included? Are there other steps in the ubuntuforums recipe that we could skip?
Comment 28 Daniel Manrique 2011-04-22 16:31:07 UTC
Folks, the instructions referred to by Mark are just a starting point, they are not to be taken so literally. In particular (@netkiras) it's NOT necessary to apply the 4 patches from step 5, which are for a different, older kind of Elantech touchpad. Tom Lin's patch applies cleanly to 2.6.35 source tree and step 5.5 is also not necessary on the Samsungs.

However, I tested it on a 2.6.38 kernel tree and it doesn't apply cleanly there, so a bit of work might need to be done for that version.

Still, to confirm, this works fine on my QX410, with some quirks as mentioned by Tristan, but the fact that it's recognized as a touchpad and can be configured is already a godsend. Being able to synclient PalmDetect=1 and NOT have the cursor flying around every time I accidentaly hit the pad is worth the world to me.

Mark A. Stratman: Thanks so much for taking the time and effort to move things forward with this touchpad. Please extend my thanks to Tom Lin too. Also, please let me know if we can help test/polish things further.
Comment 29 EricDP 2011-04-22 17:28:07 UTC
This is very promising on my NF210, at least as far as evtest shows absolute coordintates and more than one finger, but when the driver is loaded I get no response in X. Is there something that needs to be done to tell X about it?
Comment 30 Mark A. Stratman 2011-04-22 18:41:39 UTC
@EricDP: Try gconftool --set --type boolean
/desktop/gnome/peripherals/touchpad/touchpad_enabled true

Regarding click+drag (click and hold with one finger, drag with the other), does anyone know how this is supposed to work?  My uninformed gut-reaction is that the Xorg driver ought to handle this gracefully when it sees a held click and movement by another finger. All this info appears to be available.

However, I guess either 1) it's not supposed to, 2) it should, but i've set something up wrong, or 3) it should, but it isn't yet supported.

If somebody more familiar with this can weigh in, I'll be happy to take a deeper look in the appropriate place.

In the meantime though, I think I will try to add it in the kernel driver via the same method used here for the bcm5974:
(i.e. a quick and dirty hack to just report a single ABS_X/ABS_Y movement when one finger is clicked and another moves)
Comment 31 Tristan 2011-04-22 18:51:16 UTC
The following commands normalize pretty much everything for me, minus two finger scrolling and normal right clicking:

synclient PalmDetect=1
synclient RBCornerButton=3
synclient CircularScrolling=1
synclient CircScrollTrigger=3
synclient FingerLow=3
synclient FingerHigh=8
Comment 32 Kevin Smith 2011-04-23 02:31:38 UTC
I just manually applied the rejected patches to the 2.6.38-8 kernel from Ubuntu 11.04-Beta1, and the resulting psmouse driver works on my Samsung NF310. Yay!!!

The cursor is a bit jumpy as I mouse around and whenever my finger is still, but I was able to disable tap-to-click, and I have edge scrolling back, so I'm quite happy.

I have no idea how to turn my work into something that other people can use. I could post diffs from the original elantech.h/.c to the ones I'm now running, if that would help. Give me instructions and I can follow them.

Thanks so much to Tom and Mark and whoever else is responsible for curing the one thing I didn't like about this laptop!
Comment 33 EricDP 2011-04-23 04:02:42 UTC
Thanks! The gconftool command enabled it. The cursor is a little jumpy when I stop moving, but overall, this is a huge improvement on my NF210. Thank you so much for the work that got us this far! :)
Comment 34 f_padia 2011-04-23 14:35:22 UTC
how do i download the patch? the link above just gives the source file. If i download this file and diff with the original elantech.c file it doesnt work correctly because of all the '+' in the new lines. can someone give a more simple explanation please... thanks for all your guys work on this it looks very promising indeed.
Comment 35 Mark A. Stratman 2011-04-23 16:51:29 UTC
Created attachment 55252 [details]
Patch with two-finger scrolling
Comment 36 Mark A. Stratman 2011-04-23 17:00:29 UTC
The patch i just attached allows for two-finger scrolling in addition to the fixes in Tom's original patch.

Be sure to turn it on with `synclient VertTwoFingerScroll=1` and `synclient VertTwoFingerScroll=1`

Instead of reporting two sets of coordinates with the ABS_HAT values, it just reports a single coordinate.  This feels like the wrong way to do it, but I can't get Xorg to respond to it otherwise.

I've been trying to get two finger click-and-drag working as well, but have not yet found a good way to do it. The main problem is that after you click, a second touch (to begin dragging) makes the cursor jump. I haven't yet found a good way to work around this, but if anyone's curious to try here's what I've been playing with: http://mathbin.net/elantech.c
I still believe these fixes belong in Xorg, so maybe I'll start digging there unless somebody has a better suggestion?
Comment 37 Tristan 2011-04-23 19:05:28 UTC
Try making it so that fingers aren't reported (their location or in the number of fingers) if they are pushing a button.
Comment 38 Mark A. Stratman 2011-04-23 19:31:06 UTC
@Tristan, I briefly considered that but quickly dismissed it, worried it would have adverse side-effects if something else needed the coordinates during a click.  But now that I'm thinking about it more, it seems you might be right. Especially considering many trackpads have separate buttons for clicking.

The big downside would be you could no longer click and drag with one finger (i.e. click with one finger, then move that finger while holding the click down).  But that's hard to do anyway.

I'll think about it further and probably give it a try. Thanks.
Comment 39 EricDP 2011-04-23 20:13:34 UTC
@Mark A. Stratman: confirming that your two-finger patch also works on the NF210. Thanks for this!
Comment 40 Mark A. Stratman 2011-04-23 23:32:57 UTC
Re: 2 finger click-and-drag.  Simply not reporting the coordinates doesn't seem to be an option.  They get sent along (or assumed) as the last reported coordinates. i.e. same problem.
Comment 41 Mark A. Stratman 2011-04-24 04:03:03 UTC
Created attachment 55292 [details]
Patch with two-finger scrolling and true multi-touch support - UPDATE: appears to be broken. Feel free to hack at it, but don't use this patch if you just want the touchpad to work.
Comment 42 Mark A. Stratman 2011-04-24 04:11:37 UTC
The patch above adds true multi-touch support, per Henrik's protocol written about in Documentation/input/multi-touch-protocol.txt.

In order to take advantage of it, you need an Xorg driver that speaks the multi-touch protocol. e.g. https://github.com/BlueDragonX/xf86-input-mtrack

Fortunately (and necessarily, i guess) the kernel gracefully handles multi-touch events alongside the regular ones.  So this will continue to work with the Synaptics driver.
Comment 43 sagumatra 2011-04-26 02:55:17 UTC
Thank you for your work, everyone! I successfully applied this patch on my Samsung NF210-A03CA.
Comment 44 f_padia 2011-04-26 08:29:51 UTC
ok i'm jealous now. can someone please post a step by step guide of how to apply this patch. I have tried following the steps from the ubuntuforums page but I get this message when I try patch -p1 < linux-2.6.35_elan_4.patch:

can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|--- linux-source-2.6.35/drivers/input/mouse/elantech.c    2010-08-01 17:11:14.000000000 -0500
|+++ linux-source-2.6.35_elan/drivers/input/mouse/elantech.c    2011-04-23 22:58:59.000000000 -0500
File to patch: 

I have tried -p0 also with no luck. a simple guide would be much appreciated (starting at how to download the patch correctly)

Comment 45 EricDP 2011-04-26 14:09:41 UTC
Here's what worked for me:

- ensure you have the kernel sources and kernel headers for 2.6.35 (I built against two different ubuntu kernels and it worked: and
- cd into the directory with the source files elantech.c and elantech.h (I believe it's ends with drivers/input/mouse in the source tree)
- to patch, do "patch < elantech.patch" -- just use the latest patch, not the five described in the ubuntu forums post. I last used the patch from comment #35. I haven't tried comment #41. I didn't use -p0 or -p1 or anything.
- to build, go back up to the root of your sources and do "make -C /usr/src/linux-headers-`uname -r` SUBDIRS=`pwd` drivers/input/mouse/psmouse.ko". You shouldn't get any errors. If you do, ensure you are in the right directory.
- then cd back into the directory with the sources for elantech.(c|h) and you should see a built psmouse.ko. Do "rmmod psmouse" to remove the current driver from memory and "insmod ./psmouse.ko" to insert the new one. This will only affect the running system--it will revert on reboot.
- if all works and you like it, you can install the new one by finding your current psmouse.ko (probably somewhere like /lib/modules/(kernel version)/kernel/drivers/input/mouse) and replacing it. Keep the original as backup!
Comment 46 f_padia 2011-04-26 16:58:37 UTC
ok thanks for the help again. i run the patch command again. now i see that some 'HUNKS' are failing. What are HUNKS? does it matter if some fail? might it still work? im guessing they're failing because im on kernel version 2.6.37 (openSUSE 11.4) now. will listing the failed hunks help to make this patch compatible with other kernel versions?
Comment 47 EricDP 2011-04-27 00:24:26 UTC
Yes, the hunks are failing because you are running a different kernel version. There should be an output file that shows where they failed. You can try to edit each file by hand, integrating the differences, and then you can create a new diff file and then we will all have a patch for 2.6.37. :)

Or you can wait for somebody else to do it...
Comment 48 f_padia 2011-04-27 01:44:27 UTC
I'll certianly give it a go. there dont seem to be too many failed hunks (5 out of 25 i think). but with no C programming experience I expect it wont make much sense to me. i'll give it a go anyway and report back if I achieve anything useful.
Comment 49 Carl Richell 2011-04-28 20:24:12 UTC
Created attachment 55842 [details]
[Patch 0/1] for kernel 2.6.38-8 on Natty (Created from Mark's patch)
Comment 50 Carl Richell 2011-04-28 20:31:13 UTC
Created attachment 55852 [details]
[Patch 1/1] for kernel 2.6.38-8 on Natty (Created from Mark's patch)

These two patches were created from Mark's patch and compile against Ubuntu 11.04 kernel 2.6.38-8. (f_padia, these will probably work for you and the 2.6.37 kernel you're on).

After applying the patches the touchpad is identified as "ETPS/2 Elantech ETF1059 Click-Pad". There are still two problems with the touchpad.

1.) Two finger scrolling is not working
2.) The cursor wobbles strangely when holding your finger on the touchpad (to click a check box for example).
Comment 51 EricDP 2011-04-28 20:40:54 UTC
Carl, was it from Mark's patch in comment #41 or an earlier one? The reason I ask is his first patch (comment #21) didn't have two-finger scrolling, but the later ones did.

The cursor seems to wobble with all of them, but turning down sensitivity and turning up acceleration seems to have almost completely eliminated it for me, while keeping the cursor reasonably responsive--at least on the 2.6.35 patch.
Comment 52 Mark A. Stratman 2011-04-28 20:52:40 UTC
Carl, are you using a multi-touch Xorg driver? If so, the wobbling is much harder to tame with that, than with the Synaptics Xorg driver. I'd recommend trying the latter if you can't work it out in the settings (though with the mtrack one, he recently made a 'dev' branch that has a sensitivity option).
Also, the multi-touch Xorg drivers send a certain button press for scrolling, so you may have to find a way to tell your desktop environment to handle that button (xinput maybe?)

If you're using the Synaptics driver, use the `synclient` command and make sure you have VertTwoFingerScroll=1.

If neither of those work, please let me know if you're willing to try out some debugging to determine if the problem is in the kernel driver or at a higher level.
Comment 53 Mark A. Stratman 2011-04-28 20:55:24 UTC
By the way, just for anyone's information regarding the the multi-touch support I added in the last patch:

I haven't yet been able to get 2 finger click+drag working with either of the multitouch Xorg drivers (https://github.com/BlueDragonX/xf86-input-mtrack  or http://bitmath.org/code/multitouch/ from which it's based).

Other multi-touch gestures work though - swipes and scrolls, for example.

But I worry that something might be wrong when clicking is involved.  I don't yet know if this is a problem in the Xorg driver or my kernel driver changes.  So if anyone else has any luck or finds any problems, please post back here.
Comment 54 Eloi COUTANT 2011-04-29 15:50:01 UTC
Hi all,
I'm on Debian Sid/exp (kernel 2.6.38-2-amd64) and the multitouch isn't recognized after the installation. I'm working on a Samsung RC510 with an Elantech Smart-pad.

I've applied the patches, and they work for palm detection, scrolling and, I think, multitouch (it is not my principal interest)! However, there is one more problem : I can't use the touchpad for left click and I have to push the button for  click. It's very boring.

Do you have any ideas to fix this issue ?

By advance, thanks,
Comment 55 Carl Richell 2011-04-29 17:19:45 UTC
Mark, I'm using the Synaptics Xorg driver. I'm unable to tame the wobble with sensitivity and acceleration settings though the settings do modify the touchpad behavior. It's just maddening enough that it's not suitable for production. VertTwoFingerScroll=1 doesn't enable two finger scrolling.
Comment 56 Carl Richell 2011-04-29 18:16:23 UTC
Maybe there's a clue here too. I have one warning when I compile the patch.

src/linux-source-2.6.38/drivers/input/mouse/elantech.c: In function ‘elantech_report_absolute_v3’:
/src/linux-source-2.6.38/drivers/input/mouse/elantech.c:512:24: warning: unused variable ‘etd’
Comment 57 Mark A. Stratman 2011-04-29 18:28:06 UTC
That warning is nothing to worry about. It's simply there from all the debugging junk still in there, which needs be removed before moving this upstream, if that ever becomes a possibility with this patch.

Regarding two-finger scrolling... Two things to try:
* Can you post the syslog or dmesg output that appears when loading the module?
* Run `synclient -m 100` and do a two finger scroll, and see if the 'y' value is changing, and the 'f' (fingers) value shows 2.

Regarding wobbling: I have the same behavior, though it only wobbles 1 or 2 pixels so it's still very usable. I'm certainly not an expert on this stuff, but in my opinion the kernel driver should report exactly what the touchpad does, and the Xorg driver ought to smooth it out if necessary.  But I'll certainly play with it further and look at other drivers to see how or if they handle this.
Comment 58 f_padia 2011-04-29 19:57:59 UTC
Thanks Carl for the new version of the patch. It seems that when I make the module it only makes a psmouse.o file as opposed to psmouse.ko module. Im guessing it needs to make the .ko module after the .o file but it just stops after the .o file. Is this to do with openSUSE or is there something wrong with my makefile? does anyone have any ideas?
Comment 59 Carl Richell 2011-04-29 20:36:51 UTC
Mark, here's the syslog output:

Apr 29 12:34:51 system76-pc kernel: [34457.798782] 2.6.2X-Elan-touchpad-2011-04-12
Apr 29 12:34:51 system76-pc kernel: [34457.887755] elantech.c: PSMOUSE_CMD_RESET_BAT  param[0]=aa param[1]=0 param[2]=0
Apr 29 12:34:51 system76-pc kernel: [34458.037147] elantech.c: Elantech version query result 0x25, 0x0f, 0x01.
Apr 29 12:34:51 system76-pc kernel: [34458.234456] param[0] = 25 param[1] = f param[2] = 1 
Apr 29 12:34:51 system76-pc kernel: [34458.234464] elantech.c: assuming hardware version 9, firmware version 0x25.0x0f.0x01
Apr 29 12:34:51 system76-pc kernel: [34458.360712] val = 0x0f 
Apr 29 12:34:52 system76-pc kernel: [34458.559820] input: ETPS/2 Elantech ETF1059 Click-Pad as /devices/platform/i8042/serio2/input/input16

Running `synclient -m 100` outputs "Can't access shared memory area. SHMConfig disabled?" This was a surprising. I can turn on and off VertEdgeScroll via synclient so I would think SHMconfig is enabled.
Comment 60 Carl Richell 2011-04-29 20:51:11 UTC
@f_padia, I had that happen once while I was compiling... I think I missed a step. Just make sure to use a clean source and run through the commands one at a time.
Comment 61 Carl Richell 2011-04-29 22:59:49 UTC
`synclient -m 100` returns a changing 'y' value but no fingers.

    time     x    y   z f  w  l r u d m     multi  gl gm gr gdx gdy
   0.000  1425  889   0 0  7  0 0 0 0 0  00000000
   1.102  1436   98 114 0  8  0 0 0 0 0  00000000
   1.202  1434  100 136 0  9  0 0 0 0 0  00000000
   1.302  1423  150 161 0 12  0 0 0 0 0  00000000
   1.402  1390  174 168 0 12  0 0 0 0 0  00000000
   1.502  1388  249 168 0 11  0 0 0 0 0  00000000
   1.602  1421  332 171 0 11  0 0 0 0 0  00000000
Comment 62 Mark A. Stratman 2011-04-30 06:28:57 UTC
Thanks Carl.

I just updated my kernel to 2.6.38-8 (ubuntu 11.04) and am having the same issue with the synaptics driver. It doesn't like two finger scrolls any longer.
I'll try to give this a try this weekend if nobody else has figured it out yet.
Comment 63 Mark A. Stratman 2011-05-01 08:44:11 UTC
Carl, and anyone else running Ubunu 11.04:  The problem is with the multitouch support. Reverting to the second patch should get the simulated two-finger scrolling working again: https://bugzilla.kernel.org/attachment.cgi?id=55252

If the driver reports ABS_MT_* capabilities, the Xorg synaptics driver always reports zero fingers.  When you disable the ABS_MT_* stuff, it sees 1,2, or 3 fingers again.

At a glance it appears 11.04 added some multitouch stuff (the 'utouch' meta package), and i suspect either something is wrong in there, or more likely, it's bringing to light some problems with the MT stuff I added.  No idea what the issue is yet though.
Comment 64 EricDP 2011-05-01 21:35:35 UTC
Mark, can you please post a diff of the two-finger scrolling patch against 2.6.38? I've tried applying that patch, but some of the failed hunks I just can't figure out where to place them.

Comment 65 f_padia 2011-05-01 22:37:18 UTC
Thanks guys for all the work so far. and Thanks to carl for your suggestion of getting clean sources. I eventually upgraded to natty and managed to apply the patch. and it works fine.
edge scrolling works which is great, it was one of the things I missed the most. Two finger click and drag would be great but I know Mark (and others) have been looking at this so i'll wait patiently and hope that they can get it working. Id love to help in anyway I can so if anyone needs any testing or non-programming related help let me know.
Comment 66 Mark A. Stratman 2011-05-02 17:22:22 UTC
The multitouch patch is definitely broken. It doesn't work with the 'mtrack' xorg driver, or with the synaptics driver. I didn't mark it as "obsolete" in case others want to hack at it, but I updated the description accordingly.

In the meantime, simply use the prior one "Patch with two-finger scrolling " (https://bugzilla.kernel.org/attachment.cgi?id=55252)

@EricDP: If you still have your previous version, just copy the elantech.c and .h files into your new kernel. You shouldn't need any additional changes for the newer kernel.

On a related note: These patches should probably NOT be applied upstream without very careful oversight from someone more familiar with this stuff.  The patches possibly remove some existing functionality needed for other touchpads, but I don't have any hardware to test it with.
Comment 67 Mark A. Stratman 2011-05-02 17:24:34 UTC
@EricDP ... whoops, forgot to mention I can attach a patch later, but I just wanted to suggest using existing elantech.* files in the meantime since I can't make a patch right now (computer is at home).
Comment 68 Carl Richell 2011-05-02 20:18:58 UTC
Created attachment 56242 [details]
2.6.38 patch based on Mark
Comment 69 Carl Richell 2011-05-02 20:46:09 UTC
The above patch (56242) compiles against 2.6.38 and is based on Mark's patches which enable two finger scrolling (55252). 

Mark, the patch indeed enables two finger scrolling, side scrolling, and horizontal scrolling. This touchpad still exhibits a pretty bad wobble. Otherwise it works great.

You mentioned regression potential for other Elantech touchpads. We have access to a decent amount of hardware. Are there particular Elantech models you would like to see tested with this driver? If we have it, we'll gladly test it.
Comment 70 Maciej 'Cichy' Świderski 2011-05-02 23:04:09 UTC
Hi. Sorry for my bad English.

I'm using Samsung QX310 laptop with Elantech touchpad and ubuntu 11.04 with 2.6.38 kernel. I've tried patch from comment #68 by Carl. 

I'm finally get touchpad to work with two finger scrolling, side scrolling etc. but there is one problem. The touchpad on my laptop does not have dedicated buttons responsible for the mouse click - bottom corners of pad are used as the touchpad buttons. 

With this patch the right mouse button does not work.
Comment 71 f_padia 2011-05-05 10:43:24 UTC
also using carls patch from comment #68. working great but cant get right button clicking to work either. Is there any synclient command that can make it work?
Comment 72 Michał Ryszka 2011-05-07 18:17:45 UTC
I've just compiled the driver using the patch from (In reply to comment #68) on RF510. 
Everything seems to work fine, edge scrolling, 2 finder scrolling, 1,2 and 3 finger tapping.
Only the cursor's a little wobbly, but perhaps it could be fixer with proper acceleration/sensitivity settings.
Comment 73 Krzysztof Wrzalik 2011-05-09 19:37:03 UTC
Created attachment 57032 [details]
Left and right button for Samsung QX310 and similar.

Adds left and right buttons handling for newer elantech touchpads (tested on Samsung QX310).
Comment 74 Carl Richell 2011-05-17 21:26:55 UTC
I've heard from Tom Lin (author of the driver) that the cause of the wobble is Xorg-input-synaptics lack of support for PRESSURE and TOOL_WIDTH values which are provided by the Elantech kernel driver.

I'm not sure where that puts us at this point. I have found that defining Edges as well as MinSpeed, MaxSpeed, and AccelFactor in xorg.conf nearly eliminates the wobble. Acceleration and Sensitivity can no longer be controlled through the Mouse settings GUI.
Comment 75 Kevin Smith 2011-05-18 13:48:08 UTC
When I manually ported the patch to 2.6.38, it looked like a lot of code related to "jumpy cursor" had been removed from the driver (independent of these Samsung patches). Maybe it was removed because it wasn't working, but as I was applying the changes it seemed odd that all that code had gone away.
Comment 76 f_padia 2011-05-18 14:51:09 UTC
I have a bit of problem. I have applied one of the patches (and moved psmouse module to /lib/modules/`uname -r`/kernel/drivers/input/mouse/) and the touchpad works fine when boot. However, I find after some time (I think after laptop wakes from suspend) two-finger click and drag stops working and I need to reload psmouse (using modprobe -r psmouse, modprobe psmouse) to get it working again. Does anyone have any ideas why this might happen and how it might be solved?
Comment 77 Ed 2011-05-19 02:55:12 UTC
Greetings all.
I recently purchased a QX410 and so I've been intently interested in this bug.

So far I have not been able to successfully apply a patch which 
leads me to think that I am doing something incorrectly. Where can I find information on correctly applying these patches?

(So far I have simply copied an attachment, pasted it into a text file, renamed the file as a ".patch" file and applied the patch while compiling the kernel. This resulted in an unbootable kernel which leads me to think I'm doing something incorrectly).

Any help would be appreciated as I'm interested in learning as well as getting the hardware to work.

Comment 78 Mark A. Stratman 2011-05-19 21:06:34 UTC
There's a few new threads on the linux-input list from Éric Piel with some patches.

I haven't had time to go over them yet, much less try them on my laptop, but at a glance it appears very similar to the patches in this thread.  Though there's a few additional things (e.g. updated spec docs, seemingly better ABS_MT stuff...)

I don't yet know how it complements/intersects/overrides the goings on here.  I'm just posting a heads-up in case anyone wants to take a look and fill in any blanks.
Comment 79 Carl Richell 2011-05-24 21:03:23 UTC
Created attachment 59282 [details]
fix pointer wobble on the ETF1059 model

Finally found the bug causing excessive wobble on the ETF1059 (ETF5900) model. Fixed with this patch.
Comment 80 Dmitry Torokhov 2011-05-24 22:26:33 UTC
Guys, it would be nice if you generated relative (to something, ideally mainline version of the kernel) patches, instead of one super-patch containing every known fix. This way it should be possible to figure out if change can be applied to mainline version, or maybe there is another, better way, of achieving the same result.

Comment 81 Dmitry Torokhov 2011-05-24 22:28:42 UTC
And if you'd come over to linux-input@vger.kernel.org mailing list it would be even better as bugzilla is not the most convenient place for driver development.
Comment 82 Éric Piel 2011-06-17 10:12:20 UTC
Hi Carl,

Just to be sure, the fix to avoid pointer wobling is to put a different value in the register, right?
etd->reg_10 = 0x03;

After that, is the code with "elantech_distance_squared()" still needed? My understanding is that normally in the kernel such complex algorithm should be avoided and left to userland (that's why there is a SEMI_MT flag). Or is the wobbling so disturbing when this code is removed that it's absolutely necessary?
Comment 83 Carl Richell 2011-06-17 16:02:18 UTC
Hi Eric,

Yes, changing the register value corrects pointer wobble. I have access to the hardware again next week. I'll determine if "elantech_distance_squared()" is still required.
Comment 84 Mark A. Stratman 2011-06-17 16:08:36 UTC
I added elantech_distance_squared() as part of some code that was used to figure out which finger is which for 2 finger scrolling.  If you scrolled past a certain point on the trackpad with your fingers in a certain orientation, the would be inverted when they're reported, causing an apparent jump occasionally.

To remedy this, it would figure out how far each finger is from the previously-reported location of that finger. e.g. If 1 is closer to the old 2 than the old 1, and 2 is closer to the old 1 than the old 2 - then the trackpad inverted the way its reporting them and we switch them in the driver to avoid an apparent jump.

This was in my original 2 finger scroll patch - I haven't yet caught up with what's been going on here lately, so it may be different in the code you're looking at. But it should be easy to determine.
Comment 85 x-3me-psk 2011-06-21 17:50:24 UTC
Also patch from comment #68 works with my etf1059 and 2.6.39-ARCH kernel.
Comment 86 Carl Richell 2011-06-21 20:39:19 UTC
Eric and Mark,

I tested the ETF1059 model without elantech_distance_squared() and see no noticeable effect regarding wobble or two finger scrolling. I don't know if its removal would effect other models.
Comment 87 x-3me-psk 2011-08-09 05:32:00 UTC
3.0's elantech.c has many changes and cannot be patched with #68.
Comment 88 Jonathan Nieder 2011-08-28 22:51:32 UTC
Created attachment 70722 [details]
Patch from Seth Forshee

Applies cleanly to v3.1-rc3. From http://people.canonical.com/~sforshee/lp681904/
Comment 89 Jonathan Nieder 2011-08-28 23:10:16 UTC
Created attachment 70732 [details]
Patch from Seth Forshee, v0.2

Oops, here's a newer one. Reports from testing (from <https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/681904>, <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633595#46>):

"v0.2 seems to be working on my nf210 with the 32-bit fix. I didn't test everything, but being able to disable tap-to-click and have two-finger scroll working is good enough for me. And having a DKMS package so I'm not building from scratch is a definite bonus. Thanks!" - Eric Paynter

"I tried the 0.2 you gave in #132
The side scrolls now works but 2 finger scroll didn't.

[ 1724.624233] psmouse serio1: ID: 10 00 64
[ 1724.732160] elantech: assuming hardware version 3, firmware version 21.11.0
[ 1724.772190] elantech: Synaptics capabilities query result 0x78, 0x14, 0x0a.
[ 1724.859403] elantech: x_max = 1944, y_max = 864
[ 1724.876776] input: ETPS/2 Elantech Touchpad as /devices/platform/i8042/serio1/input/input14

If this'll be useful to you :)" - himegoto (larcsoul)

"The 0.2 from #132 now allows me to scroll horizontally but I can't disable tap-to-click (Samsung RC512)." - Nick Leytem

"I have no problems anymore : one, two and three fingers are working,
"wheels" too !

In gpointing-device-settings, I see now my touchpad like a touchpad,
BUT changes have no effect... it's borring, but modifications in
xorg.conf work. :)

I have just to find how I can disable the touchpad when the keyboard is
used, and I'll happy.

Thanks a lot to everyone :)" - Eloi COUTANT
Comment 91 Jonathan Nieder 2012-05-20 20:36:38 UTC
JJ Ding's patches for v3 and v4 hardware support were applied in v3.2
(see v3.2-rc3~11^2~3^2~37 and surrounding patches).