From owner-svn-src-all@FreeBSD.ORG Fri Jul 29 20:38:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFBEA1065670; Fri, 29 Jul 2011 20:38:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5D5A8FC1E; Fri, 29 Jul 2011 20:38:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6TKc6Wv065244; Fri, 29 Jul 2011 20:38:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TKc6S3065242; Fri, 29 Jul 2011 20:38:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107292038.p6TKc6S3065242@svn.freebsd.org> From: Alexander Motin Date: Fri, 29 Jul 2011 20:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224499 - head/sys/dev/usb/input X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 20:38:07 -0000 Author: mav Date: Fri Jul 29 20:38:06 2011 New Revision: 224499 URL: http://svn.freebsd.org/changeset/base/224499 Log: 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) Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Fri Jul 29 20:35:23 2011 (r224498) +++ head/sys/dev/usb/input/ums.c Fri Jul 29 20:38:06 2011 (r224499) @@ -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