wacom_wac.h 9.3 KB
Newer Older
1
/*
2
 * drivers/input/tablet/wacom_wac.h
3 4 5 6 7 8 9 10 11
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */
#ifndef WACOM_WAC_H
#define WACOM_WAC_H

12
#include <linux/types.h>
13
#include <linux/hid.h>
14

15 16
/* maximum packet length for USB/BT devices */
#define WACOM_PKGLEN_MAX	361
17

18
#define WACOM_NAME_MAX		64
19 20
#define WACOM_MAX_REMOTES	5
#define WACOM_STATUS_UNKNOWN	255
21

22
/* packet length for individual models */
23
#define WACOM_PKGLEN_BBFUN	 9
24
#define WACOM_PKGLEN_TPC1FG	 5
25
#define WACOM_PKGLEN_TPC1FG_B	10
26
#define WACOM_PKGLEN_TPC2FG	14
27
#define WACOM_PKGLEN_BBTOUCH	20
28
#define WACOM_PKGLEN_BBTOUCH3	64
29
#define WACOM_PKGLEN_BBPEN	10
30
#define WACOM_PKGLEN_WIRELESS	32
31
#define WACOM_PKGLEN_PENABLED	 8
32 33
#define WACOM_PKGLEN_BPAD_TOUCH	32
#define WACOM_PKGLEN_BPAD_TOUCH_USB	64
34 35 36

/* wacom data size per MT contact */
#define WACOM_BYTES_PER_MT_PACKET	11
37
#define WACOM_BYTES_PER_24HDT_PACKET	14
38
#define WACOM_BYTES_PER_QHDTHID_PACKET	 6
39

40
/* device IDs */
41
#define STYLUS_DEVICE_ID	0x02
42
#define TOUCH_DEVICE_ID		0x03
43 44
#define CURSOR_DEVICE_ID	0x06
#define ERASER_DEVICE_ID	0x0A
P
Ping Cheng 已提交
45
#define PAD_DEVICE_ID		0x0F
46

47 48
/* wacom data packet report IDs */
#define WACOM_REPORT_PENABLED		2
49
#define WACOM_REPORT_PENABLED_BT	3
50 51
#define WACOM_REPORT_INTUOS_ID1		5
#define WACOM_REPORT_INTUOS_ID2		6
52
#define WACOM_REPORT_INTUOSPAD		12
53
#define WACOM_REPORT_INTUOS5PAD		3
54
#define WACOM_REPORT_DTUSPAD		21
55 56
#define WACOM_REPORT_TPC1FG		6
#define WACOM_REPORT_TPC2FG		13
57
#define WACOM_REPORT_TPCMT		13
58
#define WACOM_REPORT_TPCMT2		3
59
#define WACOM_REPORT_TPCHID		15
60 61
#define WACOM_REPORT_CINTIQ		16
#define WACOM_REPORT_CINTIQPAD		17
62
#define WACOM_REPORT_TPCST		16
63
#define WACOM_REPORT_DTUS		17
64
#define WACOM_REPORT_TPC1FGE		18
65
#define WACOM_REPORT_24HDT		1
66
#define WACOM_REPORT_WL			128
67
#define WACOM_REPORT_USB		192
68 69
#define WACOM_REPORT_BPAD_PEN		3
#define WACOM_REPORT_BPAD_TOUCH		16
70
#define WACOM_REPORT_DEVICE_LIST	16
71
#define WACOM_REPORT_INTUOS_PEN		16
72
#define WACOM_REPORT_REMOTE		17
73
#define WACOM_REPORT_INTUOSHT2_ID	8
74

75 76 77 78 79 80 81 82
/* wacom command report ids */
#define WAC_CMD_WL_LED_CONTROL          0x03
#define WAC_CMD_LED_CONTROL             0x20
#define WAC_CMD_ICON_START              0x21
#define WAC_CMD_ICON_XFER               0x23
#define WAC_CMD_ICON_BT_XFER            0x26
#define WAC_CMD_DELETE_PAIRING          0x20
#define WAC_CMD_UNPAIR_ALL              0xFF
83
#define WAC_CMD_WL_INTUOSP2             0x82
84

