eGalax USB touchscreen issues

2021-05-28 Thread Vladimir Kondratyev
> 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 
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"


[Bug 254974] Corsair K95 RGB PLATINUM gaming keyboard not working

2021-05-28 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254974

--- Comment #24 from commit-h...@freebsd.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=e889a462d878675551b227a382764c3879e6c2b3

commit e889a462d878675551b227a382764c3879e6c2b3
Author: Vladimir Kondratyev 
AuthorDate: 2021-05-28 20:13:44 +
Commit: Vladimir Kondratyev 
CommitDate: 2021-05-28 20:29:42 +

usbhid(4): Fix NULL pointer dereference in usbd_xfer_max_len()

Which happens when USB transfer setup is failed.

MFC after:  1 week
PR: 254974
Reviewed by:hselasky
Differential revision:  https://reviews.freebsd.org/D30485

 sys/dev/usb/input/usbhid.c | 64 +++---
 1 file changed, 49 insertions(+), 15 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
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"