Date: Tue, 25 Feb 2014 08:37:07 +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: r262477 - head/sys/dev/usb/input Message-ID: <201402250837.s1P8b7lr000559@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Tue Feb 25 08:37:06 2014 New Revision: 262477 URL: http://svnweb.freebsd.org/changeset/base/262477 Log: Updates for WSP driver: 1) Add support for page back/forward. 2) While doing HOR scrolling, disable VER scrolling. 3) Checking dx_sum and dy_sum before emulate right button, this can avoids unexpected right button press. 4) Fix stable pointer operation when emulating middle button. Submitted by: Huang Wen Hui <huanghwh@gmail.com> 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 Tue Feb 25 07:59:33 2014 (r262476) +++ head/sys/dev/usb/input/wsp.c Tue Feb 25 08:37:06 2014 (r262477) @@ -94,8 +94,8 @@ static struct wsp_tuning { .z_factor = 5, .pressure_touch_threshold = 50, .pressure_untouch_threshold = 10, - .pressure_tap_threshold = 120, - .scr_hor_threshold = 50, + .pressure_tap_threshold = 100, + .scr_hor_threshold = 10, }; static void @@ -791,9 +791,13 @@ wsp_intr_callback(struct usb_xfer *xfer, } break; case 2: - if (sc->distance < MAX_DISTANCE) + DPRINTFN(WSP_LLEVEL_INFO, "sum_x=%5d, sum_y=%5d\n", + sc->dx_sum, sc->dy_sum); + if (sc->distance < MAX_DISTANCE && abs(sc->dx_sum) < 5 && + abs(sc->dy_sum) < 5) { wsp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON3DOWN); - DPRINTFN(WSP_LLEVEL_INFO, "RIGHT CLICK!\n"); + DPRINTFN(WSP_LLEVEL_INFO, "RIGHT CLICK!\n"); + } break; case 3: wsp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON2DOWN); @@ -804,8 +808,7 @@ wsp_intr_callback(struct usb_xfer *xfer, } wsp_add_to_queue(sc, 0, 0, 0, 0); /* button release */ } - if (sc->intr_count >= WSP_TAP_MAX_COUNT && - (sc->dt_sum / tun.scr_hor_threshold) != 0 && + if ((sc->dt_sum / tun.scr_hor_threshold) != 0 && sc->ntaps == 2 && sc->scr_mode == WSP_SCR_HOR) { /* @@ -903,7 +906,7 @@ wsp_intr_callback(struct usb_xfer *xfer, if (ntouch == 2 && sc->sc_status.button == 0) { if (sc->scr_mode == WSP_SCR_NONE && - abs(sc->dx_sum) + abs(sc->dy_sum) > 50) + 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 : WSP_SCR_VER; @@ -918,10 +921,16 @@ wsp_intr_callback(struct usb_xfer *xfer, dy = 0; if (sc->dz_count == 0) dz = sc->dz_sum / tun.z_factor; - if (abs(sc->pos_x[0] - sc->pos_x[1]) > MAX_DISTANCE || + if (sc->scr_mode == WSP_SCR_HOR || + abs(sc->pos_x[0] - sc->pos_x[1]) > MAX_DISTANCE || abs(sc->pos_y[0] - sc->pos_y[1]) > MAX_DISTANCE) dz = 0; } + if (ntouch == 3) { + dx = 0; + dy = 0; + dz = 0; + } if (sc->intr_count < WSP_TAP_MAX_COUNT && abs(dx) < 3 && abs(dy) < 3 && abs(dz) < 3) { dx = dy = dz = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402250837.s1P8b7lr000559>