1659607e0Smrg/*
2659607e0Smrg * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
3659607e0Smrg */
4659607e0Smrg
5659607e0Smrg#ifndef _X_MOUSEPRIV_H
6659607e0Smrg#define _X_MOUSEPRIV_H
7659607e0Smrg
8659607e0Smrg#if 0
9659607e0Smrg# define MOUSEINITDEBUG
10659607e0Smrg# define MOUSEDATADEBUG
11659607e0Smrg#endif
12659607e0Smrg
13659607e0Smrg#include "mouse.h"
14a73597f9Smrg#include "xf86Xinput.h"
15659607e0Smrg/* Private interface for the mouse driver. */
16659607e0Smrg
17659607e0Smrgtypedef enum  {
18659607e0Smrg    AUTOPROBE_H_NOPROTO,
19659607e0Smrg    AUTOPROBE_H_GOOD,
20659607e0Smrg    AUTOPROBE_H_AUTODETECT,
21659607e0Smrg    AUTOPROBE_H_VALIDATE1,
22659607e0Smrg    AUTOPROBE_H_VALIDATE2,
23659607e0Smrg    AUTOPROBE_H_SETPROTO,
24659607e0Smrg    AUTOPROBE_NOPROTO,
25659607e0Smrg    AUTOPROBE_COLLECT,
26659607e0Smrg    AUTOPROBE_CREATE_PROTOLIST,
27659607e0Smrg    AUTOPROBE_GOOD,
28659607e0Smrg    AUTOPROBE_AUTODETECT,
29659607e0Smrg    AUTOPROBE_VALIDATE1,
30659607e0Smrg    AUTOPROBE_VALIDATE2,
31659607e0Smrg    AUTOPROBE_SWITCHSERIAL,
32659607e0Smrg    AUTOPROBE_SWITCH_PROTOCOL
33659607e0Smrg} mseAutoProbeStates;
34659607e0Smrg
35659607e0Smrgtypedef struct {
36a73597f9Smrg    const char *        name;
37a73597f9Smrg    int                 class;
38a73597f9Smrg    const char **       defaults;
39a73597f9Smrg    MouseProtocolID     id;
40659607e0Smrg} MouseProtocolRec, *MouseProtocolPtr;
41659607e0Smrg
42659607e0Smrg#define NUM_MSE_AUTOPROBE_BYTES 24  /* multiple of 3,4 and 6 byte packages */
43659607e0Smrg#define NUM_MSE_AUTOPROBE_TOTAL 64
44659607e0Smrg#define NUM_AUTOPROBE_PROTOS 17
45659607e0Smrg
46659607e0Smrg
47659607e0Smrgtypedef struct {
48a73597f9Smrg    int         current;
49a73597f9Smrg    Bool        inReset;
50a73597f9Smrg    CARD32      lastEvent;
51a73597f9Smrg    CARD32      expires;
52a73597f9Smrg    Bool        soft;
53a73597f9Smrg    int         goodCount;
54a73597f9Smrg    int         badCount;
55a73597f9Smrg    int         protocolID;
56a73597f9Smrg    int         count;
57a73597f9Smrg    char        data[NUM_MSE_AUTOPROBE_TOTAL];
58659607e0Smrg    mseAutoProbeStates autoState;
59659607e0Smrg    MouseProtocolID protoList[NUM_AUTOPROBE_PROTOS];
60a73597f9Smrg    int         serialDefaultsNum;
61a73597f9Smrg    int         prevDx, prevDy;
62a73597f9Smrg    int         accDx, accDy;
63a73597f9Smrg    int         acc;
64a73597f9Smrg    CARD32      pnpLast;
65a73597f9Smrg    Bool        disablePnPauto;
66a73597f9Smrg    float       fracdx,fracdy;
67a73597f9Smrg    float       sensitivity;
68659607e0Smrg} mousePrivRec, *mousePrivPtr;
69659607e0Smrg
70659607e0Smrg/* mouse proto flags */
71a73597f9Smrg#define MPF_NONE                0x00
72a73597f9Smrg#define MPF_SAFE                0x01
73659607e0Smrg
74659607e0Smrg/* pnp.c */
75659607e0SmrgMouseProtocolID MouseGetPnpProtocol(InputInfoPtr pInfo);
76659607e0SmrgBool ps2Reset(InputInfoPtr pInfo);
77659607e0SmrgBool ps2EnableDataReporting(InputInfoPtr pInfo);
78659607e0SmrgBool ps2SendPacket(InputInfoPtr pInfo, unsigned char *bytes, int len);
79659607e0Smrgint ps2GetDeviceID(InputInfoPtr pInfo);
80659607e0Smrg
81659607e0Smrg#endif /* _X_MOUSE_H */
82