Improve the clickpad/touchpad detection in hidmt.
If the HID descriptors don't provide a HUD_BUTTON_TYPE property, hidmt should treat all devices as clickpads if they report a "clickpad button", or don't report to have both a left and right external button.
This commit is contained in:
parent
254cedb6cc
commit
771a028d2f
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: hidmt.c,v 1.12 2020/07/09 21:01:08 jcs Exp $ */
|
||||
/* $OpenBSD: hidmt.c,v 1.13 2022/10/16 20:17:08 bru Exp $ */
|
||||
/*
|
||||
* HID multitouch driver for devices conforming to Windows Precision Touchpad
|
||||
* standard
|
||||
|
@ -154,13 +154,14 @@ hidmt_setup(struct device *self, struct hidmt *mt, void *desc, int dlen)
|
|||
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;
|
||||
} else if (hid_locate(desc, dlen, HID_USAGE2(HUP_BUTTON, 1),
|
||||
mt->sc_rep_input, hid_input, &cap, NULL) ||
|
||||
!hid_locate(desc, dlen, HID_USAGE2(HUP_BUTTON, 2),
|
||||
mt->sc_rep_input, hid_input, &cap, NULL) ||
|
||||
!hid_locate(desc, dlen, HID_USAGE2(HUP_BUTTON, 3),
|
||||
mt->sc_rep_input, hid_input, &cap, NULL)) {
|
||||
mt->sc_clickpad = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk HID descriptor and store usages we care about to know what to
|
||||
* pluck out of input reports.
|
||||
|
|
Loading…
Reference in New Issue