summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2011-07-29 20:38:06 +0000
committermav <mav@FreeBSD.org>2011-07-29 20:38:06 +0000
commitdc4300d6056b52d3a073dc873936e564b766e6d0 (patch)
tree4e0e06758dfc2dcc2f3e7b0060e928b477a9397f
parentb55bc3f9ac95bbcf7a20aaedf5b48b3c137209a4 (diff)
downloadFreeBSD-src-dc4300d6056b52d3a073dc873936e564b766e6d0.zip
FreeBSD-src-dc4300d6056b52d3a073dc873936e564b766e6d0.tar.gz
Make ums(4) driver more picky, not attaching to "mouses" with absolute
coordinates, such as digitizers and touch-screens, leaving these devices to uhid(4) and user-level. Specially patched xf86-input-mouse driver can handle them, that isn't done and can't be done properly with ums(4) because of mouse(4) protocol limitations. Approved by: re (kib)
-rw-r--r--sys/dev/usb/input/ums.c48
1 files changed, 40 insertions, 8 deletions
diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c
index 3c4f36e..12d9e89 100644
--- a/sys/dev/usb/input/ums.c
+++ b/sys/dev/usb/input/ums.c
@@ -367,7 +367,9 @@ ums_probe(device_t dev)
{
struct usb_attach_arg *uaa = device_get_ivars(dev);
void *d_ptr;
- int error;
+ struct hid_data *hd;
+ struct hid_item hi;
+ int error, mdepth, found;
uint16_t d_len;
DPRINTFN(11, "\n");
@@ -388,14 +390,44 @@ ums_probe(device_t dev)
if (error)
return (ENXIO);
- if (hid_is_collection(d_ptr, d_len,
- HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
- error = BUS_PROBE_DEFAULT;
- else
- error = ENXIO;
-
+ hd = hid_start_parse(d_ptr, d_len, 1 << hid_input);
+ if (hd == NULL)
+ return (0);
+ mdepth = 0;
+ found = 0;
+ while (hid_get_item(hd, &hi)) {
+ switch (hi.kind) {
+ case hid_collection:
+ if (mdepth != 0)
+ mdepth++;
+ else if (hi.collection == 1 &&
+ hi.usage ==
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE))
+ mdepth++;
+ break;
+ case hid_endcollection:
+ if (mdepth != 0)
+ mdepth--;
+ break;
+ case hid_input:
+ if (mdepth == 0)
+ break;
+ if (hi.usage ==
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X) &&
+ (hi.flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS)
+ found++;
+ if (hi.usage ==
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y) &&
+ (hi.flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS)
+ found++;
+ break;
+ default:
+ break;
+ }
+ }
+ hid_end_parse(hd);
free(d_ptr, M_TEMP);
- return (error);
+ return (found ? BUS_PROBE_DEFAULT : ENXIO);
}
static void
OpenPOWER on IntegriCloud