> Looking at the Linux sources again, it looks like this device should be 
> supported by generic HID.
>
> Wulf, do we support these usages in our kernel HID drivers?
>
> HID APPLICATION COLLECTION (Touch Screen) size(78)
>    HID REPORT: ID 2
>      INPUT:
>        POS:0 SIZE:1 COUNT:2 [VARIABLE]
>          USAGE Tip Switch
>          USAGE In Range
>        POS:2 SIZE:1 COUNT:6 [CONST]
>        POS:8 SIZE:16 COUNT:1 [VARIABLE]
>          USAGE X
>        POS:24 SIZE:16 COUNT:1 [VARIABLE]
>          USAGE Y

Yes, hpen(4) supports them.

It is required to apply some quirks though as TouchScreen usage page is handled 
with hmt(4) driver by default.
Try attached patch and don't forget to enable usbhid(4) to use it with addition 
of following lines to /boot/loader.conf:

hw.usb.usbhid.enable=1
usbhid_load="YES"

P.S. I am not subscribed to usb@, so keep me in CC.

-- 
WBR
Vladimir Kondratyev

commit fefbdb3caa8eefcce7cdd8a73b61edacfbf82353
Author: Vladimir Kondratyev <w...@freebsd.org>
Date:   Fri May 28 13:24:04 2021 +0300

    hpen(4): Add support for HID-compatible eGalax USB touchscreens

diff --git a/sys/dev/hid/hpen.c b/sys/dev/hid/hpen.c
index 1d505e14089..c00578aa6e5 100644
--- a/sys/dev/hid/hpen.c
+++ b/sys/dev/hid/hpen.c
@@ -110,6 +110,8 @@ static const struct hidmap_item hpen_map_pen[] = {
 static const struct hid_device_id hpen_devs[] = {
 	{ HID_TLC(HUP_DIGITIZERS, HUD_DIGITIZER) },
 	{ HID_TLC(HUP_DIGITIZERS, HUD_PEN) },
+	{ HID_TLC(HUP_DIGITIZERS, HUD_TOUCHSCREEN),
+	  HID_BVP(BUS_USB, USB_VENDOR_EGALAX, USB_PRODUCT_EGALAX_TPANEL) },
 };
 
 static int
@@ -186,7 +188,7 @@ hpen_probe(device_t dev)
 {
 	struct hidmap *hm = device_get_softc(dev);
 	int error;
-	bool is_pen;
+	const char *suffix;
 
 	error = HIDBUS_LOOKUP_DRIVER_INFO(dev, hpen_devs);
 	if (error != 0)
@@ -195,14 +197,23 @@ hpen_probe(device_t dev)
 	hidmap_set_dev(hm, dev);
 
 	/* Check if report descriptor belongs to a HID tablet device */
-	is_pen = hidbus_get_usage(dev) == HID_USAGE2(HUP_DIGITIZERS, HUD_PEN);
-	error = is_pen
-	    ? HIDMAP_ADD_MAP(hm, hpen_map_pen, NULL)
-	    : HIDMAP_ADD_MAP(hm, hpen_map_digi, NULL);
+	switch (HID_GET_USAGE(hidbus_get_usage(dev))) {
+	case HUD_PEN:
+		error = HIDMAP_ADD_MAP(hm, hpen_map_pen, NULL);
+		suffix = "Pen";
+	case HUD_TOUCHSCREEN:
+		error = HIDMAP_ADD_MAP(hm, hpen_map_pen, NULL);
+		suffix = "TouchScreen";
+	case HUD_DIGITIZER:
+		error = HIDMAP_ADD_MAP(hm, hpen_map_digi, NULL);
+		suffix = "Digitizer";
+	default:
+		KASSERT(1 == 0, ("Unknown usage"));
+	}
 	if (error != 0)
 		return (error);
 
-	hidbus_set_desc(dev, is_pen ? "Pen" : "Digitizer");
+	hidbus_set_desc(dev, suffix);
 
 	return (BUS_PROBE_DEFAULT);
 }
_______________________________________________
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to