summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-28 20:30:50 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-28 20:30:50 +0000
commit7f3d37e82fe6add943d472b166163be6bf977b97 (patch)
tree7f096d07a6b564dff248b5251a3afa22e6b91d32
parent70ce0341935fd116216e76d40ef65d969227e892 (diff)
OpenBSD modifications: sunmouse protocol.
-rw-r--r--driver/xf86-input-mouse/src/mouse.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/driver/xf86-input-mouse/src/mouse.c b/driver/xf86-input-mouse/src/mouse.c
index d3eb62a00..d9875348b 100644
--- a/driver/xf86-input-mouse/src/mouse.c
+++ b/driver/xf86-input-mouse/src/mouse.c
@@ -348,6 +348,7 @@ static MouseProtocolRec mouseProtocols[] = {
{ "IntelliMouse", MSE_SERIAL, msDefaults, PROT_IMSERIAL },
{ "ThinkingMouse", MSE_SERIAL, msDefaults, PROT_THINKING },
{ "AceCad", MSE_SERIAL, acecadDefaults, PROT_ACECAD },
+ { "SunMouse", MSE_SERIAL, mlDefaults, PROT_SUNMOUSE },
{ "ValuMouseScroll", MSE_SERIAL, msDefaults, PROT_VALUMOUSESCROLL },
/* Standard PS/2 */
@@ -376,6 +377,8 @@ static MouseProtocolRec mouseProtocols[] = {
{ NULL, MSE_NONE, NULL, PROT_UNKNOWN }
};
+static unsigned char proto[PROT_NUMPROTOS][8];
+
#ifdef XFree86LOADER
/*ARGSUSED*/
static const OptionInfoRec *
@@ -1376,6 +1379,14 @@ MouseReadInput(InputInfoPtr pInfo)
for (j = 0; j < pBufP; j++)
pBuf[j] = pBuf[j+1];
pMse->inSync = 0;
+
+ /* If SunMouse gets a 5 byte packet, switch to MouseSystems */
+ if (!baddata && pMse->protocolID == PROT_SUNMOUSE &&
+ (u & pMse->protoPara[5]) == pMse->protoPara[6]) {
+ pMse->protocolID = PROT_MSC;
+ memcpy(pMse->protoPara, proto[pMse->protocolID],
+ sizeof(pMse->protoPara));
+ }
continue;
}
/* Tell auto probe that we were successful */
@@ -1423,6 +1434,7 @@ MouseReadInput(InputInfoPtr pInfo)
break;
case PROT_MSC: /* Mouse Systems Corp */
+ case PROT_SUNMOUSE:
buttons = (~pBuf[0]) & 0x07;
dx = (char)(pBuf[1]) + (char)(pBuf[3]);
dy = - ((char)(pBuf[2]) + (char)(pBuf[4]));
@@ -2494,6 +2506,7 @@ static unsigned char proto[PROT_NUMPROTOS][8] = {
{ 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* BusMouse */
{ 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* Auto (dummy) */
{ 0xf8, 0x80, 0x00, 0x00, 8, 0x00, 0xff, MPF_NONE }, /* SysMouse */
+ { 0xf8, 0x88, 0x00, 0x00, 3, 0xf8, 0x80, MPF_SAFE }, /* SunMouse */
};
@@ -2792,6 +2805,7 @@ initMouseHW(InputInfoPtr pInfo)
break;
case PROT_MSC: /* MouseSystems Corp */
+ case PROT_SUNMOUSE:
usleep(100000);
xf86FlushInput(pInfo->fd);
break;