Most Windows Precision Touchpad-style touchpads will be clickpads,
with no-button "pressure pad" style devices being the outlier. Make
clickpad the default unless the report says otherwise.
This fixes the Framework laptop which has a PixArt touchpad with a
weird HID descriptor report which puts the button type on its own
report (so this heuristic doesn't find it) but also claims to have 3
buttons, failing the second heuristic. If it's not setup as a
clickpad, wstpad doesn't do left/center/right button emulation
properly.
I'm curious if this breaks anyone's laptop, especially those ones
with a touchpad that also have a separate row of buttons like some
Dells.
diff --git sys/dev/hid/hidmt.c sys/dev/hid/hidmt.c
index 5ca26899e50..0baf724a9da 100644
--- sys/dev/hid/hidmt.c
+++ sys/dev/hid/hidmt.c
@@ -149,16 +149,13 @@ hidmt_setup(struct device *self, struct hidmt *mt, void
*desc, int dlen)
mt->sc_num_contacts = d;
}
- /* find whether this is a clickpad or not */
+ /* a "pressure pad" has no buttons, so wstpad needs to know */
+ mt->sc_clickpad = 1;
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);
- } else {
- /* if there's not a 2nd button, this is probably a clickpad */
- if (!hid_locate(desc, dlen, HID_USAGE2(HUP_BUTTON, 2),
- mt->sc_rep_input, hid_input, &cap, NULL))
- mt->sc_clickpad = 1;
+ if (d == 0x1)
+ mt->sc_clickpad = 0;
}
/*