mirror of
https://github.com/X11Libre/xf86-input-mouse.git
synced 2026-04-14 10:54:18 +00:00
Strip trailing whitespace
cleanup done via: perl -p -i -e 's/[\t ]*$//' "git diff -w" shows no changes - this is pure whitespace adjustment. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
@@ -14,9 +14,9 @@ mouse \- __xservername__ mouse input driver
|
||||
.B EndSection
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B mouse
|
||||
is an __xservername__ input driver for mice. The driver supports most
|
||||
available mouse types and interfaces, though the level of support for
|
||||
.B mouse
|
||||
is an __xservername__ input driver for mice. The driver supports most
|
||||
available mouse types and interfaces, though the level of support for
|
||||
types of mice depends on the OS.
|
||||
.PP
|
||||
The
|
||||
@@ -52,23 +52,23 @@ so that the host computer can automatically detect the mouse
|
||||
and load an appropriate driver.
|
||||
This driver supports this specification and can detect
|
||||
popular PnP serial mouse models on most platforms.
|
||||
.TP
|
||||
.TP
|
||||
Bus mouse
|
||||
The bus mouse connects to a dedicated interface card in an expansion
|
||||
slot.
|
||||
Some older video cards, notably those from ATI, and integrated I/O
|
||||
cards may also have a bus mouse connector.
|
||||
.PP
|
||||
The interface type of the mouse can be determined by looking at the connector
|
||||
The interface type of the mouse can be determined by looking at the connector
|
||||
of the mouse.
|
||||
USB mice have a thin rectangular connector.
|
||||
PS/2 mice are equipped with a small, round DIN 6-pin connector.
|
||||
Serial mouse have a D-Sub female 9- or 25-pin connector.
|
||||
Bus mice have either a D-Sub male 9-pin connector
|
||||
Bus mice have either a D-Sub male 9-pin connector
|
||||
or a round DIN 9-pin connector.
|
||||
Some mice come with adapters with which the connector can
|
||||
Some mice come with adapters with which the connector can
|
||||
be converted to another. If you are to use such an adapter,
|
||||
remember that the connector at the very end of the mouse/adapter pair is
|
||||
remember that the connector at the very end of the mouse/adapter pair is
|
||||
what matters.
|
||||
.SH CONFIGURATION DETAILS
|
||||
.PP
|
||||
@@ -276,7 +276,7 @@ number that is the target of the lock button.
|
||||
.TP 7
|
||||
.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q
|
||||
Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
|
||||
indicating that the next button pressed is to be
|
||||
indicating that the next button pressed is to be
|
||||
\*qdrag locked\*q.
|
||||
.TP 7
|
||||
.BI "Option \*qClearDTR\*q \*q" boolean \*q
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
AM_CFLAGS = $(CWARNFLAGS)
|
||||
AM_CFLAGS = $(CWARNFLAGS)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include $(XORG_CFLAGS)
|
||||
|
||||
# this is obnoxious:
|
||||
|
||||
@@ -179,7 +179,7 @@ static struct {
|
||||
{ MOUSE_PROTO_THINK, "ThinkingMouse" },
|
||||
{ MOUSE_PROTO_SYSMOUSE, "SysMouse" }
|
||||
};
|
||||
|
||||
|
||||
static const char *
|
||||
SetupAuto(InputInfoPtr pInfo, int *protoPara)
|
||||
{
|
||||
@@ -193,7 +193,7 @@ SetupAuto(InputInfoPtr pInfo, int *protoPara)
|
||||
/* set the driver operation level, if applicable */
|
||||
i = 1;
|
||||
ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
|
||||
|
||||
|
||||
/* interrogate the driver and get some intelligence on the device. */
|
||||
hw.iftype = MOUSE_IF_UNKNOWN;
|
||||
hw.model = MOUSE_MODEL_GENERIC;
|
||||
@@ -301,7 +301,7 @@ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
|
||||
continue;
|
||||
} else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
|
||||
/* Check if /dev/mouse is the same as /dev/sysmouse. */
|
||||
if (devMouse && fstat(fd, &sb) == 0 &&
|
||||
if (devMouse && fstat(fd, &sb) == 0 &&
|
||||
devMouseStat.st_dev == sb.st_dev &&
|
||||
devMouseStat.st_ino == sb.st_ino) {
|
||||
/* If the same, use /dev/sysmouse. */
|
||||
@@ -390,7 +390,7 @@ wsconsReadInput(InputInfoPtr pInfo)
|
||||
{
|
||||
MouseDevPtr pMse;
|
||||
static struct wscons_event eventList[NUMEVENTS];
|
||||
int n, c;
|
||||
int n, c;
|
||||
struct wscons_event *event = eventList;
|
||||
unsigned char *pBuf;
|
||||
|
||||
@@ -493,16 +493,16 @@ usbMouseProc(DeviceIntPtr pPointer, int what)
|
||||
pUsbMse = pMse->mousePriv;
|
||||
|
||||
switch (what) {
|
||||
case DEVICE_INIT:
|
||||
case DEVICE_INIT:
|
||||
pPointer->public.on = FALSE;
|
||||
|
||||
for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
|
||||
map[nbuttons + 1] = nbuttons + 1;
|
||||
|
||||
InitPointerDeviceStruct((DevicePtr)pPointer,
|
||||
map,
|
||||
InitPointerDeviceStruct((DevicePtr)pPointer,
|
||||
map,
|
||||
min(pMse->buttons, MSE_MAXBUTTONS),
|
||||
miPointerGetMotionEvents,
|
||||
miPointerGetMotionEvents,
|
||||
pMse->Ctrl,
|
||||
miPointerGetMotionBufferSize());
|
||||
|
||||
@@ -527,7 +527,7 @@ usbMouseProc(DeviceIntPtr pPointer, int what)
|
||||
pInfo->fd = -1;
|
||||
} else {
|
||||
xf86FlushInput(pInfo->fd);
|
||||
if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput,
|
||||
if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput,
|
||||
pInfo))
|
||||
AddEnabledDevice(pInfo->fd);
|
||||
}
|
||||
@@ -569,7 +569,7 @@ usbReadInput(InputInfoPtr pInfo)
|
||||
UsbMsePtr pUsbMse;
|
||||
int buttons = pMse->lastButtons;
|
||||
int dx = 0, dy = 0, dz = 0, dw = 0;
|
||||
int n, c;
|
||||
int n, c;
|
||||
unsigned char *pBuf;
|
||||
|
||||
pMse = pInfo->private;
|
||||
@@ -590,7 +590,7 @@ usbReadInput(InputInfoPtr pInfo)
|
||||
/* discard packets with an id that don't match the mouse */
|
||||
/* XXX this is probably not the right thing */
|
||||
if (pUsbMse->iid != 0) {
|
||||
if (*pBuf++ != pUsbMse->iid)
|
||||
if (*pBuf++ != pUsbMse->iid)
|
||||
return;
|
||||
}
|
||||
dx = hid_get_data(pBuf, &pUsbMse->loc_x);
|
||||
@@ -600,7 +600,7 @@ usbReadInput(InputInfoPtr pInfo)
|
||||
|
||||
buttons = 0;
|
||||
for (n = 0; n < pMse->buttons; n++) {
|
||||
if (hid_get_data(pBuf, &pUsbMse->loc_btn[n]))
|
||||
if (hid_get_data(pBuf, &pUsbMse->loc_btn[n]))
|
||||
buttons |= (1 << UMS_BUT(n));
|
||||
}
|
||||
pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
|
||||
@@ -748,7 +748,7 @@ bsdMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
OSMouseInfoPtr
|
||||
OSMouseInit(int flags)
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
typedef unsigned short kev_type; /* kd event type */
|
||||
typedef unsigned char Scancode;
|
||||
|
||||
struct mouse_motion {
|
||||
struct mouse_motion {
|
||||
short mm_deltaX; /* units? */
|
||||
short mm_deltaY;
|
||||
};
|
||||
@@ -66,7 +66,7 @@ typedef struct {
|
||||
} value;
|
||||
} kd_event;
|
||||
|
||||
/*
|
||||
/*
|
||||
* kd_event ID's.
|
||||
*/
|
||||
#define MOUSE_LEFT 1 /* mouse left button up/down */
|
||||
@@ -87,7 +87,7 @@ OsMouseReadInput(InputInfoPtr pInfo)
|
||||
MouseDevPtr pMse;
|
||||
static kd_event eventList[NUMEVENTS];
|
||||
static int remainder = 0;
|
||||
int n, c;
|
||||
int n, c;
|
||||
kd_event *event = eventList;
|
||||
unsigned char *pBuf;
|
||||
|
||||
@@ -156,7 +156,7 @@ OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
||||
|
||||
/* Check if the device can be opened. */
|
||||
pInfo->fd = xf86OpenSerial(pInfo->options);
|
||||
pInfo->fd = xf86OpenSerial(pInfo->options);
|
||||
if (pInfo->fd == -1) {
|
||||
if (xf86GetAllowMouseOpenFail())
|
||||
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
|
||||
@@ -174,7 +174,7 @@ OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
||||
|
||||
/* Setup the local procs. */
|
||||
pInfo->read_input = OsMouseReadInput;
|
||||
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
|
||||
pInfo->flags |= XI86_CONFIGURED;
|
||||
#endif
|
||||
|
||||
222
src/mouse.c
222
src/mouse.c
@@ -293,7 +293,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
|
||||
pMse->emulate3ButtonsSoft = TRUE;
|
||||
pMse->emulate3Buttons = TRUE;
|
||||
}
|
||||
|
||||
|
||||
pMse->emulate3Timeout = xf86SetIntOption(pInfo->options,
|
||||
"Emulate3Timeout", 50);
|
||||
if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) {
|
||||
@@ -315,12 +315,12 @@ MouseCommonOptions(InputInfoPtr pInfo)
|
||||
} else
|
||||
pMse->invY = 1;
|
||||
pMse->angleOffset = xf86SetIntOption(pInfo->options, "AngleOffset", 0);
|
||||
|
||||
|
||||
|
||||
if (pMse->pDragLock)
|
||||
free(pMse->pDragLock);
|
||||
pMse->pDragLock = NULL;
|
||||
|
||||
|
||||
s = xf86SetStrOption(pInfo->options, "DragLockButtons", NULL);
|
||||
|
||||
if (s) {
|
||||
@@ -330,13 +330,13 @@ MouseCommonOptions(InputInfoPtr pInfo)
|
||||
int i, j; /* indexes */
|
||||
char *s1; /* parse input string */
|
||||
DragLockPtr pLock;
|
||||
|
||||
|
||||
pLock = pMse->pDragLock = calloc(1, sizeof(DragLockRec));
|
||||
/* init code */
|
||||
|
||||
/* initial string to be taken apart */
|
||||
s1 = s;
|
||||
|
||||
|
||||
/* keep getting numbers which are buttons */
|
||||
while ((s1 != NULL) && (lock = strtol(s1, &s1, 10)) != 0) {
|
||||
|
||||
@@ -354,14 +354,14 @@ MouseCommonOptions(InputInfoPtr pInfo)
|
||||
/*if no target, must be a master drag lock button */
|
||||
/* save master drag lock mask */
|
||||
pLock->masterLockM = lockM;
|
||||
xf86Msg(X_CONFIG,
|
||||
"DragLock button %d is master drag lock",
|
||||
xf86Msg(X_CONFIG,
|
||||
"DragLock button %d is master drag lock",
|
||||
lock);
|
||||
} else {
|
||||
/* have target button number*/
|
||||
/* check target button number for sanity */
|
||||
if ((target < 0) || (target > MSE_MAXBUTTONS)) {
|
||||
xf86Msg(X_WARNING,
|
||||
xf86Msg(X_WARNING,
|
||||
"DragLock: Invalid button number for target=%d\n",
|
||||
target);
|
||||
break;
|
||||
@@ -370,20 +370,20 @@ MouseCommonOptions(InputInfoPtr pInfo)
|
||||
/* target button mask */
|
||||
targetM = 1 << (target - 1);
|
||||
|
||||
xf86Msg(X_CONFIG,
|
||||
"DragLock: button %d is drag lock for button %d\n",
|
||||
xf86Msg(X_CONFIG,
|
||||
"DragLock: button %d is drag lock for button %d\n",
|
||||
lock,target);
|
||||
lock--;
|
||||
|
||||
/* initialize table that maps drag lock mask to target mask */
|
||||
pLock->nib_table[lock / NIB_BITS][1 << (lock % NIB_BITS)] =
|
||||
pLock->nib_table[lock / NIB_BITS][1 << (lock % NIB_BITS)] =
|
||||
targetM;
|
||||
|
||||
/* add new drag lock to mask of drag locks */
|
||||
pLock->lockButtonsM |= lockM;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fill out rest of map that maps sets of drag lock buttons
|
||||
@@ -415,7 +415,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
|
||||
* has already been calculated.
|
||||
*/
|
||||
if (otherbits)
|
||||
pLock->nib_table[i][j] =
|
||||
pLock->nib_table[i][j] =
|
||||
pLock->nib_table[i][fM] |
|
||||
pLock->nib_table[i][otherbits];
|
||||
|
||||
@@ -483,7 +483,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
|
||||
wheelButton = 4;
|
||||
}
|
||||
pMse->wheelButton = wheelButton;
|
||||
|
||||
|
||||
pMse->wheelInertia = xf86SetIntOption(pInfo->options,
|
||||
"EmulateWheelInertia", 10);
|
||||
if (pMse->wheelInertia <= 0) {
|
||||
@@ -658,8 +658,8 @@ MouseHWOptions(InputInfoPtr pInfo)
|
||||
{
|
||||
MouseDevPtr pMse = pInfo->private;
|
||||
mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
|
||||
|
||||
if (mPriv == NULL)
|
||||
|
||||
if (mPriv == NULL)
|
||||
return;
|
||||
|
||||
if ((mPriv->soft
|
||||
@@ -767,7 +767,7 @@ InitProtocols(void)
|
||||
classes = osInfo->SupportedInterfaces();
|
||||
if (!classes)
|
||||
return FALSE;
|
||||
|
||||
|
||||
/* Mark unsupported interface classes. */
|
||||
for (i = 0; mouseProtocols[i].name; i++)
|
||||
if (!(mouseProtocols[i].class & classes))
|
||||
@@ -1020,7 +1020,7 @@ MousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
|
||||
pMse->autoProbeMouse = autoProbeMouse;
|
||||
pMse->collectData = collectData;
|
||||
pMse->dataGood = autoGood;
|
||||
|
||||
|
||||
MouseHWOptions(pInfo);
|
||||
MouseSerialOptions(pInfo);
|
||||
|
||||
@@ -1239,15 +1239,15 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
* byte is also optional for MouseMan+ and FirstMouse+ in
|
||||
* their native mode. It is always sent if they are in the
|
||||
* IntelliMouse compatible mode.
|
||||
*/
|
||||
case PROT_IMSERIAL: /* IntelliMouse, NetMouse, Mie Mouse,
|
||||
*/
|
||||
case PROT_IMSERIAL: /* IntelliMouse, NetMouse, Mie Mouse,
|
||||
MouseMan+ */
|
||||
dz = (u & 0x08) ?
|
||||
(u & 0x0f) - 16 : (u & 0x0f);
|
||||
if ((dz >= 7) || (dz <= -7))
|
||||
dz = 0;
|
||||
buttons |= ((int)(u & 0x10) >> 3)
|
||||
| ((int)(u & 0x20) >> 2)
|
||||
| ((int)(u & 0x20) >> 2)
|
||||
| (pMse->lastButtons & 0x05);
|
||||
break;
|
||||
|
||||
@@ -1302,19 +1302,19 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
* use bit 0x08 in the header byte for resyncing, since that
|
||||
* bit is supposed to be always on, but nobody told Microsoft...)
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* [KAZU,OYVIND-120398]
|
||||
* The above hack is wrong! Because of b) above, we shall see
|
||||
* erroneous mouse events so often when the MouseSystem mouse is
|
||||
* moved quickly. As for the PS/2 and its variants, we don't need
|
||||
* to treat them as special cases, because protoPara[2] and
|
||||
* protoPara[3] are both 0x00 for them, thus, any data bytes will
|
||||
* never be discarded. 0x80 is rejected for MMSeries, Logitech
|
||||
* and MMHittab protocols, because protoPara[2] and protoPara[3]
|
||||
* are 0x80 and 0x00 respectively. The other protocols are 7-bit
|
||||
* protocols; there is no use checking 0x80.
|
||||
*
|
||||
* moved quickly. As for the PS/2 and its variants, we don't need
|
||||
* to treat them as special cases, because protoPara[2] and
|
||||
* protoPara[3] are both 0x00 for them, thus, any data bytes will
|
||||
* never be discarded. 0x80 is rejected for MMSeries, Logitech
|
||||
* and MMHittab protocols, because protoPara[2] and protoPara[3]
|
||||
* are 0x80 and 0x00 respectively. The other protocols are 7-bit
|
||||
* protocols; there is no use checking 0x80.
|
||||
*
|
||||
* All in all we should check the condition a) only.
|
||||
*/
|
||||
|
||||
@@ -1323,10 +1323,10 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
* Check packet for valid data:
|
||||
* If driver is in sync with datastream, the packet is considered
|
||||
* bad if any byte (header and/or data) contains an invalid value.
|
||||
*
|
||||
*
|
||||
* If packet is bad, we discard the first byte and shift the buffer.
|
||||
* Next iteration will then check the new situation for validity.
|
||||
*
|
||||
*
|
||||
* If flag MF_SAFE is set in proto[7] and the driver
|
||||
* is out of sync, the packet is also considered bad if
|
||||
* any of the data bytes contains a valid header byte value.
|
||||
@@ -1360,7 +1360,7 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
ErrorF("skipping byte %02x\n",*pBuf);
|
||||
#endif
|
||||
/* Tell auto probe that we are out of sync */
|
||||
if (pMse->autoProbeMouse && pMse->autoProbe)
|
||||
if (pMse->autoProbeMouse && pMse->autoProbe)
|
||||
pMse->autoProbeMouse(pInfo, FALSE, pMse->inSync);
|
||||
pMse->protoBufTail = --pBufP;
|
||||
for (j = 0; j < pBufP; j++)
|
||||
@@ -1369,9 +1369,9 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
continue;
|
||||
}
|
||||
/* Tell auto probe that we were successful */
|
||||
if (pMse->autoProbeMouse && pMse->autoProbe)
|
||||
if (pMse->autoProbeMouse && pMse->autoProbe)
|
||||
pMse->autoProbeMouse(pInfo, TRUE, FALSE);
|
||||
|
||||
|
||||
if (!pMse->inSync) {
|
||||
#ifdef EXTMOUSEDEBUG
|
||||
ErrorF("mouse driver back in sync\n");
|
||||
@@ -1381,7 +1381,7 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
|
||||
if (!pMse->dataGood(pMse))
|
||||
continue;
|
||||
|
||||
|
||||
/*
|
||||
* Packet complete and verified, now process it ...
|
||||
*/
|
||||
@@ -1417,7 +1417,7 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
dx = (signed char)(pBuf[1]) + (char)(pBuf[3]);
|
||||
dy = - ((signed char)(pBuf[2]) + (char)(pBuf[4]));
|
||||
break;
|
||||
|
||||
|
||||
case PROT_MMHIT: /* MM_HitTablet */
|
||||
buttons = pBuf[0] & 0x07;
|
||||
if (buttons != 0)
|
||||
@@ -1476,10 +1476,10 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
SetMouseProto(pMse, PROT_EXPPS2);
|
||||
xf86Msg(X_INFO,
|
||||
"Mouse autoprobe: Changing protocol to %s\n",
|
||||
pMse->protocol);
|
||||
|
||||
goto REDO_INTERPRET;
|
||||
} else
|
||||
pMse->protocol);
|
||||
|
||||
goto REDO_INTERPRET;
|
||||
} else
|
||||
dz = 0;
|
||||
}
|
||||
break;
|
||||
@@ -1488,7 +1488,7 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
if (pMse->autoProbe && (pBuf[3] & 0xC0)) {
|
||||
SetMouseProto(pMse, PROT_IMPS2);
|
||||
xf86Msg(X_INFO,"Mouse autoprobe: Changing protocol to %s\n",
|
||||
pMse->protocol);
|
||||
pMse->protocol);
|
||||
goto REDO_INTERPRET;
|
||||
}
|
||||
buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
|
||||
@@ -1533,7 +1533,7 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
(pBuf[2] & 0x0f);
|
||||
break;
|
||||
case 2: /* Logitech reserves this packet type */
|
||||
/*
|
||||
/*
|
||||
* IBM ScrollPoint uses this packet to encode its
|
||||
* stick movement.
|
||||
*/
|
||||
@@ -1610,7 +1610,7 @@ MouseReadInput(InputInfoPtr pInfo)
|
||||
| ((int)(pBuf[3] & 0x10) >> 3);
|
||||
dx = (signed char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
|
||||
dy = (signed char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
|
||||
dz = (pBuf[3] & 0x08) ? ((int)(pBuf[3] & 0x0F) - 0x10) :
|
||||
dz = (pBuf[3] & 0x08) ? ((int)(pBuf[3] & 0x0F) - 0x10) :
|
||||
((int)(pBuf[3] & 0x0F));
|
||||
break;
|
||||
|
||||
@@ -1637,7 +1637,7 @@ post_event:
|
||||
/* post an event */
|
||||
pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
|
||||
|
||||
/*
|
||||
/*
|
||||
* We don't reset pBufP here yet, as there may be an additional data
|
||||
* byte in some protocols. See above.
|
||||
*/
|
||||
@@ -1793,7 +1793,7 @@ MouseProc(DeviceIntPtr device, int what)
|
||||
device->public.on = TRUE;
|
||||
FlushButtons(pMse);
|
||||
break;
|
||||
|
||||
|
||||
case DEVICE_OFF:
|
||||
if (pInfo->fd != -1) {
|
||||
xf86RemoveEnabledDevice(pInfo);
|
||||
@@ -1995,7 +1995,7 @@ static char reverseMap[16] = { 0, 4, 2, 6,
|
||||
8, 12, 10, 14,
|
||||
9, 13, 11, 15 };
|
||||
|
||||
static char hitachMap[16] = { 0, 2, 1, 3,
|
||||
static char hitachMap[16] = { 0, 2, 1, 3,
|
||||
8, 10, 9, 11,
|
||||
4, 6, 5, 7,
|
||||
12, 14, 13, 15 };
|
||||
@@ -2090,7 +2090,7 @@ static void MouseWakeupHandler(pointer data,
|
||||
InputInfoPtr pInfo = (InputInfoPtr) data;
|
||||
MouseDevPtr pMse = (MouseDevPtr) pInfo->private;
|
||||
int ms;
|
||||
|
||||
|
||||
if (pMse->emulate3Pending)
|
||||
{
|
||||
ms = pMse->emulate3Expires - GetTimeInMillis ();
|
||||
@@ -2158,7 +2158,7 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
|
||||
if (buttons & wheelButtonMask) {
|
||||
/* Start timeout handling */
|
||||
pMse->wheelButtonExpires = GetTimeInMillis () + pMse->wheelButtonTimeout;
|
||||
ms = - pMse->wheelButtonTimeout;
|
||||
ms = - pMse->wheelButtonTimeout;
|
||||
} else {
|
||||
ms = pMse->wheelButtonExpires - GetTimeInMillis ();
|
||||
|
||||
@@ -2259,7 +2259,7 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
|
||||
* adjust buttons state for drag locks!
|
||||
* if there is drag locks
|
||||
*/
|
||||
if (pMse->pDragLock) {
|
||||
if (pMse->pDragLock) {
|
||||
DragLockPtr pLock;
|
||||
int tarOfGoingDown, tarOfDown;
|
||||
int realbuttons;
|
||||
@@ -2288,19 +2288,19 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
|
||||
realbuttons & pLock->lockButtonsM);
|
||||
|
||||
/*
|
||||
* when simulatedDown set and target pressed,
|
||||
* simulatedDown goes false
|
||||
* when simulatedDown set and target pressed,
|
||||
* simulatedDown goes false
|
||||
*/
|
||||
pLock->simulatedDown &= ~(realbuttons & change);
|
||||
|
||||
/*
|
||||
* if master drag lock released
|
||||
* if master drag lock released
|
||||
* then master drag lock state on
|
||||
*/
|
||||
pLock->masterTS |= (~realbuttons & change) & pLock->masterLockM;
|
||||
|
||||
/* if master state, buttons going down are simulatedDown */
|
||||
if (pLock->masterTS)
|
||||
if (pLock->masterTS)
|
||||
pLock->simulatedDown |= (realbuttons & change);
|
||||
|
||||
/* if any button pressed, no longer in master drag lock state */
|
||||
@@ -2368,7 +2368,7 @@ MousePostEvent(InputInfoPtr pInfo, int truebuttons,
|
||||
|
||||
pMse = pInfo->private;
|
||||
mousepriv = (mousePrivPtr)pMse->mousePriv;
|
||||
|
||||
|
||||
if (pMse->protocolID == PROT_MMHIT)
|
||||
b = reverseBits(hitachMap, truebuttons);
|
||||
else
|
||||
@@ -2458,7 +2458,7 @@ MousePostEvent(InputInfoPtr pInfo, int truebuttons,
|
||||
dy = tmp;
|
||||
}
|
||||
|
||||
/* Accumulate the scaled dx, dy in the private variables
|
||||
/* Accumulate the scaled dx, dy in the private variables
|
||||
fracdx,fracdy and return the integer number part */
|
||||
if (mousepriv) {
|
||||
mousepriv->fracdx += mousepriv->sensitivity*dx;
|
||||
@@ -2466,7 +2466,7 @@ MousePostEvent(InputInfoPtr pInfo, int truebuttons,
|
||||
mousepriv->fracdx -= ( dx=(int)(mousepriv->fracdx) );
|
||||
mousepriv->fracdy -= ( dy=(int)(mousepriv->fracdy) );
|
||||
}
|
||||
|
||||
|
||||
/* If mouse wheel movement has to be mapped on a button, we need to
|
||||
* loop for button press and release events. */
|
||||
do {
|
||||
@@ -2537,14 +2537,14 @@ SetupMouse(InputInfoPtr pInfo)
|
||||
Bool automatic = FALSE;
|
||||
|
||||
pMse = pInfo->private;
|
||||
|
||||
|
||||
/* Handle the "Auto" protocol. */
|
||||
if (pMse->protocolID == PROT_AUTO) {
|
||||
/*
|
||||
* We come here when user specifies protocol "auto" in
|
||||
/*
|
||||
* We come here when user specifies protocol "auto" in
|
||||
* the configuration file or thru the xf86misc extensions.
|
||||
* So we initialize autoprobing here.
|
||||
* Probe for PnP/OS mouse first. If unsuccessful
|
||||
* Probe for PnP/OS mouse first. If unsuccessful
|
||||
* try to guess protocol from incoming data.
|
||||
*/
|
||||
automatic = TRUE;
|
||||
@@ -2553,7 +2553,7 @@ SetupMouse(InputInfoPtr pInfo)
|
||||
if (name) {
|
||||
#ifdef EXTMOUSEDEBUG
|
||||
ErrorF("PnP/OS Mouse detected: %s\n",name);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2587,7 +2587,7 @@ SetupMouse(InputInfoPtr pInfo)
|
||||
* If baudrate is set write it back to the option
|
||||
* list so that the serial interface code can access
|
||||
* the new value. Not set means default.
|
||||
*/
|
||||
*/
|
||||
if (pMse->baudRate)
|
||||
xf86ReplaceIntOption(pInfo->options, "BaudRate", pMse->baudRate);
|
||||
pMse->oldProtocolID = pMse->protocolID; /* hack */
|
||||
@@ -2599,7 +2599,7 @@ SetupMouse(InputInfoPtr pInfo)
|
||||
xf86SetSerial(pInfo->fd, pInfo->options);
|
||||
|
||||
if (!initMouseHW(pInfo))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
pMse->protoBufTail = 0;
|
||||
pMse->inSync = 0;
|
||||
@@ -2665,7 +2665,7 @@ SetupMouse(InputInfoPtr pInfo)
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Bool
|
||||
initMouseHW(InputInfoPtr pInfo)
|
||||
{
|
||||
@@ -2678,10 +2678,10 @@ initMouseHW(InputInfoPtr pInfo)
|
||||
int paramlen = 0;
|
||||
int count = RETRY_COUNT;
|
||||
Bool ps2Init = TRUE;
|
||||
|
||||
|
||||
switch (pMse->protocolID) {
|
||||
case PROT_LOGI: /* Logitech Mice */
|
||||
/*
|
||||
/*
|
||||
* The baud rate selection command must be sent at the current
|
||||
* baud rate; try all likely settings.
|
||||
*/
|
||||
@@ -2838,7 +2838,7 @@ initMouseHW(InputInfoPtr pInfo)
|
||||
case PROT_PS2:
|
||||
case PROT_GLIDEPS2:
|
||||
break;
|
||||
|
||||
|
||||
case PROT_IMPS2: /* IntelliMouse */
|
||||
{
|
||||
static unsigned char seq[] = { 243, 200, 243, 100, 243, 80 };
|
||||
@@ -2851,22 +2851,22 @@ initMouseHW(InputInfoPtr pInfo)
|
||||
{
|
||||
static unsigned char seq[] = { 243, 200, 243, 100, 243, 80,
|
||||
243, 200, 243, 200, 243, 80 };
|
||||
|
||||
|
||||
param = seq;
|
||||
paramlen = sizeof(seq);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */
|
||||
case PROT_NETSCPS2: /* NetScroll */
|
||||
{
|
||||
static unsigned char seq[] = { 232, 3, 230, 230, 230, 233 };
|
||||
|
||||
|
||||
param = seq;
|
||||
paramlen = sizeof(seq);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case PROT_MMPS2: /* MouseMan+, FirstMouse+ */
|
||||
{
|
||||
static unsigned char seq[] = { 230, 232, 0, 232, 3, 232, 2, 232, 1,
|
||||
@@ -2875,7 +2875,7 @@ initMouseHW(InputInfoPtr pInfo)
|
||||
paramlen = sizeof(seq);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case PROT_THINKPS2: /* ThinkingMouse */
|
||||
{
|
||||
static unsigned char seq[] = { 243, 10, 232, 0, 243, 20, 243, 60,
|
||||
@@ -2918,13 +2918,13 @@ initMouseHW(InputInfoPtr pInfo)
|
||||
usleep(30000);
|
||||
xf86FlushInput(pInfo->fd);
|
||||
}
|
||||
|
||||
|
||||
if (osInfo->SetPS2Res) {
|
||||
osInfo->SetPS2Res(pInfo, pMse->protocol, pMse->sampleRate,
|
||||
pMse->resolution);
|
||||
} else {
|
||||
unsigned char c2[2];
|
||||
|
||||
|
||||
c = 0xE6; /*230*/ /* 1:1 scaling */
|
||||
if (!ps2SendPacket(pInfo,&c,1)) {
|
||||
if (!count--)
|
||||
@@ -3005,7 +3005,7 @@ initMouseHW(InputInfoPtr pInfo)
|
||||
|
||||
#ifdef SUPPORT_MOUSE_RESET
|
||||
static Bool
|
||||
mouseReset(InputInfoPtr pInfo, unsigned char val)
|
||||
mouseReset(InputInfoPtr pInfo, unsigned char val)
|
||||
{
|
||||
MouseDevPtr pMse = pInfo->private;
|
||||
mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv;
|
||||
@@ -3028,7 +3028,7 @@ mouseReset(InputInfoPtr pInfo, unsigned char val)
|
||||
* There are no bytes sent after the replug event package until
|
||||
* the mouse is reset.
|
||||
*/
|
||||
|
||||
|
||||
if (mousepriv->current == 0
|
||||
&& (mousepriv->lastEvent - prevEvent) < 4000)
|
||||
return FALSE;
|
||||
@@ -3046,7 +3046,7 @@ mouseReset(InputInfoPtr pInfo, unsigned char val)
|
||||
#ifdef EXTMOUSEDEBUG
|
||||
ErrorF("Mouse Current: %i 0x%x\n",mousepriv->current, val);
|
||||
#endif
|
||||
|
||||
|
||||
/* here we put the mouse specific reset detection */
|
||||
/* They need to do three things: */
|
||||
/* Check if byte may be a reset byte */
|
||||
@@ -3074,7 +3074,7 @@ mouseReset(InputInfoPtr pInfo, unsigned char val)
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!expectReset)
|
||||
mousepriv->current = 0;
|
||||
else
|
||||
@@ -3108,7 +3108,7 @@ ps2WakeupHandler(pointer data, int i, pointer LastSelectMask)
|
||||
MouseDevPtr pMse = (MouseDevPtr) pInfo->private;
|
||||
mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv;
|
||||
int ms;
|
||||
|
||||
|
||||
if (mousepriv->inReset) {
|
||||
unsigned char val;
|
||||
int blocked;
|
||||
@@ -3146,12 +3146,12 @@ ps2WakeupHandler(pointer data, int i, pointer LastSelectMask)
|
||||
#endif
|
||||
|
||||
static
|
||||
MouseProtocolID hardProtocolList[] = { PROT_MSC, PROT_MM, PROT_LOGI,
|
||||
MouseProtocolID hardProtocolList[] = { PROT_MSC, PROT_MM, PROT_LOGI,
|
||||
PROT_LOGIMAN, PROT_MMHIT,
|
||||
PROT_GLIDE, PROT_IMSERIAL,
|
||||
PROT_THINKING, PROT_ACECAD,
|
||||
PROT_THINKPS2, PROT_MMPS2,
|
||||
PROT_GLIDEPS2,
|
||||
PROT_GLIDEPS2,
|
||||
PROT_NETSCPS2, PROT_EXPPS2,PROT_IMPS2,
|
||||
PROT_GENPS2, PROT_NETPS2,
|
||||
PROT_MS,
|
||||
@@ -3159,12 +3159,12 @@ MouseProtocolID hardProtocolList[] = { PROT_MSC, PROT_MM, PROT_LOGI,
|
||||
};
|
||||
|
||||
static
|
||||
MouseProtocolID softProtocolList[] = { PROT_MSC, PROT_MM, PROT_LOGI,
|
||||
MouseProtocolID softProtocolList[] = { PROT_MSC, PROT_MM, PROT_LOGI,
|
||||
PROT_LOGIMAN, PROT_MMHIT,
|
||||
PROT_GLIDE, PROT_IMSERIAL,
|
||||
PROT_THINKING, PROT_ACECAD,
|
||||
PROT_THINKPS2, PROT_MMPS2,
|
||||
PROT_GLIDEPS2,
|
||||
PROT_GLIDEPS2,
|
||||
PROT_NETSCPS2 ,PROT_IMPS2,
|
||||
PROT_GENPS2,
|
||||
PROT_MS,
|
||||
@@ -3221,7 +3221,7 @@ autoOSProtocol(InputInfoPtr pInfo, int *protoPara)
|
||||
if (name) {
|
||||
pMse->protocolID = protocolID;
|
||||
}
|
||||
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -3238,7 +3238,7 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
|
||||
MouseProtocolID *tmplist = NULL;
|
||||
int blocked;
|
||||
|
||||
|
||||
AP_DBGC(("Autoprobe: "));
|
||||
for (i = 0; i < mPriv->count; i++)
|
||||
AP_DBGC(("%2.2x ", (unsigned char) mPriv->data[i]));
|
||||
@@ -3256,14 +3256,14 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
} else
|
||||
return;
|
||||
|
||||
for (i = 0; ((prot = protoList[i]) != PROT_UNKNOWN
|
||||
for (i = 0; ((prot = protoList[i]) != PROT_UNKNOWN
|
||||
&& (k < NUM_AUTOPROBE_PROTOS - 1)) ; i++) {
|
||||
Bool bad = TRUE;
|
||||
unsigned char byte = 0;
|
||||
int count = 0;
|
||||
int next_header_candidate = 0;
|
||||
int header_count = 0;
|
||||
|
||||
|
||||
if (!GetProtocol(prot))
|
||||
continue;
|
||||
para = proto[prot];
|
||||
@@ -3274,7 +3274,7 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
for (j = 0; j < 7; j++)
|
||||
AP_DBGC(("%2.2x ", (unsigned char) para[j]));
|
||||
AP_DBGC(("\n"));
|
||||
#endif
|
||||
#endif
|
||||
j = 0;
|
||||
while (1) {
|
||||
/* look for header */
|
||||
@@ -3285,7 +3285,7 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
count = 1;
|
||||
break;
|
||||
} else {
|
||||
/*
|
||||
/*
|
||||
* Bail out if number of bytes per package have
|
||||
* been tested for header.
|
||||
* Take bytes per package of leading garbage into
|
||||
@@ -3303,10 +3303,10 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
if (count == para[4]) {
|
||||
count = 0;
|
||||
/* check and eat excess byte */
|
||||
if (((byte & para[0]) != para[1])
|
||||
if (((byte & para[0]) != para[1])
|
||||
&& ((byte & para[5]) == para[6])) {
|
||||
AP_DBG(("excess byte found\n"));
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (count == 0) {
|
||||
@@ -3321,10 +3321,10 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* validate data */
|
||||
else if (((byte & para[2]) != para[3])
|
||||
|| ((para[7] & MPF_SAFE)
|
||||
else if (((byte & para[2]) != para[3])
|
||||
|| ((para[7] & MPF_SAFE)
|
||||
&& ((byte & para[0]) == para[1]))) {
|
||||
AP_DBG(("data bad\n"));
|
||||
bad = TRUE;
|
||||
@@ -3354,7 +3354,7 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
}
|
||||
|
||||
xf86UnblockSIGIO(blocked);
|
||||
|
||||
|
||||
mPriv->protoList[k] = PROT_UNKNOWN;
|
||||
|
||||
free(tmplist);
|
||||
@@ -3403,7 +3403,7 @@ typedef enum {
|
||||
#define BAD_INC_CERTAINTY_WHEN_SYNC_LOST 2
|
||||
|
||||
static validState
|
||||
validCount(mousePrivPtr mPriv, Bool inSync, Bool lostSync)
|
||||
validCount(mousePrivPtr mPriv, Bool inSync, Bool lostSync)
|
||||
{
|
||||
if (inSync) {
|
||||
if (!--mPriv->goodCount) {
|
||||
@@ -3420,7 +3420,7 @@ validCount(mousePrivPtr mPriv, Bool inSync, Bool lostSync)
|
||||
/* We are out of sync again */
|
||||
mPriv->goodCount = PROBE_UNCERTAINTY;
|
||||
/* We increase uncertainty of having the correct protocol */
|
||||
mPriv->badCount+= lostSync ? BAD_INC_CERTAINTY_WHEN_SYNC_LOST
|
||||
mPriv->badCount+= lostSync ? BAD_INC_CERTAINTY_WHEN_SYNC_LOST
|
||||
: BAD_INC_CERTAINTY;
|
||||
|
||||
if (mPriv->badCount < BAD_CERTAINTY) {
|
||||
@@ -3441,13 +3441,13 @@ validCount(mousePrivPtr mPriv, Bool inSync, Bool lostSync)
|
||||
mPriv->acc = 0;
|
||||
|
||||
static void
|
||||
autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync)
|
||||
autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync)
|
||||
{
|
||||
MouseDevPtr pMse = pInfo->private;
|
||||
mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
|
||||
|
||||
MouseProtocolID *protocolList = NULL;
|
||||
|
||||
|
||||
while (1) {
|
||||
switch (mPriv->autoState) {
|
||||
case AUTOPROBE_GOOD:
|
||||
@@ -3473,7 +3473,7 @@ autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync)
|
||||
AP_DBG(("State H_SETPROTO\n"));
|
||||
if ((pMse->protocolID = hardProtocolList[mPriv->protocolID++])
|
||||
== PROT_UNKNOWN) {
|
||||
mPriv->protocolID = 0;
|
||||
mPriv->protocolID = 0;
|
||||
break;
|
||||
} else if (GetProtocol(pMse->protocolID) && SetupMouse(pInfo)) {
|
||||
FlushButtons(pMse);
|
||||
@@ -3532,7 +3532,7 @@ autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync)
|
||||
mPriv->count = 0;
|
||||
mPriv->serialDefaultsNum = -1;
|
||||
mPriv->autoState = AUTOPROBE_COLLECT;
|
||||
break;
|
||||
break;
|
||||
case AUTOPROBE_COLLECT:
|
||||
AP_DBG(("State COLLECT\n"));
|
||||
if (mPriv->count <= NUM_MSE_AUTOPROBE_BYTES)
|
||||
@@ -3592,10 +3592,10 @@ autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync)
|
||||
{
|
||||
pointer serialDefaults;
|
||||
AP_DBG(("State SWITCHSERIAL\n"));
|
||||
|
||||
|
||||
if (!serialDefaultsList)
|
||||
createSerialDefaultsList();
|
||||
|
||||
|
||||
AP_DBG(("Switching serial params\n"));
|
||||
if ((serialDefaults =
|
||||
serialDefaultsList[++mPriv->serialDefaultsNum]) == NULL) {
|
||||
@@ -3616,11 +3616,11 @@ autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync)
|
||||
void *defaults;
|
||||
AP_DBG(("State SWITCH_PROTOCOL\n"));
|
||||
proto = mPriv->protoList[mPriv->protocolID++];
|
||||
if (proto == PROT_UNKNOWN)
|
||||
if (proto == PROT_UNKNOWN)
|
||||
mPriv->autoState = AUTOPROBE_SWITCHSERIAL;
|
||||
else if (!((pProto = GetProtocol(proto)) &&
|
||||
((defaults = pProto->defaults)))
|
||||
|| (mPriv->serialDefaultsNum == -1
|
||||
|| (mPriv->serialDefaultsNum == -1
|
||||
&& (defaults == msDefaults))
|
||||
|| (mPriv->serialDefaultsNum != -1
|
||||
&& serialDefaultsList[mPriv->serialDefaultsNum]
|
||||
@@ -3643,7 +3643,7 @@ static Bool
|
||||
autoGood(MouseDevPtr pMse)
|
||||
{
|
||||
mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
|
||||
|
||||
|
||||
if (!pMse->autoProbe)
|
||||
return TRUE;
|
||||
|
||||
@@ -3679,7 +3679,7 @@ checkForErraticMovements(InputInfoPtr pInfo, int dx, int dy)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
if (abs(dx - mPriv->prevDx) > 300
|
||||
if (abs(dx - mPriv->prevDx) > 300
|
||||
|| abs(dy - mPriv->prevDy) > 300)
|
||||
AP_DBG(("erratic1 behaviour\n"));
|
||||
#endif
|
||||
@@ -3689,7 +3689,7 @@ checkForErraticMovements(InputInfoPtr pInfo, int dx, int dy)
|
||||
if (abs(mPriv->accDx) > mPriv->acc) {
|
||||
mPriv->acc = abs(mPriv->accDx);
|
||||
AP_DBG(("acc=%i\n",mPriv->acc));
|
||||
}
|
||||
}
|
||||
else
|
||||
AP_DBG(("accDx=%i\n",mPriv->accDx));
|
||||
} else {
|
||||
@@ -3732,7 +3732,7 @@ SetMouseProto(MouseDevPtr pMse, MouseProtocolID protocolID)
|
||||
if ((pMse->protocolID >= 0) && (pMse->protocolID < PROT_NUMPROTOS))
|
||||
memcpy(pMse->protoPara, proto[pMse->protocolID],
|
||||
sizeof(pMse->protoPara));
|
||||
|
||||
|
||||
if (pMse->emulate3ButtonsSoft)
|
||||
pMse->emulate3Buttons = TRUE;
|
||||
}
|
||||
@@ -3748,7 +3748,7 @@ collectData(MouseDevPtr pMse, unsigned char u)
|
||||
mPriv->data[mPriv->count++] = u;
|
||||
if (mPriv->count <= NUM_MSE_AUTOPROBE_BYTES) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#endif
|
||||
|
||||
#include "mouse.h"
|
||||
#include "xf86Xinput.h"
|
||||
#include "xf86Xinput.h"
|
||||
/* Private interface for the mouse driver. */
|
||||
|
||||
typedef enum {
|
||||
@@ -63,7 +63,7 @@ typedef struct {
|
||||
int acc;
|
||||
CARD32 pnpLast;
|
||||
Bool disablePnPauto;
|
||||
float fracdx,fracdy;
|
||||
float fracdx,fracdy;
|
||||
float sensitivity;
|
||||
} mousePrivRec, *mousePrivPtr;
|
||||
|
||||
|
||||
92
src/pnp.c
92
src/pnp.c
@@ -91,11 +91,11 @@ static symtab_t pnpprod[] = {
|
||||
* EzScroll returns PNP0F04 in the compatible device field; but it
|
||||
* doesn't look compatible... XXX
|
||||
*/
|
||||
{ "PNP0F04", PROT_MSC }, /* MouseSystems */
|
||||
{ "PNP0F05", PROT_MSC }, /* MouseSystems */
|
||||
{ "PNP0F04", PROT_MSC }, /* MouseSystems */
|
||||
{ "PNP0F05", PROT_MSC }, /* MouseSystems */
|
||||
#ifdef notyet
|
||||
{ "PNP0F06", PROT_??? }, /* Genius Mouse */
|
||||
{ "PNP0F07", PROT_??? }, /* Genius Mouse */
|
||||
{ "PNP0F06", PROT_??? }, /* Genius Mouse */
|
||||
{ "PNP0F07", PROT_??? }, /* Genius Mouse */
|
||||
#endif
|
||||
{ "PNP0F08", PROT_LOGIMAN }, /* Logitech serial */
|
||||
{ "PNP0F09", PROT_MS }, /* MS BallPoint serial */
|
||||
@@ -114,7 +114,7 @@ static symtab_t pnpprod[] = {
|
||||
#ifdef notyet
|
||||
{ "PNP0F14", PROT_??? }, /* MS Kids Mouse */
|
||||
#endif
|
||||
{ "PNP0F15", PROT_BM }, /* Logitech bus */
|
||||
{ "PNP0F15", PROT_BM }, /* Logitech bus */
|
||||
#ifdef notyet
|
||||
{ "PNP0F16", PROT_??? }, /* Logitech SWIFT */
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ MouseGetSerialPnpProtocol(InputInfoPtr pInfo)
|
||||
int len;
|
||||
Bool prePNP;
|
||||
|
||||
if ((len = pnpgets(pInfo, buf, &prePNP)) > 0)
|
||||
if ((len = pnpgets(pInfo, buf, &prePNP)) > 0)
|
||||
{
|
||||
if (!prePNP) {
|
||||
if (pnpparse(pInfo, &pnpid, buf, len) &&
|
||||
@@ -181,7 +181,7 @@ MouseGetPnpProtocol(InputInfoPtr pInfo)
|
||||
mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
|
||||
MouseProtocolID val;
|
||||
CARD32 last;
|
||||
|
||||
|
||||
if ((val = MouseGetSerialPnpProtocol(pInfo)) != PROT_UNKNOWN) {
|
||||
if (val == MouseGetSerialPnpProtocol(pInfo))
|
||||
return val;
|
||||
@@ -199,9 +199,9 @@ MouseGetPnpProtocol(InputInfoPtr pInfo)
|
||||
#endif
|
||||
mPriv->disablePnPauto = TRUE;
|
||||
return PROT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef EXTMOUSEDEBUG
|
||||
if (mPriv->disablePnPauto)
|
||||
xf86ErrorF("Mouse: Enabling PnP\n");
|
||||
@@ -215,19 +215,19 @@ MouseGetPnpProtocol(InputInfoPtr pInfo)
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to elicit a PnP ID as described in
|
||||
* Microsoft, Hayes: "Plug and Play External COM Device Specification,
|
||||
* Try to elicit a PnP ID as described in
|
||||
* Microsoft, Hayes: "Plug and Play External COM Device Specification,
|
||||
* rev 1.00", 1995.
|
||||
*
|
||||
* The routine does not fully implement the COM Enumerator as per Section
|
||||
* 2.1 of the document. In particular, we don't have idle state in which
|
||||
* the driver software monitors the com port for dynamic connection or
|
||||
* removal of a device at the port, because `moused' simply quits if no
|
||||
* the driver software monitors the com port for dynamic connection or
|
||||
* removal of a device at the port, because `moused' simply quits if no
|
||||
* device is found.
|
||||
*
|
||||
* In addition, as PnP COM device enumeration procedure slightly has
|
||||
* In addition, as PnP COM device enumeration procedure slightly has
|
||||
* changed since its first publication, devices which follow earlier
|
||||
* revisions of the above spec. may fail to respond if the rev 1.0
|
||||
* revisions of the above spec. may fail to respond if the rev 1.0
|
||||
* procedure is used. XXX
|
||||
*/
|
||||
static int
|
||||
@@ -236,9 +236,9 @@ pnpgets(InputInfoPtr pInfo, char *buf, Bool *prePNP)
|
||||
int i;
|
||||
char c;
|
||||
pointer pnpOpts;
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
/*
|
||||
* This is the procedure described in rev 1.0 of PnP COM device spec.
|
||||
* Unfortunately, some devices which conform to earlier revisions of
|
||||
* the spec gets confused and do not return the ID string...
|
||||
@@ -317,11 +317,11 @@ pnpgets(InputInfoPtr pInfo, char *buf, Bool *prePNP)
|
||||
/* collect PnP COM device ID (2.1.7) */
|
||||
i = 0;
|
||||
*prePNP = FALSE;
|
||||
|
||||
|
||||
usleep(200000); /* the mouse must send `Begin ID' within 200msec */
|
||||
while (xf86ReadSerial(pInfo->fd, &c, 1) == 1) {
|
||||
/* we may see "M", or "M3..." before `Begin ID' */
|
||||
if (c == 'M')
|
||||
if (c == 'M')
|
||||
*prePNP = TRUE;
|
||||
|
||||
if ((c == 0x08) || (c == 0x28)) { /* Begin ID */
|
||||
@@ -332,7 +332,7 @@ pnpgets(InputInfoPtr pInfo, char *buf, Bool *prePNP)
|
||||
}
|
||||
if (*prePNP)
|
||||
buf[i++] = c;
|
||||
|
||||
|
||||
if (xf86WaitForInput(pInfo->fd, 200000) <= 0)
|
||||
break;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ pnpgets(InputInfoPtr pInfo, char *buf, Bool *prePNP)
|
||||
}
|
||||
if (*prePNP)
|
||||
return i;
|
||||
|
||||
|
||||
++c; /* make it `End ID' */
|
||||
for (;;) {
|
||||
if (xf86WaitForInput(pInfo->fd, 200000) <= 0)
|
||||
@@ -359,9 +359,9 @@ pnpgets(InputInfoPtr pInfo, char *buf, Bool *prePNP)
|
||||
return i;
|
||||
|
||||
/*
|
||||
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
|
||||
* in idle state. But, `moused' shall set DTR = RTS = 1 and proceed,
|
||||
* assuming there is something at the port even if it didn't
|
||||
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
|
||||
* in idle state. But, `moused' shall set DTR = RTS = 1 and proceed,
|
||||
* assuming there is something at the port even if it didn't
|
||||
* respond to the PnP enumeration procedure.
|
||||
*/
|
||||
disconnect_idle:
|
||||
@@ -450,7 +450,7 @@ pnpparse(InputInfoPtr pInfo, pnpid_t *id, char *buf, int len)
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* PnP COM spec prior to v0.96 allowed '*' in this field,
|
||||
* PnP COM spec prior to v0.96 allowed '*' in this field,
|
||||
* it's not allowed now; just ignore it.
|
||||
*/
|
||||
if (buf[j] == '*')
|
||||
@@ -483,9 +483,9 @@ pnpparse(InputInfoPtr pInfo, pnpid_t *id, char *buf, int len)
|
||||
sprintf(s, "%02X", sum & 0x0ff);
|
||||
if (strncmp(s, &buf[len - 3], 2) != 0) {
|
||||
#if 0
|
||||
/*
|
||||
/*
|
||||
* Checksum error!!
|
||||
* I found some mice do not comply with the PnP COM device
|
||||
* I found some mice do not comply with the PnP COM device
|
||||
* spec regarding checksum... XXX
|
||||
*/
|
||||
return FALSE;
|
||||
@@ -582,7 +582,7 @@ ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len)
|
||||
{
|
||||
unsigned char c;
|
||||
int i,j;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
xf86ErrorF("Ps/2 data package:");
|
||||
for (i = 0; i < len; i++)
|
||||
@@ -608,7 +608,7 @@ ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len)
|
||||
|
||||
if (c == 0xFE) /* resend */
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
if (c == 0xFC) /* error */
|
||||
return FALSE;
|
||||
@@ -623,10 +623,10 @@ ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len)
|
||||
if (j == 10)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
ps2DisableDataReporting(InputInfoPtr pInfo)
|
||||
{
|
||||
@@ -649,7 +649,7 @@ ps2GetDeviceID(InputInfoPtr pInfo)
|
||||
|
||||
usleep(30000);
|
||||
xf86FlushInput(pInfo->fd);
|
||||
if (!ps2SendPacket(pInfo, packet, sizeof(packet)))
|
||||
if (!ps2SendPacket(pInfo, packet, sizeof(packet)))
|
||||
return -1;
|
||||
while (1) {
|
||||
if (!readMouse(pInfo,&u))
|
||||
@@ -673,7 +673,7 @@ ps2Reset(InputInfoPtr pInfo)
|
||||
#ifdef DEBUG
|
||||
xf86ErrorF("PS/2 Mouse reset\n");
|
||||
#endif
|
||||
if (!ps2SendPacket(pInfo, packet, sizeof(packet)))
|
||||
if (!ps2SendPacket(pInfo, packet, sizeof(packet)))
|
||||
return FALSE;
|
||||
/* we need a little delay here */
|
||||
xf86WaitForInput(pInfo->fd, 500000);
|
||||
@@ -681,11 +681,11 @@ ps2Reset(InputInfoPtr pInfo)
|
||||
if (!readMouse(pInfo,&u)) {
|
||||
goto EXIT;
|
||||
}
|
||||
if (u != reply[i])
|
||||
if (u != reply[i])
|
||||
goto EXIT;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
|
||||
EXIT:
|
||||
xf86FlushInput(pInfo->fd);
|
||||
return FALSE;
|
||||
@@ -700,9 +700,9 @@ probePs2ProtocolPnP(InputInfoPtr pInfo)
|
||||
xf86FlushInput(pInfo->fd);
|
||||
|
||||
ps2DisableDataReporting(pInfo);
|
||||
|
||||
|
||||
if (ps2Reset(pInfo)) { /* Reset PS2 device */
|
||||
unsigned char seq[] = { 243, 200, 243, 100, 243, 80 };
|
||||
unsigned char seq[] = { 243, 200, 243, 100, 243, 80 };
|
||||
/* Try to identify Intelli Mouse */
|
||||
if (ps2SendPacket(pInfo, seq, sizeof(seq))) {
|
||||
u = ps2GetDeviceID(pInfo);
|
||||
@@ -713,21 +713,21 @@ probePs2ProtocolPnP(InputInfoPtr pInfo)
|
||||
u = ps2GetDeviceID(pInfo);
|
||||
if (u == 0x04)
|
||||
ret = PROT_EXPPS2;
|
||||
else
|
||||
else
|
||||
ret = PROT_IMPS2;
|
||||
}
|
||||
}
|
||||
} else if (ps2Reset(pInfo)) /* reset again to find sane state */
|
||||
ret = PROT_PS2;
|
||||
}
|
||||
|
||||
if (ret != PROT_UNKNOWN)
|
||||
|
||||
if (ret != PROT_UNKNOWN)
|
||||
ps2EnableDataReporting(pInfo);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct ps2protos {
|
||||
int Id;
|
||||
int Id;
|
||||
MouseProtocolID protoID;
|
||||
} ps2 [] = {
|
||||
{ 0x0, PROT_PS2 },
|
||||
@@ -750,12 +750,12 @@ getPs2ProtocolPnP(InputInfoPtr pInfo)
|
||||
while (--count)
|
||||
if (ps2DisableDataReporting(pInfo))
|
||||
break;
|
||||
|
||||
|
||||
if (!count) {
|
||||
proto = PROT_UNKNOWN;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
|
||||
if ((Id = ps2GetDeviceID(pInfo)) == -1) {
|
||||
proto = PROT_UNKNOWN;
|
||||
goto EXIT;
|
||||
@@ -773,10 +773,10 @@ getPs2ProtocolPnP(InputInfoPtr pInfo)
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proto = PROT_UNKNOWN;
|
||||
xf86Msg(X_ERROR,"Found unknown PS/2 proto ID %x\n",Id);
|
||||
|
||||
|
||||
EXIT:
|
||||
xf86FlushInput(pInfo->fd);
|
||||
return proto;
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
# include <sys/vuid_wheel.h>
|
||||
#endif
|
||||
|
||||
/* Support for scaling absolute coordinates to screen size in
|
||||
/* Support for scaling absolute coordinates to screen size in
|
||||
* Solaris 10 updates and beyond */
|
||||
#if !defined(HAVE_ABSOLUTE_MOUSE_SCALING)
|
||||
# ifdef MSIOSRESOLUTION /* Defined in msio.h if scaling support present */
|
||||
@@ -94,7 +94,7 @@ static const char *solarisMouseDevs[] = {
|
||||
};
|
||||
|
||||
typedef struct _VuidMseRec {
|
||||
struct _VuidMseRec *next;
|
||||
struct _VuidMseRec *next;
|
||||
InputInfoPtr pInfo;
|
||||
Firm_event event;
|
||||
unsigned char * buffer;
|
||||
@@ -225,11 +225,11 @@ vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
||||
|
||||
pMse->xisbscale = sizeof(Firm_event);
|
||||
|
||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
||||
pVuidMse->absres.height = pVuidMse->absres.width = 0;
|
||||
#endif
|
||||
pVuidMse->pInfo = pInfo;
|
||||
pVuidMse->next = vuidMouseList;
|
||||
pVuidMse->next = vuidMouseList;
|
||||
vuidMouseList = pVuidMse;
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
|
||||
@@ -239,27 +239,27 @@ vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
||||
}
|
||||
|
||||
static void
|
||||
vuidFlushAbsEvents(InputInfoPtr pInfo, int absX, int absY,
|
||||
vuidFlushAbsEvents(InputInfoPtr pInfo, int absX, int absY,
|
||||
Bool *absXset, Bool *absYset)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ErrorF("vuidFlushAbsEvents: %d,%d (set: %d, %d)\n", absX, absY,
|
||||
ErrorF("vuidFlushAbsEvents: %d,%d (set: %d, %d)\n", absX, absY,
|
||||
*absXset, *absYset);
|
||||
#endif
|
||||
if ((*absXset) && (*absYset)) {
|
||||
xf86PostMotionEvent(pInfo->dev,
|
||||
xf86PostMotionEvent(pInfo->dev,
|
||||
/* is_absolute: */ TRUE,
|
||||
/* first_valuator: */ 0,
|
||||
/* num_valuators: */ 2,
|
||||
absX, absY);
|
||||
} else if (*absXset) {
|
||||
xf86PostMotionEvent(pInfo->dev,
|
||||
xf86PostMotionEvent(pInfo->dev,
|
||||
/* is_absolute: */ TRUE,
|
||||
/* first_valuator: */ 0,
|
||||
/* num_valuators: */ 1,
|
||||
absX);
|
||||
} else if (*absYset) {
|
||||
xf86PostMotionEvent(pInfo->dev,
|
||||
xf86PostMotionEvent(pInfo->dev,
|
||||
/* is_absolute: */ TRUE,
|
||||
/* first_valuator: */ 1,
|
||||
/* num_valuators: */ 1,
|
||||
@@ -364,7 +364,7 @@ vuidReadInput(InputInfoPtr pInfo)
|
||||
absYset = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_VUID_WHEEL
|
||||
else if (vuid_in_range(VUID_WHEEL, pVuidMse->event.id)) {
|
||||
if (vuid_id_offset(pVuidMse->event.id) == 0)
|
||||
@@ -404,7 +404,7 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse)
|
||||
if (!pScr->currentMode)
|
||||
return;
|
||||
|
||||
if ((pVuidMse->absres.width != pScr->currentMode->HDisplay) ||
|
||||
if ((pVuidMse->absres.width != pScr->currentMode->HDisplay) ||
|
||||
(pVuidMse->absres.height != pScr->currentMode->VDisplay))
|
||||
{
|
||||
pVuidMse->absres.width = pScr->currentMode->HDisplay;
|
||||
@@ -415,14 +415,14 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse)
|
||||
} while ( (result != 0) && (errno == EINTR) );
|
||||
|
||||
if (result != 0) {
|
||||
xf86Msg(X_WARNING,
|
||||
xf86Msg(X_WARNING,
|
||||
"%s: couldn't set absolute mouse scaling resolution: %s\n",
|
||||
pInfo->name, strerror(errno));
|
||||
#ifdef DEBUG
|
||||
} else {
|
||||
xf86Msg(X_INFO,
|
||||
"%s: absolute mouse scaling resolution set to %d x %d\n",
|
||||
pInfo->name,
|
||||
xf86Msg(X_INFO,
|
||||
"%s: absolute mouse scaling resolution set to %d x %d\n",
|
||||
pInfo->name,
|
||||
pVuidMse->absres.width, pVuidMse->absres.height);
|
||||
#endif
|
||||
}
|
||||
@@ -433,7 +433,7 @@ static void vuidMouseAdjustFrame(int index, int x, int y, int flags)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[index];
|
||||
ScreenPtr pScreen = pScrn->pScreen;
|
||||
xf86AdjustFrameProc *wrappedAdjustFrame
|
||||
xf86AdjustFrameProc *wrappedAdjustFrame
|
||||
= (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen);
|
||||
VuidMsePtr m;
|
||||
ScreenPtr ptrCurScreen;
|
||||
@@ -472,7 +472,7 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
|
||||
if (pVuidMse == NULL) {
|
||||
return BadImplementation;
|
||||
}
|
||||
|
||||
|
||||
switch (what) {
|
||||
|
||||
case DEVICE_INIT:
|
||||
@@ -492,16 +492,16 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
|
||||
}
|
||||
vuidMouseGeneration = serverGeneration;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
ret = pVuidMse->wrapped_device_control(pPointer, what);
|
||||
break;
|
||||
|
||||
|
||||
case DEVICE_ON:
|
||||
ret = pVuidMse->wrapped_device_control(pPointer, DEVICE_ON);
|
||||
|
||||
if ((ret == Success) && (pInfo->fd != -1)) {
|
||||
int fmt = VUID_FIRM_EVENT;
|
||||
|
||||
|
||||
if (pVuidMse->strmod) {
|
||||
/* Check to see if module is already pushed */
|
||||
SYSCALL(i = ioctl(pInfo->fd, I_FIND, pVuidMse->strmod));
|
||||
@@ -525,9 +525,9 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
|
||||
pInfo->name, strerror(errno));
|
||||
}
|
||||
vuidMouseWheelInit(pInfo);
|
||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
||||
vuidMouseSendScreenSize(screenInfo.screens[0], pVuidMse);
|
||||
#endif
|
||||
#endif
|
||||
xf86FlushInput(pInfo->fd);
|
||||
|
||||
/* Allocate here so we don't alloc in ReadInput which may be called
|
||||
@@ -573,7 +573,7 @@ sunMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
||||
return vuidPreInit(pInfo, protocol, flags);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static const char **
|
||||
BuiltinNames(void)
|
||||
@@ -600,7 +600,7 @@ DefaultProtocol(void)
|
||||
}
|
||||
|
||||
static Bool
|
||||
solarisMouseAutoProbe(InputInfoPtr pInfo, const char **protocol,
|
||||
solarisMouseAutoProbe(InputInfoPtr pInfo, const char **protocol,
|
||||
const char **device)
|
||||
{
|
||||
const char **pdev, **pproto;
|
||||
|
||||
Reference in New Issue
Block a user