summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/mouse.man6
-rw-r--r--src/mouse.c111
-rw-r--r--src/mouse.h31
-rw-r--r--src/mousePriv.h12
-rw-r--r--src/pnp.c42
5 files changed, 123 insertions, 79 deletions
diff --git a/man/mouse.man b/man/mouse.man
index 6dcf0f0..0b2dac1 100644
--- a/man/mouse.man
+++ b/man/mouse.man
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man,v 1.5 2002/12/17 20:55:21 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man,v 1.7 2003/05/29 21:48:10 herrb Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH MOUSE __drivermansuffix__ __vendorversion__
@@ -55,7 +55,7 @@ Specify the mouse protocol. Valid protocol types include:
.PP
.RS 12
Auto, Microsoft, MouseSystems, MMSeries, Logitech, MouseMan, MMHitTab,
-GlidePoint, IntelliMouse, ThinkingMouse, AceCad, PS/2, ImPS/2,
+GlidePoint, IntelliMouse, ThinkingMouse, ValuMouseScroll, AceCad, PS/2, ImPS/2,
ExplorerPS/2, ThinkingMousePS/2, MouseManPlusPS/2, GlidePointPS/2,
NetMousePS/2, NetScrollPS/2, BusMouse, SysMouse, WSMouse, USB, Xqueue.
.RE
@@ -192,7 +192,7 @@ Default: whatever the mouse is already set to.
.TP 7
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
-that low dexterity people do not have to hold a buttton down at the
+that low dexterity people do not have to hold a button down at the
same time they move a mouse cursor. Button numbers occur in pairs,
with the lock button number occurring first, followed by the button
number that is the target of the lock button.
diff --git a/src/mouse.c b/src/mouse.c
index 3234230..0cbca6f 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.69 2003/02/11 03:33:06 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.79 2003/11/03 05:11:48 tsi Exp $ */
/*
*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
@@ -201,6 +201,7 @@ typedef enum {
OPTION_DRAGLOCKBUTTONS
} MouseOpts;
+#ifdef XFree86LOADER
static const OptionInfoRec mouseOptions[] = {
{ OPTION_ALWAYS_CORE, "AlwaysCore", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SEND_CORE_EVENTS, "SendCoreEvents", OPTV_BOOLEAN, {0}, FALSE },
@@ -240,6 +241,9 @@ static const OptionInfoRec mouseOptions[] = {
/* end serial options */
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
+#endif
+
+#define RETRY_COUNT 4
/*
* Microsoft (all serial models), Logitech MouseMan, First Mouse, etc,
@@ -326,6 +330,7 @@ static MouseProtocolRec mouseProtocols[] = {
{ "IntelliMouse", MSE_SERIAL, msDefaults, PROT_IMSERIAL },
{ "ThinkingMouse", MSE_SERIAL, msDefaults, PROT_THINKING },
{ "AceCad", MSE_SERIAL, acecadDefaults, PROT_ACECAD },
+ { "ValuMouseScroll", MSE_SERIAL, msDefaults, PROT_VALUMOUSESCROLL },
/* Standard PS/2 */
{ "PS/2", MSE_PS2, NULL, PROT_PS2 },
@@ -471,7 +476,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
lock--;
/* initialize table that maps drag lock mask to target mask */
- pLock->nib_table[lock / NIB_SIZE][1 << (lock % NIB_BITS)] =
+ pLock->nib_table[lock / NIB_BITS][1 << (lock % NIB_BITS)] =
targetM;
/* add new drag lock to mask of drag locks */
@@ -874,8 +879,9 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
InputInfoPtr pInfo;
MouseDevPtr pMse;
mousePrivPtr mPriv;
- MessageType from = X_DEFAULT;
+ MessageType protocolFrom = X_DEFAULT, deviceFrom = X_CONFIG;
const char *protocol, *osProt = NULL;
+ const char *device;
MouseProtocolID protocolID;
MouseProtocolPtr pProto;
Bool detected;
@@ -905,6 +911,11 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pInfo->always_core_feedback = 0;
pInfo->conf_idev = dev;
+ /* Check if SendDragEvents has been disabled. */
+ if (!xf86SetBoolOption(dev->commonOptions, "SendDragEvents", TRUE)) {
+ pInfo->flags &= ~XI86_SEND_DRAG_EVENTS;
+ }
+
/* Allocate the MouseDevRec and initialise it. */
/*
* XXX This should be done by a function in the core server since the
@@ -920,10 +931,10 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
/* Find the protocol type. */
protocol = xf86SetStrOption(dev->commonOptions, "Protocol", NULL);
if (protocol) {
- from = X_CONFIG;
+ protocolFrom = X_CONFIG;
} else if (osInfo->DefaultProtocol) {
protocol = osInfo->DefaultProtocol();
- from = X_DEFAULT;
+ protocolFrom = X_DEFAULT;
}
if (!protocol) {
xf86Msg(X_ERROR, "%s: No Protocol specified\n", pInfo->name);
@@ -937,7 +948,7 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
case PROT_AUTO:
if (osInfo->SetupAuto) {
if ((osProt = osInfo->SetupAuto(pInfo,NULL))) {
- int id = ProtocolNameToID(osProt);
+ MouseProtocolID id = ProtocolNameToID(osProt);
if (id == PROT_UNKNOWN || id == PROT_UNSUP) {
protocolID = id;
protocol = osProt;
@@ -951,6 +962,16 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
* and call its PreInit. */
if (osInfo->CheckProtocol
&& osInfo->CheckProtocol(protocol)) {
+ if (!xf86CheckStrOption(dev->commonOptions, "Device", NULL) &&
+ HAVE_FIND_DEVICE && osInfo->FindDevice) {
+ xf86Msg(X_WARNING, "%s: No Device specified, "
+ "looking for one...\n", pInfo->name);
+ if (!osInfo->FindDevice(pInfo, protocol, 0)) {
+ xf86Msg(X_ERROR, "%s: Cannot find which device "
+ "to use.\n", pInfo->name);
+ } else
+ deviceFrom = X_PROBED;
+ }
if (osInfo->PreInit) {
osInfo->PreInit(pInfo, protocol, 0);
}
@@ -972,8 +993,24 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
} while (!detected);
-
- xf86Msg(from, "%s: Protocol: \"%s\"\n", pInfo->name, protocol);
+ if (!xf86CheckStrOption(dev->commonOptions, "Device", NULL) &&
+ HAVE_FIND_DEVICE && osInfo->FindDevice) {
+ xf86Msg(X_WARNING, "%s: No Device specified, looking for one...\n",
+ pInfo->name);
+ if (!osInfo->FindDevice(pInfo, protocol, 0)) {
+ xf86Msg(X_ERROR, "%s: Cannot find which device to use.\n",
+ pInfo->name);
+ } else {
+ deviceFrom = X_PROBED;
+ xf86MarkOptionUsedByName(dev->commonOptions, "Device");
+ }
+ }
+
+ device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
+ if (device)
+ xf86Msg(deviceFrom, "%s: Device: \"%s\"\n", pInfo->name, device);
+
+ xf86Msg(protocolFrom, "%s: Protocol: \"%s\"\n", pInfo->name, protocol);
if (!(pProto = GetProtocol(protocolID)))
return pInfo;
@@ -1049,6 +1086,11 @@ MouseReadInput(InputInfoPtr pInfo)
while ((c = XisbRead(pMse->buffer)) >= 0) {
u = (unsigned char)c;
+
+#if defined (EXTMOUSEDEBUG) || defined (MOUSEDATADEBUG)
+ ErrorF("mouse byte: %2.2x\n",u);
+#endif
+
#if 1
/* if we do autoprobing collect the data */
if (pMse->collectData && pMse->autoProbe)
@@ -1346,14 +1388,14 @@ MouseReadInput(InputInfoPtr pInfo)
(pBuf[0] & 0x80) >> 3; /* button 5 */
dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
- dz = (char)pBuf[3];
- if ((dz >= 7) || (dz <= -8)) {
- if (pMse->autoProbe && !(pBuf[3] & 0xC0)) {
+ dz = (char)(pBuf[3] | ((pBuf[3] & 0x08) ? 0xf8 : 0));
+ if ((pBuf[3] & 0xf8) && ((pBuf[3] & 0xf8) != 0xf8)) {
+ if (pMse->autoProbe) {
SetMouseProto(pMse, PROT_EXPPS2);
xf86Msg(X_INFO,
"Mouse autoprobe: Changing protocol to %s\n",
pMse->protocol);
-
+
goto REDO_INTERPRET;
} else
dz = 0;
@@ -1462,6 +1504,16 @@ MouseReadInput(InputInfoPtr pInfo)
}
break;
+ case PROT_VALUMOUSESCROLL: /* Kensington ValuMouseScroll */
+ buttons = ((int)(pBuf[0] & 0x20) >> 3)
+ | ((int)(pBuf[0] & 0x10) >> 4)
+ | ((int)(pBuf[3] & 0x10) >> 3);
+ dx = (char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
+ dy = (char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
+ dz = (pBuf[3] & 0x08) ? ((int)(pBuf[3] & 0x0F) - 0x10) :
+ ((int)(pBuf[3] & 0x0F));
+ break;
+
default: /* There's a table error */
#ifdef EXTMOUSEDEBUG
ErrorF("mouse table error\n");
@@ -1537,7 +1589,6 @@ MouseProc(DeviceIntPtr device, int what)
pInfo = device->public.devicePrivate;
pMse = pInfo->private;
pMse->device = device;
- mPriv = (mousePrivPtr)pMse->mousePriv;
switch (what)
{
@@ -1585,7 +1636,7 @@ MouseProc(DeviceIntPtr device, int what)
XisbFree(pMse->buffer);
pMse->buffer = NULL;
} else {
- mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
+ mPriv = (mousePrivPtr)pMse->mousePriv;
if (mPriv != NULL) {
if ( pMse->protocolID != PROT_AUTO) {
pMse->inSync = TRUE; /* @@@ */
@@ -2193,8 +2244,8 @@ MousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw)
*
******************************************************************/
/*
- * This array is indexed by the MouseProtocolID values, so the order of the entries
- * must match that of the MouseProtocolID enum in mouse.h.
+ * This array is indexed by the MouseProtocolID values, so the order of the
+ * entries must match that of the MouseProtocolID enum in xf86OSmouse.h.
*/
static unsigned char proto[PROT_NUMPROTOS][8] = {
/* --header-- ---data--- packet -4th-byte- mouse */
@@ -2210,6 +2261,7 @@ static unsigned char proto[PROT_NUMPROTOS][8] = {
{ 0x40, 0x40, 0x40, 0x00, 3, ~0x3f, 0x00, MPF_NONE }, /* IntelliMouse */
{ 0x40, 0x40, 0x40, 0x00, 3, ~0x33, 0x00, MPF_NONE }, /* ThinkingMouse */
{ 0x80, 0x80, 0x80, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* ACECAD */
+ { 0x40, 0x40, 0x40, 0x00, 4, 0x00, 0xff, MPF_NONE }, /* ValuMouseScroll */
/* PS/2 variants */
{ 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff, MPF_NONE }, /* PS/2 mouse */
{ 0xc8, 0x08, 0x00, 0x00, 3, 0x00, 0x00, MPF_NONE }, /* genericPS/2 mouse*/
@@ -2235,14 +2287,12 @@ static Bool
SetupMouse(InputInfoPtr pInfo)
{
MouseDevPtr pMse;
- mousePrivPtr mPriv;
int i;
int protoPara[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
const char *name = NULL;
Bool automatic = FALSE;
pMse = pInfo->private;
- mPriv = (mousePrivPtr)pMse->mousePriv;
/* Handle the "Auto" protocol. */
if (pMse->protocolID == PROT_AUTO) {
@@ -2370,7 +2420,7 @@ SetupMouse(InputInfoPtr pInfo)
* Do a reset wrap mode before reset.
*/
#define do_ps2Reset(x) { \
- int i = 10;\
+ int i = RETRY_COUNT;\
while (i-- > 0) { \
xf86FlushInput(x->fd); \
if (ps2Reset(x)) break; \
@@ -2388,7 +2438,7 @@ initMouseHW(InputInfoPtr pInfo)
pointer options;
unsigned char *param = NULL;
int paramlen = 0;
- int count = 10;
+ int count = RETRY_COUNT;
Bool ps2Init = TRUE;
switch (pMse->protocolID) {
@@ -2553,7 +2603,7 @@ initMouseHW(InputInfoPtr pInfo)
case PROT_IMPS2: /* IntelliMouse */
{
- static unsigned char seq[] = { 243, 200, 243, 100, 243, 80, 242 };
+ static unsigned char seq[] = { 243, 200, 243, 100, 243, 80 };
param = seq;
paramlen = sizeof(seq);
}
@@ -2562,7 +2612,7 @@ initMouseHW(InputInfoPtr pInfo)
case PROT_EXPPS2: /* IntelliMouse Explorer */
{
static unsigned char seq[] = { 243, 200, 243, 100, 243, 80,
- 243, 200, 243, 200, 243, 80, 242 };
+ 243, 200, 243, 200, 243, 80 };
param = seq;
paramlen = sizeof(seq);
@@ -2572,7 +2622,7 @@ initMouseHW(InputInfoPtr pInfo)
case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */
case PROT_NETSCPS2: /* NetScroll */
{
- static unsigned char seq[] = { 232, 3, 230, 230, 230, };
+ static unsigned char seq[] = { 232, 3, 230, 230, 230 };
param = seq;
paramlen = sizeof(seq);
@@ -2582,7 +2632,7 @@ initMouseHW(InputInfoPtr pInfo)
case PROT_MMPS2: /* MouseMan+, FirstMouse+ */
{
static unsigned char seq[] = { 230, 232, 0, 232, 3, 232, 2, 232, 1,
- 230, 232, 3, 232, 1, 232, 2, 232, 3, };
+ 230, 232, 3, 232, 1, 232, 2, 232, 3 };
param = seq;
paramlen = sizeof(seq);
}
@@ -2592,7 +2642,7 @@ initMouseHW(InputInfoPtr pInfo)
{
static unsigned char seq[] = { 243, 10, 232, 0, 243, 20, 243, 60,
243, 40, 243, 20, 243, 20, 243, 60,
- 243, 40, 243, 20, 243, 20, };
+ 243, 40, 243, 20, 243, 20 };
param = seq;
paramlen = sizeof(seq);
}
@@ -2625,7 +2675,8 @@ initMouseHW(InputInfoPtr pInfo)
if (!count--)
return TRUE;
goto REDO;
- }
+ }
+ ps2GetDeviceID(pInfo);
usleep(30000);
xf86FlushInput(pInfo->fd);
}
@@ -2675,7 +2726,7 @@ initMouseHW(InputInfoPtr pInfo)
else
c2[1] = 0;
} else {
- c2[1] = 2;
+ c2[1] = 3; /* used to be 2, W. uses 3 */
}
if (!ps2SendPacket(pInfo,c2,2)) {
if (!count--)
@@ -2923,6 +2974,12 @@ autoOSProtocol(InputInfoPtr pInfo, int *protoPara)
}
}
#endif
+ if (!name && HAVE_GUESS_PROTOCOL && osInfo->GuessProtocol) {
+ name = osInfo->GuessProtocol(pInfo, 0);
+ if (name)
+ protocolID = ProtocolNameToID(name);
+ }
+
if (name) {
pMse->protocolID = protocolID;
}
diff --git a/src/mouse.h b/src/mouse.h
index 76295c7..16c5a82 100644
--- a/src/mouse.h
+++ b/src/mouse.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h,v 1.11 2002/09/16 18:06:07 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.h,v 1.13 2003/11/03 05:11:49 tsi Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -7,34 +7,7 @@
#ifndef MOUSE_H_
#define MOUSE_H_
-/* Mouse Protocol IDs. */
-typedef enum {
- PROT_UNKNOWN = -2,
- PROT_UNSUP = -1, /* protocol is not supported */
- PROT_MS = 0,
- PROT_MSC,
- PROT_MM,
- PROT_LOGI,
- PROT_LOGIMAN,
- PROT_MMHIT,
- PROT_GLIDE,
- PROT_IMSERIAL,
- PROT_THINKING,
- PROT_ACECAD,
- PROT_PS2,
- PROT_GENPS2,
- PROT_IMPS2,
- PROT_EXPPS2,
- PROT_THINKPS2,
- PROT_MMPS2,
- PROT_GLIDEPS2,
- PROT_NETPS2,
- PROT_NETSCPS2,
- PROT_BM,
- PROT_AUTO,
- PROT_SYSMOUSE,
- PROT_NUMPROTOS /* This must always be last. */
-} MouseProtocolID;
+#include "xf86OSmouse.h"
const char * xf86MouseProtocolIDToName(MouseProtocolID id);
MouseProtocolID xf86MouseProtocolNameToID(const char *name);
diff --git a/src/mousePriv.h b/src/mousePriv.h
index 0b76b1d..262d029 100644
--- a/src/mousePriv.h
+++ b/src/mousePriv.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h,v 1.8 2002/09/16 18:06:08 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mousePriv.h,v 1.11 2003/11/03 05:11:49 tsi Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
*/
@@ -6,6 +6,11 @@
#ifndef _X_MOUSEPRIV_H
#define _X_MOUSEPRIV_H
+#if 0
+# define MOUSEINITDEBUG
+# define MOUSEDATADEBUG
+#endif
+
#include "mouse.h"
#include "xf86Xinput.h"
/* Private interface for the mouse driver. */
@@ -52,7 +57,7 @@ typedef struct {
int count;
char data[NUM_MSE_AUTOPROBE_TOTAL];
mseAutoProbeStates autoState;
- int protoList[NUM_AUTOPROBE_PROTOS];
+ MouseProtocolID protoList[NUM_AUTOPROBE_PROTOS];
int serialDefaultsNum;
int prevDx, prevDy;
int accDx, accDy;
@@ -66,9 +71,10 @@ typedef struct {
#define MPF_SAFE 0x01
/* pnp.c */
-int MouseGetPnpProtocol(InputInfoPtr pInfo);
+MouseProtocolID MouseGetPnpProtocol(InputInfoPtr pInfo);
Bool ps2Reset(InputInfoPtr pInfo);
Bool ps2EnableDataReporting(InputInfoPtr pInfo);
Bool ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len);
+int ps2GetDeviceID(InputInfoPtr pInfo);
#endif /* _X_MOUSE_H */
diff --git a/src/pnp.c b/src/pnp.c
index a5e650d..0ae100f 100644
--- a/src/pnp.c
+++ b/src/pnp.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c,v 1.16 2003/02/04 15:21:18 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/pnp.c,v 1.21 2003/11/03 05:11:49 tsi Exp $ */
/*
* Copyright 1998 by Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
*
@@ -35,6 +35,11 @@
#include "mouse.h"
#include "mousePriv.h"
+#ifdef MOUSEINITDEBUG
+# define DEBUG
+# define EXTMOUSEDEBUG
+#endif
+
/* serial PnP ID string */
typedef struct {
int revision; /* PnP revision, 100 for 1.00 */
@@ -53,7 +58,7 @@ typedef struct {
/* symbol table entry */
typedef struct {
char *name;
- int val;
+ MouseProtocolID val;
} symtab_t;
/* PnP EISA/product IDs */
@@ -118,7 +123,7 @@ static symtab_t pnpprod[] = {
{ "PNP0F1D", PROT_??? }, /* Compaq LTE TrackBall serial */
{ "PNP0F1E", PROT_??? }, /* MS Kids Trackball */
#endif
- { NULL, -1 },
+ { NULL, PROT_UNKNOWN },
};
static const char *pnpSerial[] = {
@@ -134,13 +139,13 @@ static const char *pnpSerial[] = {
static int pnpgets(InputInfoPtr, char *, Bool *prePNP);
static int pnpparse(InputInfoPtr, pnpid_t *, char *, int);
-static int prepnpparse(InputInfoPtr pInfo, char *buf);
+static MouseProtocolID prepnpparse(InputInfoPtr pInfo, char *buf);
static symtab_t *pnpproto(pnpid_t *);
static symtab_t *gettoken(symtab_t *, char *, int);
static MouseProtocolID getPs2ProtocolPnP(InputInfoPtr pInfo);
static MouseProtocolID probePs2ProtocolPnP(InputInfoPtr pInfo);
-static int
+static MouseProtocolID
MouseGetSerialPnpProtocol(InputInfoPtr pInfo)
{
char buf[256]; /* PnP ID string may be up to 256 bytes long */
@@ -164,12 +169,12 @@ MouseGetSerialPnpProtocol(InputInfoPtr pInfo)
return PROT_UNKNOWN;
}
-int
+MouseProtocolID
MouseGetPnpProtocol(InputInfoPtr pInfo)
{
MouseDevPtr pMse = pInfo->private;
mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
- int val;
+ MouseProtocolID val;
CARD32 last;
if ((val = MouseGetSerialPnpProtocol(pInfo)) != PROT_UNKNOWN) {
@@ -473,7 +478,7 @@ pnpparse(InputInfoPtr pInfo, pnpid_t *id, char *buf, int len)
/* checksum exists if there are any optional fields */
if ((id->nserial > 0) || (id->nclass > 0)
|| (id->ncompat > 0) || (id->ndescription > 0)) {
- xf86MsgVerb(X_INFO, 4, "PnP checksum: 0x%02X\n", pInfo->name, sum);
+ xf86MsgVerb(X_INFO, 4, "%s: PnP checksum: 0x%02X\n", pInfo->name, sum);
sprintf(s, "%02X", sum & 0x0ff);
if (strncmp(s, &buf[len - 3], 2) != 0) {
#if 0
@@ -491,7 +496,7 @@ pnpparse(InputInfoPtr pInfo, pnpid_t *id, char *buf, int len)
}
/* We can only identify MS at the moment */
-static int
+static MouseProtocolID
prepnpparse(InputInfoPtr pInfo, char *buf)
{
if (buf[0] == 'M' && buf[1] == '3')
@@ -638,11 +643,14 @@ ps2EnableDataReporting(InputInfoPtr pInfo)
return ps2SendPacket(pInfo, packet, sizeof(packet));
}
-static int
+int
ps2GetDeviceID(InputInfoPtr pInfo)
{
unsigned char u;
unsigned char packet[] = { 0xf2 };
+
+ usleep(30000);
+ xf86FlushInput(pInfo->fd);
if (!ps2SendPacket(pInfo, packet, sizeof(packet)))
return -1;
while (1) {
@@ -663,7 +671,7 @@ ps2Reset(InputInfoPtr pInfo)
unsigned char u;
unsigned char packet[] = { 0xff };
unsigned char reply[] = { 0xaa, 0x00 };
- int i;
+ unsigned int i;
#ifdef DEBUG
xf86ErrorF("PS/2 Mouse reset\n");
#endif
@@ -696,16 +704,16 @@ probePs2ProtocolPnP(InputInfoPtr pInfo)
ps2DisableDataReporting(pInfo);
if (ps2Reset(pInfo)) { /* Reset PS2 device */
- unsigned char seq[] = { 243, 200, 243, 100, 243, 80, 242 };
+ unsigned char seq[] = { 243, 200, 243, 100, 243, 80 };
/* Try to identify Intelli Mouse */
if (ps2SendPacket(pInfo, seq, sizeof(seq))) {
- readMouse(pInfo,&u);
+ u = ps2GetDeviceID(pInfo);
if (u == 0x03) {
/* found IntelliMouse now try IntelliExplorer */
- unsigned char seq[] = { 243, 200, 243, 200, 243, 80, 242 };
+ unsigned char seq[] = { 243, 200, 243, 200, 243, 80 };
if (ps2SendPacket(pInfo,seq,sizeof(seq))) {
- readMouse(pInfo,&u);
- if (u == 0x05)
+ u = ps2GetDeviceID(pInfo);
+ if (u == 0x04)
ret = PROT_EXPPS2;
else
ret = PROT_IMPS2;
@@ -726,7 +734,7 @@ static struct ps2protos {
} ps2 [] = {
{ 0x0, PROT_PS2 },
{ 0x3, PROT_IMPS2 },
- { 0x5, PROT_EXPPS2 },
+ { 0x4, PROT_EXPPS2 },
{ -1 , PROT_UNKNOWN }
};