pms: add extra ic type for elantech ps/2 touchpads

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

pms: add extra ic type for elantech ps/2 touchpads

Alexander Cronheim

Hi,

The change below adds ic type 13 as an elantech v4 device and causes
the touchpad in a thinkpad x380 yoga to work as described in wsmouse(4).
Two finger scrolling works and the three mouse button areas are defined
as described. Before the touchpad and trackpoint were attached as a
single generic ps/2 mouse. See also

    https://marc.info/?l=openbsd-tech&m=152620756114509&w=2

The following new lines appear in the dmesg output

    pms0: Elantech Clickpad, version 4, firmware 0x4d1f00
    wsmouse1 at pms0 mux 0

and wsconsctl gives

    mouse.type=elantech
    mouse.rawmode=0
    mouse.scale=0,2745,0,1627,0,0,0
    mouse.tp.tapping=0
    mouse.tp.scaling=0.288
    mouse.tp.swapsides=0
    mouse.tp.disable=0
    mouse.tp.edges=0.0,5.0,10.0,5.0
    mouse1.type=ps2

Hope something like this can be added to openbsd.

Kind regards,

Alexander


Index: pms.c
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.88
diff -u -p -r1.88 pms.c
--- pms.c 26 Jan 2019 11:57:21 -0000 1.88
+++ pms.c 2 Aug 2019 09:46:50 -0000
@@ -1947,6 +1947,7 @@ elantech_get_hwinfo_v4(struct pms_softc
 
  if ((fw_version & 0x0f0000) >> 16 != 6
     && (fw_version & 0x0f0000) >> 16 != 8
+    && (fw_version & 0x0f0000) >> 16 != 13
     && (fw_version & 0x0f0000) >> 16 != 15)
  return (-1);
 

Reply | Threaded
Open this post in threaded view
|

Re: pms: add extra ic type for elantech ps/2 touchpads

Alexander Cronheim
A little more information after looking around a bit.

The linux [1] and freebsd [2] drivers accept all elantech touchpads
with ic types from 6 up to 15 as using the v4 protocol.

The following patch extends the accepted ic types to that
range (from the current set consisting of 6, 8, and 15).

I cannot, however, test touchpads with ic types other than 13.

1. https://github.com/torvalds/linux/commit/10d900303f1c3a821eb0bef4e7b7ece16768fba4#diff-e91bc4802c6797fe9acbdca0ed240be9
2. https://github.com/freebsd/freebsd/commit/8b5fc46c359e276d4545b531a3d3eb15762d1783#diff-fac99891d1c5da0f566dbcc68ba62b22

Index: pms.c
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.88
diff -u -p -r1.88 pms.c
--- pms.c 26 Jan 2019 11:57:21 -0000 1.88
+++ pms.c 11 Aug 2019 16:36:30 -0000
@@ -1945,9 +1945,7 @@ elantech_get_hwinfo_v4(struct pms_softc
  if (synaptics_query(sc, ELANTECH_QUE_FW_VER, &fw_version))
  return (-1);
 
- if ((fw_version & 0x0f0000) >> 16 != 6
-    && (fw_version & 0x0f0000) >> 16 != 8
-    && (fw_version & 0x0f0000) >> 16 != 15)
+ if ((fw_version & 0x0f0000) >> 16 < 6)
  return (-1);
 
  elantech->fw_version = fw_version;

Reply | Threaded
Open this post in threaded view
|

Re: pms: add extra ic type for elantech ps/2 touchpads

Ulf Brosziewski
Hi Alexander,

thanks for these hints and the diff.  I think if we add those
ic types, pms should also identify the models with hardware
buttons properly (not all v4 models are clickpads). This looks
like a trivial extension, I will propose a patch soon.

On 8/11/19 6:55 PM, Alexander Cronheim wrote:

> A little more information after looking around a bit.
>
> The linux [1] and freebsd [2] drivers accept all elantech touchpads
> with ic types from 6 up to 15 as using the v4 protocol.
>
> The following patch extends the accepted ic types to that
> range (from the current set consisting of 6, 8, and 15).
>
> I cannot, however, test touchpads with ic types other than 13.
>
> 1. https://github.com/torvalds/linux/commit/10d900303f1c3a821eb0bef4e7b7ece16768fba4#diff-e91bc4802c6797fe9acbdca0ed240be9
> 2. https://github.com/freebsd/freebsd/commit/8b5fc46c359e276d4545b531a3d3eb15762d1783#diff-fac99891d1c5da0f566dbcc68ba62b22
>
> Index: pms.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 pms.c
> --- pms.c 26 Jan 2019 11:57:21 -0000 1.88
> +++ pms.c 11 Aug 2019 16:36:30 -0000
> @@ -1945,9 +1945,7 @@ elantech_get_hwinfo_v4(struct pms_softc
>   if (synaptics_query(sc, ELANTECH_QUE_FW_VER, &fw_version))
>   return (-1);
>  
> - if ((fw_version & 0x0f0000) >> 16 != 6
> -    && (fw_version & 0x0f0000) >> 16 != 8
> -    && (fw_version & 0x0f0000) >> 16 != 15)
> + if ((fw_version & 0x0f0000) >> 16 < 6)
>   return (-1);
>  
>   elantech->fw_version = fw_version;
>
>