Date: Mon, 24 Feb 2014 10:44:42 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262439 - head/sys/dev/usb/input Message-ID: <201402241044.s1OAig7H062968@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <rgrover1@gmail.com> 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402241044.s1OAig7H062968>