85
/* device quirks */
86
#define WACOM_QUIRK_BBTOUCH_LOWRES	0x0001
87
#define WACOM_QUIRK_SENSE		0x0002
88
#define WACOM_QUIRK_BATTERY		0x0008
89

90 91 92 93
/* device types */
#define WACOM_DEVICETYPE_NONE           0x0000
#define WACOM_DEVICETYPE_PEN            0x0001
#define WACOM_DEVICETYPE_TOUCH          0x0002
94
#define WACOM_DEVICETYPE_PAD            0x0004
95
#define WACOM_DEVICETYPE_WL_MONITOR     0x0008
96
#define WACOM_DEVICETYPE_DIRECT         0x0010
97

98
#define WACOM_HID_UP_WACOMDIGITIZER     0xff0d0000
99 100
#define WACOM_HID_SP_PAD                0x00040000
#define WACOM_HID_SP_BUTTON             0x00090000
101 102
#define WACOM_HID_SP_DIGITIZER          0x000d0000
#define WACOM_HID_SP_DIGITIZERINFO      0x00100000
103
#define WACOM_HID_WD_DIGITIZER          (WACOM_HID_UP_WACOMDIGITIZER | 0x01)
104
#define WACOM_HID_WD_SENSE              (WACOM_HID_UP_WACOMDIGITIZER | 0x36)
105
#define WACOM_HID_WD_DIGITIZERFNKEYS    (WACOM_HID_UP_WACOMDIGITIZER | 0x39)
106 107
#define WACOM_HID_WD_SERIALHI           (WACOM_HID_UP_WACOMDIGITIZER | 0x5c)
#define WACOM_HID_WD_TOOLTYPE           (WACOM_HID_UP_WACOMDIGITIZER | 0x77)
108
#define WACOM_HID_WD_DISTANCE           (WACOM_HID_UP_WACOMDIGITIZER | 0x0132)
109 110
#define WACOM_HID_WD_TOUCHSTRIP         (WACOM_HID_UP_WACOMDIGITIZER | 0x0136)
#define WACOM_HID_WD_TOUCHSTRIP2        (WACOM_HID_UP_WACOMDIGITIZER | 0x0137)
111 112 113 114 115
#define WACOM_HID_WD_TOUCHRING          (WACOM_HID_UP_WACOMDIGITIZER | 0x0138)
#define WACOM_HID_WD_TOUCHRINGSTATUS    (WACOM_HID_UP_WACOMDIGITIZER | 0x0139)
#define WACOM_HID_WD_ACCELEROMETER_X    (WACOM_HID_UP_WACOMDIGITIZER | 0x0401)
#define WACOM_HID_WD_ACCELEROMETER_Y    (WACOM_HID_UP_WACOMDIGITIZER | 0x0402)
#define WACOM_HID_WD_ACCELEROMETER_Z    (WACOM_HID_UP_WACOMDIGITIZER | 0x0403)
116 117
#define WACOM_HID_WD_BATTERY_CHARGING   (WACOM_HID_UP_WACOMDIGITIZER | 0x0404)
#define WACOM_HID_WD_BATTERY_LEVEL      (WACOM_HID_UP_WACOMDIGITIZER | 0x043b)
118
#define WACOM_HID_WD_EXPRESSKEY00       (WACOM_HID_UP_WACOMDIGITIZER | 0x0910)
119
#define WACOM_HID_WD_EXPRESSKEYCAP00    (WACOM_HID_UP_WACOMDIGITIZER | 0x0950)
120 121 122 123 124
#define WACOM_HID_WD_BUTTONHOME         (WACOM_HID_UP_WACOMDIGITIZER | 0x0990)
#define WACOM_HID_WD_BUTTONUP           (WACOM_HID_UP_WACOMDIGITIZER | 0x0991)
#define WACOM_HID_WD_BUTTONDOWN         (WACOM_HID_UP_WACOMDIGITIZER | 0x0992)
#define WACOM_HID_WD_BUTTONLEFT         (WACOM_HID_UP_WACOMDIGITIZER | 0x0993)
#define WACOM_HID_WD_BUTTONRIGHT        (WACOM_HID_UP_WACOMDIGITIZER | 0x0994)
125 126
#define WACOM_HID_WD_BUTTONCENTER       (WACOM_HID_UP_WACOMDIGITIZER | 0x0995)
#define WACOM_HID_WD_TOUCHONOFF         (WACOM_HID_UP_WACOMDIGITIZER | 0x0996)
127
#define WACOM_HID_WD_FINGERWHEEL        (WACOM_HID_UP_WACOMDIGITIZER | 0x0d03)
128 129 130 131
#define WACOM_HID_WD_OFFSETLEFT         (WACOM_HID_UP_WACOMDIGITIZER | 0x0d30)
#define WACOM_HID_WD_OFFSETTOP          (WACOM_HID_UP_WACOMDIGITIZER | 0x0d31)
#define WACOM_HID_WD_OFFSETRIGHT        (WACOM_HID_UP_WACOMDIGITIZER | 0x0d32)
#define WACOM_HID_WD_OFFSETBOTTOM       (WACOM_HID_UP_WACOMDIGITIZER | 0x0d33)
132
#define WACOM_HID_WD_DATAMODE           (WACOM_HID_UP_WACOMDIGITIZER | 0x1002)
133
#define WACOM_HID_WD_DIGITIZERINFO      (WACOM_HID_UP_WACOMDIGITIZER | 0x1013)
134 135 136 137 138 139
#define WACOM_HID_UP_G9                 0xff090000
#define WACOM_HID_G9_PEN                (WACOM_HID_UP_G9 | 0x02)
#define WACOM_HID_G9_TOUCHSCREEN        (WACOM_HID_UP_G9 | 0x11)
#define WACOM_HID_UP_G11                0xff110000
#define WACOM_HID_G11_PEN               (WACOM_HID_UP_G11 | 0x02)
#define WACOM_HID_G11_TOUCHSCREEN       (WACOM_HID_UP_G11 | 0x11)
140

