On Sat, Aug 06, 2022 at 06:05:30PM +0100, Laurence Tratt wrote:

> The Framework clickpad (a PixArt PIXA3854) announces that it has 4 buttons
> which defeats the normal heuristic of "2 or more buttons means it's a
> touchpad". When it's identified as a touchpad, right hand mouse clicks don't
> work (apart from that, I can't tell any difference between clickpad and
> touchpad in operation!). Linux/libinput also have a quirk for this device
> [1], although they simply disable the second button.
> 
> The patch at the end of this mail adds a quirk that detects the PIXA3854 and
> forces it to be identified as a clickpad. To say that I am unfamiliar with
> these parts of the kernel is an understatement: this patch works for me, but
> I don't know whether it's the best, or even an acceptable, way of dealing
> with "right hand mouse clicks don't work" on this particular device!

Not only to bump this, but also because I later realised that this addresses
the same issue jcs@ tried fixing for the Framework clickpad in a different
way in:

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

though that ran into problems and the eventual conclusion was either "add a
quirk" (like my patch does) or a wscontctl knob.

Since we currently know of only one device with this problem, and since a
wsconsctl knob is not something many people (OK, me...) would think of
trying, I tend to prefer a quirk. Whether that should be hard-coded in, as
I've done, or as a table, I'm happy to take advice on!


Laurie


Index: hid/hidmt.c
===================================================================
RCS file: /cvs/src/sys/dev/hid/hidmt.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 hidmt.c
--- hid/hidmt.c 9 Jul 2020 21:01:08 -0000       1.12
+++ hid/hidmt.c 6 Aug 2022 17:00:18 -0000
@@ -150,7 +150,9 @@ hidmt_setup(struct device *self, struct 
        }
 
        /* find whether this is a clickpad or not */
-       if (hid_locate(desc, dlen, HID_USAGE2(HUP_DIGITIZERS, HUD_BUTTON_TYPE),
+       if (mt->sc_flags & HIDMT_REALLY_CLICKPAD)
+               mt->sc_clickpad = 1;
+       else if (hid_locate(desc, dlen, HID_USAGE2(HUP_DIGITIZERS, 
HUD_BUTTON_TYPE),
            mt->sc_rep_cap, hid_feature, &cap, NULL)) {
                d = hid_get_udata(rep, capsize, &cap);
                mt->sc_clickpad = (d == 0);
Index: hid/hidmtvar.h
===================================================================
RCS file: /cvs/src/sys/dev/hid/hidmtvar.h,v
retrieving revision 1.8
diff -u -p -u -r1.8 hidmtvar.h
--- hid/hidmtvar.h      8 Nov 2019 01:20:22 -0000       1.8
+++ hid/hidmtvar.h      6 Aug 2022 17:00:18 -0000
@@ -37,6 +37,7 @@ struct hidmt {
        int             sc_enabled;
        uint32_t        sc_flags;
 #define HIDMT_REVY     0x0001  /* Y-axis is reversed ("natural" scrolling) */
+#define HIDMT_REALLY_CLICKPAD  0x0002  /* incorrectly identified as touchpad */
 
        struct device   *sc_device;
        int             (*hidev_report_type_conv)(int);
Index: i2c/imt.c
===================================================================
RCS file: /cvs/src/sys/dev/i2c/imt.c,v
retrieving revision 1.5
diff -u -p -u -r1.5 imt.c
--- i2c/imt.c   9 Jul 2020 21:01:56 -0000       1.5
+++ i2c/imt.c   6 Aug 2022 17:00:18 -0000
@@ -159,6 +159,11 @@ imt_attach(struct device *parent, struct
 
        /* assume everything has "natural scrolling" where Y axis is reversed */
        mt->sc_flags = HIDMT_REVY;
+       struct i2c_hid_desc *hid_desc = &sc->sc_hdev.sc_parent->hid_desc;
+       /* The PixArt PIXA3854 clickpad offers 4 buttons, causing hidmt to
+          recognise it as a trackpad, not a clickpad. */
+       if (hid_desc->wVendorID == 0x093A && hid_desc->wProductID == 0x274)
+               mt->sc_flags |= HIDMT_REALLY_CLICKPAD;
 
        mt->hidev_report_type_conv = ihidev_report_type_conv;
        mt->hidev_get_report = imt_hidev_get_report;

Reply via email to