summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/hid/hidmt.c23
-rw-r--r--sys/dev/hid/hidmtvar.h4
2 files changed, 19 insertions, 8 deletions
diff --git a/sys/dev/hid/hidmt.c b/sys/dev/hid/hidmt.c
index 3ca4cc0f97b..1a577360924 100644
--- a/sys/dev/hid/hidmt.c
+++ b/sys/dev/hid/hidmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hidmt.c,v 1.9 2018/08/25 20:31:31 jcs Exp $ */
+/* $OpenBSD: hidmt.c,v 1.10 2019/11/08 01:20:22 yasuoka Exp $ */
/*
* HID multitouch driver for devices conforming to Windows Precision Touchpad
* standard
@@ -202,6 +202,8 @@ hidmt_setup(struct device *self, struct hidmt *mt, void *desc, int dlen)
/* report level usages */
case HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTCOUNT):
case HID_USAGE2(HUP_BUTTON, 0x01):
+ case HID_USAGE2(HUP_BUTTON, 0x02):
+ case HID_USAGE2(HUP_BUTTON, 0x03):
break;
default:
continue;
@@ -296,7 +298,7 @@ hidmt_input(struct hidmt *mt, uint8_t *data, u_int len)
struct hidmt_data *hi;
struct hidmt_contact hc;
int32_t d, firstu = 0;
- int contactcount = 0, seencontacts = 0, tips = 0, i, s, z;
+ int contactcount = 0, seencontacts = 0, tips = 0, buttons = 0, i, s, z;
if (len != mt->sc_rep_input_size) {
DPRINTF(("%s: %s: length %d not %d, ignoring\n",
@@ -407,7 +409,13 @@ hidmt_input(struct hidmt *mt, uint8_t *data, u_int len)
contactcount = d;
break;
case HID_USAGE2(HUP_BUTTON, 0x01):
- mt->sc_button = (d != 0);
+ case HID_USAGE2(HUP_BUTTON, 0x02):
+ if (d != 0)
+ buttons |= 1;
+ break;
+ case HID_USAGE2(HUP_BUTTON, 0x03):
+ if (d != 0)
+ buttons |= 1 << 2;
break;
}
}
@@ -421,7 +429,10 @@ hidmt_input(struct hidmt *mt, uint8_t *data, u_int len)
}
s = spltty();
- wsmouse_buttons(mt->sc_wsmousedev, mt->sc_button);
+ if (mt->sc_buttons != buttons) {
+ wsmouse_buttons(mt->sc_wsmousedev, buttons);
+ mt->sc_buttons = buttons;
+ }
for (i = 0; i < HIDMT_MAX_CONTACTS; i++) {
if (!mt->sc_contacts[i].seen)
continue;
@@ -430,7 +441,7 @@ hidmt_input(struct hidmt *mt, uint8_t *data, u_int len)
DPRINTF(("%s: %s: contact %d of %d: id %d, x %d, y %d, "
"touch %d, confidence %d, width %d, height %d "
- "(button %d)\n",
+ "(button 0x%x)\n",
mt->sc_device->dv_xname, __func__,
i + 1, contactcount,
mt->sc_contacts[i].contactid,
@@ -440,7 +451,7 @@ hidmt_input(struct hidmt *mt, uint8_t *data, u_int len)
mt->sc_contacts[i].confidence,
mt->sc_contacts[i].width,
mt->sc_contacts[i].height,
- mt->sc_button));
+ mt->sc_buttons));
if (mt->sc_contacts[i].tip && !mt->sc_contacts[i].confidence)
continue;
diff --git a/sys/dev/hid/hidmtvar.h b/sys/dev/hid/hidmtvar.h
index f99f22a1e49..dabe5867b7e 100644
--- a/sys/dev/hid/hidmtvar.h
+++ b/sys/dev/hid/hidmtvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hidmtvar.h,v 1.7 2018/08/25 20:31:31 jcs Exp $ */
+/* $OpenBSD: hidmtvar.h,v 1.8 2019/11/08 01:20:22 yasuoka Exp $ */
/*
* Copyright (c) 2016 joshua stein <jcs@openbsd.org>
*
@@ -63,7 +63,7 @@ struct hidmt {
struct hidmt_contact sc_contacts[HIDMT_MAX_CONTACTS];
int sc_cur_contactcount;
- int sc_button;
+ int sc_buttons;
};
int hidmt_set_input_mode(struct hidmt *, uint16_t);