141 142 143 144
#define WACOM_PAD_FIELD(f)	(((f)->physical == HID_DG_TABLETFUNCTIONKEY) || \
				 ((f)->physical == WACOM_HID_WD_DIGITIZERFNKEYS) || \
				 ((f)->physical == WACOM_HID_WD_DIGITIZERINFO))

145 146
#define WACOM_PEN_FIELD(f)	(((f)->logical == HID_DG_STYLUS) || \
				 ((f)->physical == HID_DG_STYLUS) || \
147
				 ((f)->physical == HID_DG_PEN) || \
148 149
				 ((f)->application == HID_DG_PEN) || \
				 ((f)->application == HID_DG_DIGITIZER) || \
150 151 152
				 ((f)->application == WACOM_HID_WD_DIGITIZER) || \
				 ((f)->application == WACOM_HID_G9_PEN) || \
				 ((f)->application == WACOM_HID_G11_PEN))
153 154
#define WACOM_FINGER_FIELD(f)	(((f)->logical == HID_DG_FINGER) || \
				 ((f)->physical == HID_DG_FINGER) || \
155 156 157
				 ((f)->application == HID_DG_TOUCHSCREEN) || \
				 ((f)->application == WACOM_HID_G9_TOUCHSCREEN) || \
				 ((f)->application == WACOM_HID_G11_TOUCHSCREEN))
158

