From owner-svn-src-all@FreeBSD.ORG Mon Feb 24 10:44:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 064E4D6D; Mon, 24 Feb 2014 10:44:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CB8DA136E; Mon, 24 Feb 2014 10:44:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1OAigkO062969; Mon, 24 Feb 2014 10:44:42 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1OAig7H062968; Mon, 24 Feb 2014 10:44:42 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201402241044.s1OAig7H062968@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 24 Feb 2014 10:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262439 - head/sys/dev/usb/input X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Mon, 24 Feb 2014 10:44:43 -0000 Author: hselasky Date: Mon Feb 24 10:44:42 2014 New Revision: 262439 URL: http://svnweb.freebsd.org/changeset/base/262439 Log: Update ATP driver: - Add support for emulating a mouse wheel, Z-axis. Submitted by: Rohit Grover MFC after: 2 weeks Modified: head/sys/dev/usb/input/atp.c Modified: head/sys/dev/usb/input/atp.c ============================================================================== --- head/sys/dev/usb/input/atp.c Mon Feb 24 09:40:03 2014 (r262438) +++ head/sys/dev/usb/input/atp.c Mon Feb 24 10:44:42 2014 (r262439) @@ -2075,18 +2075,16 @@ atp_reap_sibling_zombies(void *arg) break; default: /* we handle taps of only up to 3 fingers */ - break; + return; } atp_add_to_queue(sc, 0, 0, 0, 0); /* button release */ - } else if (n_slides_reaped == 2) { - if (n_horizontal_scrolls == 2) { - if (horizontal_scroll < 0) - atp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON4DOWN); - else - atp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON5DOWN); - atp_add_to_queue(sc, 0, 0, 0, 0); /* button release */ - } + } else if ((n_slides_reaped == 2) && (n_horizontal_scrolls == 2)) { + if (horizontal_scroll < 0) + atp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON4DOWN); + else + atp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON5DOWN); + atp_add_to_queue(sc, 0, 0, 0, 0); /* button release */ } } @@ -2369,8 +2367,12 @@ atp_intr(struct usb_xfer *xfer, usb_erro u_int8_t n_movements = 0; int dx = 0; int dy = 0; + int dz = 0; TAILQ_FOREACH(strokep, &sc->sc_stroke_used, entry) { + if (strokep->flags & ATSF_ZOMBIE) + continue; + dx += strokep->movement_dx; dy += strokep->movement_dy; if (strokep->movement_dx || @@ -2384,9 +2386,26 @@ atp_intr(struct usb_xfer *xfer, usb_erro dy /= (int)n_movements; } + /* detect multi-finger vertical scrolls */ + if (n_movements >= 2) { + boolean_t all_vertical_scrolls = true; + TAILQ_FOREACH(strokep, &sc->sc_stroke_used, entry) { + if (strokep->flags & ATSF_ZOMBIE) + continue; + + if (!atp_is_vertical_scroll(strokep)) + all_vertical_scrolls = false; + } + if (all_vertical_scrolls) { + dz = dy; + dy = dx = 0; + } + } + sc->sc_status.dx += dx; sc->sc_status.dy += dy; - atp_add_to_queue(sc, dx, -dy, 0, sc->sc_status.button); + sc->sc_status.dz += dz; + atp_add_to_queue(sc, dx, -dy, -dz, sc->sc_status.button); } case USB_ST_SETUP: