From owner-freebsd-bugs Sat Apr 29 10:40:22 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id A01C437B9CA for ; Sat, 29 Apr 2000 10:40:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA94948; Sat, 29 Apr 2000 10:40:09 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from mail.rdc1.sfba.home.com (ha1.rdc1.sfba.home.com [24.0.0.66]) by hub.freebsd.org (Postfix) with ESMTP id E696637B74D for ; Sat, 29 Apr 2000 10:33:32 -0700 (PDT) (envelope-from dan@mvfx.com) Received: from mobiledan.mvfx.com ([24.7.201.244]) by mail.rdc1.sfba.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <20000429173331.SOOJ12856.mail.rdc1.sfba.home.com@mobiledan.mvfx.com> for ; Sat, 29 Apr 2000 10:33:31 -0700 Received: (from dan@localhost) by mobiledan.mvfx.com (8.9.3/8.9.3) id KAA00791 for FreeBSD-gnats-submit@freebsd.org; Sat, 29 Apr 2000 10:30:41 -0700 (PDT) (envelope-from dan) Message-Id: <20000429103041.A768@mobiledan.mvfx.com> Date: Sat, 29 Apr 2000 10:30:41 -0700 From: dan@tanelorn.demon.co.uk Reply-To: dan@tanelorn.demon.co.uk To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/18293: Patch to allow z-axis events on versapad touchpad Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 18293 >Category: kern >Synopsis: lack of versapad mouse wheel emulation >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Apr 29 10:40:09 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Dan Piponi >Release: FreeBSD 4.0-RELEASE i386 >Organization: can be a good thing >Environment: FreeBSD-4.0 on i386 >Description: Under Windows the versapad touchpad (found on Sony Vaio 505T[SRX] laptops) drivers support 'wheel mouse' emulation when you drag your finger up and down the far right hand side of the pad. I have written a patch to the mouse driver for the versapad device to support this under FreeBSD. Most people I know who run OSes that don't support this emulation are pretty excited about this patch so I think it'd be cool to get it into the main distribution. I've been using it for several weeks now with no problems. Scrolls up and down the right hand side now generate z-movement events. It's well behaved so it doesn't mistake slides right and then up as z. Only moves that originate on the right hand side generate z events and so there's no chance of accidentally causing unwanted z events. This is ny first look at FreeBSD code so apologies if I've screwed anything up. But applying the patches works for me. I haven't figured out yet how to make this optiion nicely switchable from a config file - or even better from rc.conf. >How-To-Repeat: N/A >Fix: Here are the patches: *** /usr/src/sys/isa/psm.c Wed Mar 1 11:30:36 2000 --- psm.c Sat Apr 29 09:13:59 2000 *************** *** 168,173 **** --- 168,174 ---- int button; /* the latest button state */ int xold; /* previous absolute X position */ int yold; /* previous absolute Y position */ + int scrolling; /* emulating mouse wheel */ }; devclass_t psm_devclass; #define PSM_SOFTC(unit) ((struct psm_softc*)devclass_get_softc(psm_devclass, unit)) *************** *** 1951,1973 **** if (y0 & 0x800) y0 -= 0x1000; if (sc->flags & PSM_FLAGS_FINGERDOWN) { ! x = sc->xold - x0; ! y = y0 - sc->yold; ! if (x < 0) /* XXX */ ! x++; ! else if (x) ! x--; ! if (y < 0) ! y++; ! else if (y) ! y--; } else { sc->flags |= PSM_FLAGS_FINGERDOWN; } sc->xold = x0; sc->yold = y0; } else { sc->flags &= ~PSM_FLAGS_FINGERDOWN; } c = ((x < 0) ? MOUSE_PS2_XNEG : 0) | ((y < 0) ? MOUSE_PS2_YNEG : 0); --- 1952,2002 ---- if (y0 & 0x800) y0 -= 0x1000; if (sc->flags & PSM_FLAGS_FINGERDOWN) { ! #if defined(MOUSE_VERSA_SCROLL) ! /* ! * Support for mouse wheel emulation ! */ ! #define MOUSE_VERSA_SCROLL ! if (sc->scrolling) { ! z = (sc->yold-y0)/MOUSE_VERSA_SCROLLSTEP; ! #if defined(MOUSE_VERSA_FRACTIONAL_SCROLL) ! /* ! * We might not have 'consumed' all of the change ! * in y because of the division by SCROLLSTEP ! * so save it for the next mouse movement. ! */ ! y0 = sc->yold-z*8; ! #endif /* defined(MOUSE_VERSA_FRACTIONAL_SCROLL) */ ! } else { ! #endif /* defined(MOUSE_VERSA_SCROLL) */ ! x = sc->xold - x0; ! y = y0 - sc->yold; ! if (x < 0) /* XXX */ ! x++; ! else if (x) ! x--; ! if (y < 0) ! y++; ! else if (y) ! y--; ! #if defined(MOUSE_VERSA_SCROLL) ! } ! #endif /* defined(MOUSE_VERSA_SCROLL) */ } else { sc->flags |= PSM_FLAGS_FINGERDOWN; + #if defined(MOUSE_VERSA_SCROLL) + if (x0scrolling = 1; + } + #endif /* defined(MOUSE_VERSA_SCROLL) */ } sc->xold = x0; sc->yold = y0; } else { sc->flags &= ~PSM_FLAGS_FINGERDOWN; + #if defined(MOUSE_VERSA_SCROLL) + sc->scrolling = 0; + #endif /* defined(MOUSE_VERSA_SCROLL) */ } c = ((x < 0) ? MOUSE_PS2_XNEG : 0) | ((y < 0) ? MOUSE_PS2_YNEG : 0); *** /usr/src/sys/i386/include/mouse.h Fri Aug 27 17:44:18 1999 --- mouse.h Sat Apr 29 09:14:08 2000 *************** *** 239,244 **** --- 239,249 ---- #define MOUSE_PS2PLUS_SYNCMASK 0x48 #define MOUSE_PS2PLUS_SYNC 0x48 + #define MOUSE_VERSA_SCROLL + #define MOUSE_VERSA_SCROLLSTEP 32 + #define MOUSE_VERSA_RIGHT_MARGIN -180 + #define MOUSE_VERSA_FRACTIONAL_SCROLL + /* Interlink VersaPad (serial I/F) data packet */ #define MOUSE_VERSA_PACKETSIZE 6 #define MOUSE_VERSA_IN_USE 0x04 >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message