159 160 161
enum {
	PENPARTNER = 0,
	GRAPHIRE,
162
	GRAPHIRE_BT,
163 164 165
	WACOM_G4,
	PTU,
	PL,
166
	DTU,
167
	DTUS,
P
Ping Cheng 已提交
168
	DTUSX,
169
	INTUOS,
P
Ping Cheng 已提交
170
	INTUOS3S,
171 172
	INTUOS3,
	INTUOS3L,
173 174
	INTUOS4S,
	INTUOS4,
175
	INTUOS4WL,
176
	INTUOS4L,
177 178 179
	INTUOS5S,
	INTUOS5,
	INTUOS5L,
180 181 182
	INTUOSPS,
	INTUOSPM,
	INTUOSPL,
183
	INTUOSP2_BT,
184
	WACOM_21UX2,
185
	WACOM_22HD,
186
	DTK,
187
	WACOM_24HD,
188
	WACOM_27QHD,
189
	CINTIQ_HYBRID,
190
	CINTIQ_COMPANION_2,
191
	CINTIQ,
192
	WACOM_BEE,
193
	WACOM_13HD,
194
	WACOM_MO,
195 196
	BAMBOO_PEN,
	INTUOSHT,
197
	INTUOSHT2,
198
	BAMBOO_TOUCH,
P
Ping Cheng 已提交
199
	BAMBOO_PT,
200
	WACOM_24HDT,
201
	WACOM_27QHDT,
202
	BAMBOO_PAD,
203
	WIRELESS,
204
	REMOTE,
P
Ping Cheng 已提交
205
	TABLETPC,   /* add new TPC below */
206
	TABLETPCE,
207
	TABLETPC2FG,
208
	MTSCREEN,
209
	MTTPC,
210
	MTTPC_B,
211
	HID_GENERIC,
212 213 214 215
	MAX_TYPE
};

struct wacom_features {
216
	const char *name;
217 218 219 220 221
	int x_max;
	int y_max;
	int pressure_max;
	int distance_max;
	int type;
222 223
	int x_resolution;
	int y_resolution;
224
	int numbered_buttons;
225 226 227 228
	int offset_left;
	int offset_right;
	int offset_top;
	int offset_bottom;
229 230 231
	int device_type;
	int x_phy;
	int y_phy;
232 233
	unsigned unit;
	int unitExpo;
234 235 236 237
	int x_fuzz;
	int y_fuzz;
	int pressure_fuzz;
	int distance_fuzz;
238
	int tilt_fuzz;
239
	unsigned quirks;
240
	unsigned touch_max;
241 242
	int oVid;
	int oPid;
243
	int pktlen;
244 245
	bool check_for_hid_type;
	int hid_type;
246
	bool input_event_flag;
247 248
};

249 250
struct wacom_shared {
	bool stylus_in_proximity;
251
	bool touch_down;
252 253 254 255
	/* for wireless device to access USB interfaces */
	unsigned touch_max;
	int type;
	struct input_dev *touch_input;
256 257
	struct hid_device *pen;
	struct hid_device *touch;
258 259
};

260
struct hid_data {
261 262
	__s16 inputmode;	/* InputMode HID feature, -1 if non-existent */
	__s16 inputmode_index;	/* InputMode HID feature index in the report */
263
	bool sense_state;
264 265 266
	bool inrange_state;
	bool invert_state;
	bool tipswitch;
267 268 269 270 271 272
	int x;
	int y;
	int pressure;
	int width;
	int height;
	int id;
273
	int cc_report;
274 275
	int cc_index;
	int cc_value_index;
276
	int last_slot_field;
277 278
	int num_expected;
	int num_received;
279 280 281 282
	int battery_capacity;
	int bat_charging;
	int bat_connected;
	int ps_connected;
283 284
};

285 286 287 288 289 290 291
struct wacom_remote_data {
	struct {
		u32 serial;
		bool connected;
	} remote[WACOM_MAX_REMOTES];
};

292
struct wacom_wac {
293
	char name[WACOM_NAME_MAX];
294 295
	char pen_name[WACOM_NAME_MAX];
	char touch_name[WACOM_NAME_MAX];
296
	char pad_name[WACOM_NAME_MAX];
297
	unsigned char data[WACOM_PKGLEN_MAX];
298 299
	int tool[2];
	int id[2];
300
	__u64 serial[2];
301
	bool reporting_data;
302
	struct wacom_features features;
303
	struct wacom_shared *shared;
304 305
	struct input_dev *pen_input;
	struct input_dev *touch_input;
306
	struct input_dev *pad_input;
307
	int pid;
308
	int num_contacts_left;
309 310
	u8 bt_features;
	u8 bt_high_speed;
311 312
	int mode_report;
	int mode_value;
313
	struct hid_data hid_data;
314 315 316
};

#endif