Match on interfaces with Digitizers/Touchscreen collections, as long
authorjcs <jcs@openbsd.org>
Sat, 1 Sep 2018 20:50:16 +0000 (20:50 +0000)
committerjcs <jcs@openbsd.org>
Sat, 1 Sep 2018 20:50:16 +0000 (20:50 +0000)
as they have an X usage.

Should get basic touchscreen functionality on some common
HID-over-i2c devices like laptops.

sys/dev/i2c/ims.c

index c3bc81e..e74dd85 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ims.c,v 1.1 2016/01/12 01:11:15 jcs Exp $ */
+/* $OpenBSD: ims.c,v 1.2 2018/09/01 20:50:16 jcs Exp $ */
 /*
  * HID-over-i2c mouse/trackpad driver
  *
@@ -85,6 +85,12 @@ ims_match(struct device *parent, void *match, void *aux)
            HID_USAGE2(HUP_DIGITIZERS, HUD_PEN)))
                return (IMATCH_IFACECLASS);
 
+       if (hid_is_collection(desc, size, iha->reportid,
+           HID_USAGE2(HUP_DIGITIZERS, HUD_TOUCHSCREEN)) &&
+           hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
+           iha->reportid, hid_input, NULL, NULL))
+               return (IMATCH_IFACECLASS);
+
        return (IMATCH_NONE);
 }