1 /*
2  * Copyright 2002 Red Hat Inc., Durham, North Carolina.
3  *
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation on the rights to use, copy, modify, merge,
10  * publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial
16  * portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  */
27 
28 /*
29  * Authors:
30  *   Rickard E. (Rik) Faith <faith@redhat.com>
31  *
32  */
33 
34 /** \file
35  * Private header file for USB support.  This file provides
36  * Linux-specific include files and the definition of the private
37  * structure.  \see usb-common.c \see usb-keyboard.c \see usb-mouse.c
38  * \see usb-other.c */
39 
40 #ifndef _USB_PRIVATE_H_
41 #define _USB_PRIVATE_H_
42 
43 #include "dmxinputinit.h"
44 #include "inputstr.h"
45 #include <X11/Xos.h>
46 #include <errno.h>
47 #include <linux/input.h>
48 #include "usb-common.h"
49 
50                                 /*  Support for force feedback was
51                                  *  introduced in Linxu 2.4.10 */
52 #ifndef EV_MSC
53 #define EV_MSC      0x04
54 #endif
55 #ifndef EV_FF
56 #define EV_FF       0x15
57 #endif
58 #ifndef LED_SLEEP
59 #define LED_SLEEP   0x05
60 #endif
61 #ifndef LED_SUSPEND
62 #define LED_SUSPEND 0x06
63 #endif
64 #ifndef LED_MUTE
65 #define LED_MUTE    0x07
66 #endif
67 #ifndef LED_MISC
68 #define LED_MISC    0x08
69 #endif
70 #ifndef BTN_DEAD
71 #define BTN_DEAD    0x12f
72 #endif
73 #ifndef BTN_THUMBL
74 #define BTN_THUMBL  0x13d
75 #endif
76 #ifndef BTN_THUMBR
77 #define BTN_THUMBR  0x13e
78 #endif
79 #ifndef MSC_SERIAL
80 #define MSC_SERIAL  0x00
81 #endif
82 #ifndef MSC_MAX
83 #define MSC_MAX     0x07
84 #endif
85 
86                                 /* Support for older kernels. */
87 #ifndef ABS_WHEEL
88 #define ABS_WHEEL   0x08
89 #endif
90 #ifndef ABS_GAS
91 #define ABS_GAS     0x09
92 #endif
93 #ifndef ABS_BRAKE
94 #define ABS_BRAKE   0x0a
95 #endif
96 
97 #define NUM_STATE_ENTRIES (256/32)
98 
99 /* Private area for USB devices. */
100 typedef struct _myPrivate {
101     DeviceIntPtr pDevice;                   /**< Device (mouse or other) */
102     int fd;                                 /**< File descriptor */
103     unsigned char mask[EV_MAX / 8 + 1];     /**< Mask */
104     int numRel, numAbs, numLeds;            /**< Counts */
105     int relmap[REL_CNT];                    /**< Relative axis map */
106     int absmap[ABS_CNT];                    /**< Absolute axis map */
107 
108     CARD32 kbdState[NUM_STATE_ENTRIES];         /**< Keyboard state */
109     DeviceIntPtr pKeyboard;                     /** Keyboard device */
110 
111     int pitch;                  /**< Bell pitch  */
112     unsigned long duration;     /**< Bell duration */
113 
114     /* FIXME: dmxInput is never initialized */
115     DMXInputInfo *dmxInput;     /**< For pretty-printing */
116 } myPrivate;
117 #endif
118