1/*
2 * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
3 */
4
5#ifndef _X_MOUSEPRIV_H
6#define _X_MOUSEPRIV_H
7
8#if 0
9# define MOUSEINITDEBUG
10# define MOUSEDATADEBUG
11#endif
12
13#include "mouse.h"
14#include "xf86Xinput.h"
15/* Private interface for the mouse driver. */
16
17typedef enum  {
18    AUTOPROBE_H_NOPROTO,
19    AUTOPROBE_H_GOOD,
20    AUTOPROBE_H_AUTODETECT,
21    AUTOPROBE_H_VALIDATE1,
22    AUTOPROBE_H_VALIDATE2,
23    AUTOPROBE_H_SETPROTO,
24    AUTOPROBE_NOPROTO,
25    AUTOPROBE_COLLECT,
26    AUTOPROBE_CREATE_PROTOLIST,
27    AUTOPROBE_GOOD,
28    AUTOPROBE_AUTODETECT,
29    AUTOPROBE_VALIDATE1,
30    AUTOPROBE_VALIDATE2,
31    AUTOPROBE_SWITCHSERIAL,
32    AUTOPROBE_SWITCH_PROTOCOL
33} mseAutoProbeStates;
34
35typedef struct {
36    const char *        name;
37    int                 class;
38    const char **       defaults;
39    MouseProtocolID     id;
40} MouseProtocolRec, *MouseProtocolPtr;
41
42#define NUM_MSE_AUTOPROBE_BYTES 24  /* multiple of 3,4 and 6 byte packages */
43#define NUM_MSE_AUTOPROBE_TOTAL 64
44#define NUM_AUTOPROBE_PROTOS 17
45
46
47typedef struct {
48    int         current;
49    Bool        inReset;
50    CARD32      lastEvent;
51    CARD32      expires;
52    Bool        soft;
53    int         goodCount;
54    int         badCount;
55    int         protocolID;
56    int         count;
57    char        data[NUM_MSE_AUTOPROBE_TOTAL];
58    mseAutoProbeStates autoState;
59    MouseProtocolID protoList[NUM_AUTOPROBE_PROTOS];
60    int         serialDefaultsNum;
61    int         prevDx, prevDy;
62    int         accDx, accDy;
63    int         acc;
64    CARD32      pnpLast;
65    Bool        disablePnPauto;
66    float       fracdx,fracdy;
67    float       sensitivity;
68} mousePrivRec, *mousePrivPtr;
69
70/* mouse proto flags */
71#define MPF_NONE                0x00
72#define MPF_SAFE                0x01
73
74/* pnp.c */
75MouseProtocolID MouseGetPnpProtocol(InputInfoPtr pInfo);
76Bool ps2Reset(InputInfoPtr pInfo);
77Bool ps2EnableDataReporting(InputInfoPtr pInfo);
78Bool ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len);
79int ps2GetDeviceID(InputInfoPtr pInfo);
80
81#endif /* _X_MOUSE_H */
82