Subject: Re: X and wscons
To: None <thorpej@nas.nasa.gov>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: current-users
Date: 07/27/1998 03:07:32
I've made some changes to XFree86 so that it can use wscons mice.
You just specify protocol wsmouse and the device /dev/wms0 (or whatever
you've got the mouse attached to).
The diffs (small) follow below. What should I do with them?
The diffs were taken in xsrc/xc/programs/Xserver/hw/xfree86/common.
-- Lennart
diff -c /users/augustss/common/xf86Config.c ./xf86Config.c
*** /users/augustss/common/xf86Config.c Mon Jul 27 00:32:16 1998
--- ./xf86Config.c Mon Jul 27 00:43:42 1998
***************
*** 1852,1857 ****
--- 1852,1858 ----
&& mouse_dev->mseType != P_GLIDEPOINTPS2
&& mouse_dev->mseType != P_NETPS2
&& mouse_dev->mseType != P_NETSCROLLPS2
+ && mouse_dev->mseType != P_WSMOUSE
&& mouse_dev->mseType != P_SYSMOUSE)
{
formatFlag = TRUE;
diff -c /users/augustss/common/xf86_Config.h ./xf86_Config.h
*** /users/augustss/common/xf86_Config.h Mon Jul 27 00:32:17 1998
--- ./xf86_Config.h Mon Jul 27 02:39:00 1998
***************
*** 184,192 ****
#define NETPS2 1035
#define NETSCROLLPS2 1036
#define SYSMOUSE 1037
! #define AUTOMOUSE 1038
! #define XQUE 1039
! #define OSMOUSE 1040
#ifdef INIT_CONFIG
static SymTabRec MouseTab[] = {
--- 184,193 ----
#define NETPS2 1035
#define NETSCROLLPS2 1036
#define SYSMOUSE 1037
! #define WSMOUSE 1038
! #define AUTOMOUSE 1039
! #define XQUE 1040
! #define OSMOUSE 1041
#ifdef INIT_CONFIG
static SymTabRec MouseTab[] = {
***************
*** 211,216 ****
--- 212,218 ----
{ AUTOMOUSE, "auto" },
{ XQUE, "xqueue" },
{ OSMOUSE, "osmouse" },
+ { WSMOUSE, "wsmouse" },
{ -1, "" },
};
#endif /* INIT_CONFIG */
***************
*** 548,554 ****
#define P_NETPS2 15 /* Genius PS/2 NetMouse */
#define P_NETSCROLLPS2 16 /* Genius PS/2 NetScroll */
#define P_SYSMOUSE 17 /* SysMouse */
! #define P_AUTO 18 /* automatic */
#define EMULATE3 50
#define BAUDRATE 51
--- 550,557 ----
#define P_NETPS2 15 /* Genius PS/2 NetMouse */
#define P_NETSCROLLPS2 16 /* Genius PS/2 NetScroll */
#define P_SYSMOUSE 17 /* SysMouse */
! #define P_WSMOUSE 18 /* wsmouse */
! #define P_AUTO 19 /* automatic */
#define EMULATE3 50
#define BAUDRATE 51
diff -c /users/augustss/common/xf86_Mouse.c ./xf86_Mouse.c
*** /users/augustss/common/xf86_Mouse.c Mon Jul 27 00:32:17 1998
--- ./xf86_Mouse.c Mon Jul 27 02:58:26 1998
***************
*** 46,51 ****
--- 46,55 ----
#include "xf86_OSlib.h"
#include "xf86_Config.h"
+ #if defined(__NetBSD__)
+ #include <dev/wscons/wsconsio.h>
+ #endif
+
#ifdef XINPUT
#include "xf86Xinput.h"
#include "extnsionst.h"
***************
*** 117,122 ****
--- 121,131 ----
FALSE, /* Genius NetScroll (PS/2) */
#endif /* __FreeBSD__ */
TRUE, /* sysmouse */
+ #if defined(__NetBSD__)
+ TRUE, /* wsmouse */
+ #else
+ FALSE, /* wsmouse */
+ #endif
#ifdef PNP_MOUSE
TRUE, /* auto */
#else
***************
*** 158,163 ****
--- 167,173 ----
0, /* NetScroll */
(CS8 | CSTOPB | CREAD | CLOCAL | HUPCL ), /* sysmouse */
+ 0, /* wsmouse */
0, /* auto */
};
#endif /* ! MOUSE_PROTOCOL_IN_KERNEL */
***************
*** 207,212 ****
--- 217,225 ----
{ 0xc0, 0x00, 0x00, 0x00, 6, 0x00, 0xff }, /* NetScroll */
{ 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff }, /* sysmouse */
+
+ { 0x00, 0x00, 0x00, 0x00, sizeof(struct wscons_event),
+ 0x00, 0xff }, /* wsmouse */
};
#endif /* ! MOUSE_PROTOCOL_IN_KERNEL */
***************
*** 536,541 ****
--- 549,559 ----
}
break;
+ #if defined(__NetBSD__)
+ case P_WSMOUSE:
+ break;
+ #endif
+
default:
xf86SetMouseSpeed(mouse, mouse->baudRate, mouse->baudRate,
xf86MouseCflags[mouse->mseType]);
***************
*** 617,623 ****
{
int i, buttons, dx, dy, dz;
static int pBufP = 0;
! static unsigned char pBuf[8];
MouseDevPtr mouse = MOUSE_DEV(device);
#ifdef EXTMOUSEDEBUG
--- 635,641 ----
{
int i, buttons, dx, dy, dz;
static int pBufP = 0;
! static unsigned char pBuf[32];
MouseDevPtr mouse = MOUSE_DEV(device);
#ifdef EXTMOUSEDEBUG
***************
*** 626,631 ****
--- 644,650 ----
ErrorF("%2x ",rBuf[i]);
ErrorF("\n");
#endif
+
for ( i=0; i < nBytes; i++) {
/*
* Hack for resyncing: We check here for a package that is:
***************
*** 885,890 ****
--- 904,938 ----
buttons |= (int)(~pBuf[7] & 0x07) << 3;
}
break;
+
+ case P_WSMOUSE: {
+ struct wscons_event ev;
+ memcpy(&ev, rBuf, sizeof ev);
+ /*ErrorF("wsmouse type=%2d value=%8d\n", ev.type, ev.value);*/
+ switch (ev.type) {
+ case WSCONS_EVENT_MOUSE_UP:
+ dx = dy = 0;
+ buttons = mouse->lastButtons & ~(1 << (2 - ev.value));
+ break;
+ case WSCONS_EVENT_MOUSE_DOWN:
+ dx = dy = 0;
+ buttons = mouse->lastButtons | (1 << (2 - ev.value));
+ break;
+ case WSCONS_EVENT_MOUSE_DELTA_X:
+ dx = ev.value;
+ dy = 0;
+ buttons = mouse->lastButtons;
+ break;
+ case WSCONS_EVENT_MOUSE_DELTA_Y:
+ dx = 0;
+ dy = -ev.value;
+ buttons = mouse->lastButtons;
+ break;
+ }
+ dz = 0;
+ /*ErrorF("wsmouse dx=%2d dy=%2d buttons=%d\n", dx, dy, buttons);*/
+ break;
+ }
default: /* There's a table error */
continue;