Date: Sat, 29 Apr 2000 10:30:41 -0700 From: dan@tanelorn.demon.co.uk To: FreeBSD-gnats-submit@freebsd.org Subject: kern/18293: Patch to allow z-axis events on versapad touchpad Message-ID: <20000429103041.A768@mobiledan.mvfx.com>
next in thread | raw e-mail | index | archive | help
>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 (x0<MOUSE_VERSA_RIGHT_MARGIN) {
+ sc->scrolling = 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000429103041.A768>
