From owner-svn-src-head@FreeBSD.ORG Sat Mar 1 18:56:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A73151A5; Sat, 1 Mar 2014 18:56:50 +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 865C9149C; Sat, 1 Mar 2014 18:56:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s21Iuo6R015787; Sat, 1 Mar 2014 18:56:50 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s21IuoVN015786; Sat, 1 Mar 2014 18:56:50 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201403011856.s21IuoVN015786@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 1 Mar 2014 18:56:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262663 - 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-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Mar 2014 18:56:50 -0000 Author: hselasky Date: Sat Mar 1 18:56:50 2014 New Revision: 262663 URL: http://svnweb.freebsd.org/changeset/base/262663 Log: - Make pointer easier to control when moving slowly. - Increase chance of vertical scrolling as vertical scrolling is used more often. Submitted by: Huang Wen Hui MFC after: 2 weeks Modified: head/sys/dev/usb/input/wsp.c Modified: head/sys/dev/usb/input/wsp.c ============================================================================== --- head/sys/dev/usb/input/wsp.c Sat Mar 1 18:09:38 2014 (r262662) +++ head/sys/dev/usb/input/wsp.c Sat Mar 1 18:56:50 2014 (r262663) @@ -401,6 +401,9 @@ struct wsp_softc { int dz_count; #define WSP_DZ_MAX_COUNT 32 int dt_sum; /* T-axis cumulative movement */ + int rdx; /* x axis remainder of divide by scale_factor */ + int rdy; /* y axis remainder of divide by scale_factor */ + int rdz; /* z axis remainder of divide by scale_factor */ int tp_datalen; uint8_t o_ntouch; /* old touch finger status */ uint8_t finger; /* 0 or 1 *, check which finger moving */ @@ -669,6 +672,9 @@ wsp_intr_callback(struct usb_xfer *xfer, int dx = 0; int dy = 0; int dz = 0; + int rdx = 0; + int rdy = 0; + int rdz = 0; int len; int i; @@ -830,6 +836,9 @@ wsp_intr_callback(struct usb_xfer *xfer, sc->dt_sum = 0; sc->dx_sum = 0; sc->dy_sum = 0; + sc->rdx = 0; + sc->rdy = 0; + sc->rdz = 0; sc->scr_mode = WSP_SCR_NONE; } else if (f[0].touch_major >= tun.pressure_touch_threshold && sc->sc_touch == WSP_UNTOUCH) { /* ignore first touch */ @@ -894,13 +903,22 @@ wsp_intr_callback(struct usb_xfer *xfer, DPRINTFN(WSP_LLEVEL_INFO, "dx=%5d, dy=%5d, mov=%5d\n", dx, dy, sc->finger); } - if (sc->dz_count--) - sc->dz_sum -= (dy / tun.scale_factor); + if (sc->dz_count--) { + rdz = (dy + sc->rdz) % tun.scale_factor; + sc->dz_sum -= (dy + sc->rdz) / tun.scale_factor; + sc->rdz = rdz; + } if ((sc->dz_sum / tun.z_factor) != 0) sc->dz_count = 0; } - dx /= tun.scale_factor; - dy /= tun.scale_factor; + rdx = (dx + sc->rdx) % tun.scale_factor; + dx = (dx + sc->rdx) / tun.scale_factor; + sc->rdx = rdx; + + rdy = (dy + sc->rdy) % tun.scale_factor; + dy = (dy + sc->rdy) / tun.scale_factor; + sc->rdy = rdy; + sc->dx_sum += dx; sc->dy_sum += dy; @@ -908,7 +926,7 @@ wsp_intr_callback(struct usb_xfer *xfer, if (sc->scr_mode == WSP_SCR_NONE && abs(sc->dx_sum) + abs(sc->dy_sum) > tun.scr_hor_threshold) sc->scr_mode = abs(sc->dx_sum) > - abs(sc->dy_sum) ? WSP_SCR_HOR : + abs(sc->dy_sum) * 3 ? WSP_SCR_HOR : WSP_SCR_VER; DPRINTFN(WSP_LLEVEL_INFO, "scr_mode=%5d, count=%d, dx_sum=%d, dy_sum=%d\n", sc->scr_mode, sc->intr_count, sc->dx_sum, sc->dy_sum); @@ -945,8 +963,10 @@ wsp_intr_callback(struct usb_xfer *xfer, sc->sc_status.dz += dz; wsp_add_to_queue(sc, dx, -dy, dz, sc->sc_status.button); - if (sc->dz_count == 0) + if (sc->dz_count == 0) { sc->dz_sum = 0; + sc->rdz = 0; + } } sc->pre_pos_x = sc->pos_x[0];