]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/hid/wacom_wac.h
HID: wacom: Fix pad button range for CINTIQ_COMPANION_2
[mirror_ubuntu-artful-kernel.git] / drivers / hid / wacom_wac.h
CommitLineData
3bea733a 1/*
4104d13f 2 * drivers/input/tablet/wacom_wac.h
3bea733a
PC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9#ifndef WACOM_WAC_H
10#define WACOM_WAC_H
11
51269fe8 12#include <linux/types.h>
d97a5522 13#include <linux/hid.h>
51269fe8 14
ee54500d 15/* maximum packet length for USB devices */
500d4160 16#define WACOM_PKGLEN_MAX 192
ee54500d 17
57bcfce3 18#define WACOM_NAME_MAX 64
72b236d6
AS
19#define WACOM_MAX_REMOTES 5
20#define WACOM_STATUS_UNKNOWN 255
57bcfce3 21
ee54500d 22/* packet length for individual models */
e33da8a5 23#define WACOM_PKGLEN_BBFUN 9
ee54500d 24#define WACOM_PKGLEN_TPC1FG 5
61616ed0 25#define WACOM_PKGLEN_TPC1FG_B 10
e33da8a5 26#define WACOM_PKGLEN_TPC2FG 14
4a88081e 27#define WACOM_PKGLEN_BBTOUCH 20
4134361a 28#define WACOM_PKGLEN_BBTOUCH3 64
73149ab8 29#define WACOM_PKGLEN_BBPEN 10
d3825d51 30#define WACOM_PKGLEN_WIRELESS 32
d51ddb2b 31#define WACOM_PKGLEN_PENABLED 8
8c97a765
BT
32#define WACOM_PKGLEN_BPAD_TOUCH 32
33#define WACOM_PKGLEN_BPAD_TOUCH_USB 64
1963518b
PC
34
35/* wacom data size per MT contact */
36#define WACOM_BYTES_PER_MT_PACKET 11
b1e4279e 37#define WACOM_BYTES_PER_24HDT_PACKET 14
500d4160 38#define WACOM_BYTES_PER_QHDTHID_PACKET 6
ee54500d 39
ec67bbed 40/* device IDs */
3bea733a 41#define STYLUS_DEVICE_ID 0x02
545f4e99 42#define TOUCH_DEVICE_ID 0x03
3bea733a
PC
43#define CURSOR_DEVICE_ID 0x06
44#define ERASER_DEVICE_ID 0x0A
80d4e8e9 45#define PAD_DEVICE_ID 0x0F
3bea733a 46
cad74700
PC
47/* wacom data packet report IDs */
48#define WACOM_REPORT_PENABLED 2
387142bb 49#define WACOM_REPORT_PENABLED_BT 3
06109993
JG
50#define WACOM_REPORT_INTUOS_ID1 5
51#define WACOM_REPORT_INTUOS_ID2 6
cad74700 52#define WACOM_REPORT_INTUOSPAD 12
f860e581 53#define WACOM_REPORT_INTUOS5PAD 3
497ab1f2 54#define WACOM_REPORT_DTUSPAD 21
cad74700
PC
55#define WACOM_REPORT_TPC1FG 6
56#define WACOM_REPORT_TPC2FG 13
1963518b 57#define WACOM_REPORT_TPCMT 13
d51ddb2b 58#define WACOM_REPORT_TPCMT2 3
31175a83 59#define WACOM_REPORT_TPCHID 15
500d4160
PC
60#define WACOM_REPORT_CINTIQ 16
61#define WACOM_REPORT_CINTIQPAD 17
31175a83 62#define WACOM_REPORT_TPCST 16
497ab1f2 63#define WACOM_REPORT_DTUS 17
ac173837 64#define WACOM_REPORT_TPC1FGE 18
b1e4279e 65#define WACOM_REPORT_24HDT 1
b5fd2a3e 66#define WACOM_REPORT_WL 128
961794a0 67#define WACOM_REPORT_USB 192
8c97a765
BT
68#define WACOM_REPORT_BPAD_PEN 3
69#define WACOM_REPORT_BPAD_TOUCH 16
72b236d6 70#define WACOM_REPORT_DEVICE_LIST 16
eda01dab 71#define WACOM_REPORT_INTUOS_PEN 16
72b236d6 72#define WACOM_REPORT_REMOTE 17
cad74700 73
bc73dd39 74/* device quirks */
f3586d2f 75#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0001
f3586d2f 76#define WACOM_QUIRK_BATTERY 0x0008
bc73dd39 77
aa86b18c
JG
78/* device types */
79#define WACOM_DEVICETYPE_NONE 0x0000
80#define WACOM_DEVICETYPE_PEN 0x0001
81#define WACOM_DEVICETYPE_TOUCH 0x0002
862cf553 82#define WACOM_DEVICETYPE_PAD 0x0004
ccad85cc 83#define WACOM_DEVICETYPE_WL_MONITOR 0x0008
aa86b18c 84
042628ab
JG
85#define WACOM_VENDORDEFINED_PEN 0xff0d0001
86
d97a5522
BT
87#define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \
88 ((f)->physical == HID_DG_STYLUS) || \
61e9e7e4 89 ((f)->physical == HID_DG_PEN) || \
042628ab
JG
90 ((f)->application == HID_DG_PEN) || \
91 ((f)->application == HID_DG_DIGITIZER) || \
92 ((f)->application == WACOM_VENDORDEFINED_PEN))
d97a5522
BT
93#define WACOM_FINGER_FIELD(f) (((f)->logical == HID_DG_FINGER) || \
94 ((f)->physical == HID_DG_FINGER) || \
95 ((f)->application == HID_DG_TOUCHSCREEN))
96
3bea733a
PC
97enum {
98 PENPARTNER = 0,
99 GRAPHIRE,
387142bb 100 GRAPHIRE_BT,
3bea733a
PC
101 WACOM_G4,
102 PTU,
103 PL,
c8f2edc5 104 DTU,
497ab1f2 105 DTUS,
fff00bf8 106 DTUSX,
3bea733a 107 INTUOS,
8d32e3ae 108 INTUOS3S,
3bea733a
PC
109 INTUOS3,
110 INTUOS3L,
6f660f12
PC
111 INTUOS4S,
112 INTUOS4,
81af7e61 113 INTUOS4WL,
6f660f12 114 INTUOS4L,
9fee6195
JG
115 INTUOS5S,
116 INTUOS5,
117 INTUOS5L,
9a35c411
PC
118 INTUOSPS,
119 INTUOSPM,
120 INTUOSPL,
3a4b4aaa 121 WACOM_21UX2,
d838c644 122 WACOM_22HD,
a112e9fd 123 DTK,
d838c644 124 WACOM_24HD,
500d4160 125 WACOM_27QHD,
36d3c510 126 CINTIQ_HYBRID,
f7acb55c 127 CINTIQ_COMPANION_2,
3bea733a 128 CINTIQ,
0e1763f5 129 WACOM_BEE,
56218563 130 WACOM_13HD,
7ecfbfd3 131 WACOM_MO,
3b164a00
PC
132 BAMBOO_PEN,
133 INTUOSHT,
eda01dab 134 INTUOSHT2,
3b164a00 135 BAMBOO_TOUCH,
ea2e6024 136 BAMBOO_PT,
b1e4279e 137 WACOM_24HDT,
500d4160 138 WACOM_27QHDT,
8c97a765 139 BAMBOO_PAD,
7adb91bd 140 WIRELESS,
72b236d6 141 REMOTE,
ea2e6024 142 TABLETPC, /* add new TPC below */
ac173837 143 TABLETPCE,
ec67bbed 144 TABLETPC2FG,
1963518b 145 MTSCREEN,
6afdc289 146 MTTPC,
d51ddb2b 147 MTTPC_B,
7704ac93 148 HID_GENERIC,
3bea733a
PC
149 MAX_TYPE
150};
151
152struct wacom_features {
e33da8a5 153 const char *name;
3bea733a
PC
154 int x_max;
155 int y_max;
156 int pressure_max;
157 int distance_max;
158 int type;
e35fb8c1
PC
159 int x_resolution;
160 int y_resolution;
70ee06c5 161 int numbered_buttons;
ac414da3
PC
162 int x_min;
163 int y_min;
ec67bbed
PC
164 int device_type;
165 int x_phy;
166 int y_phy;
c669fb2b
BT
167 unsigned unit;
168 int unitExpo;
fed87e65
HR
169 int x_fuzz;
170 int y_fuzz;
171 int pressure_fuzz;
172 int distance_fuzz;
bc73dd39 173 unsigned quirks;
f393ee2b 174 unsigned touch_max;
aea2bf6a
JG
175 int oVid;
176 int oPid;
80befa93 177 int pktlen;
29b47391
BT
178 bool check_for_hid_type;
179 int hid_type;
601a22f3 180 int last_slot_field;
3bea733a
PC
181};
182
4492efff
PC
183struct wacom_shared {
184 bool stylus_in_proximity;
a43c7c53 185 bool touch_down;
961794a0
PC
186 /* for wireless device to access USB interfaces */
187 unsigned touch_max;
188 int type;
189 struct input_dev *touch_input;
a97ac104
BT
190 struct hid_device *pen;
191 struct hid_device *touch;
4492efff
PC
192};
193
7704ac93 194struct hid_data {
5ae6e89f
BT
195 __s16 inputmode; /* InputMode HID feature, -1 if non-existent */
196 __s16 inputmode_index; /* InputMode HID feature index in the report */
7704ac93
BT
197 bool inrange_state;
198 bool invert_state;
199 bool tipswitch;
5ae6e89f
BT
200 int x;
201 int y;
202 int pressure;
203 int width;
204 int height;
205 int id;
499522c8 206 int cc_report;
1b5d514a
JG
207 int cc_index;
208 int cc_value_index;
209 int num_expected;
210 int num_received;
7704ac93
BT
211};
212
3bea733a 213struct wacom_wac {
2a6cdbdd
JG
214 char pen_name[WACOM_NAME_MAX];
215 char touch_name[WACOM_NAME_MAX];
d2d13f18 216 char pad_name[WACOM_NAME_MAX];
d70420b9 217 char bat_name[WACOM_NAME_MAX];
7dbd229e 218 char ac_name[WACOM_NAME_MAX];
29b47391 219 unsigned char data[WACOM_PKGLEN_MAX];
4fc19381
PC
220 int tool[2];
221 int id[2];
72b236d6 222 __u32 serial[5];
b3bd7ef3 223 bool reporting_data;
e33da8a5 224 struct wacom_features features;
4492efff 225 struct wacom_shared *shared;
2a6cdbdd
JG
226 struct input_dev *pen_input;
227 struct input_dev *touch_input;
d2d13f18 228 struct input_dev *pad_input;
2a6cdbdd
JG
229 bool pen_registered;
230 bool touch_registered;
954df6ad 231 bool pad_registered;
16bf288c 232 int pid;
a1d552cc 233 int battery_capacity;
1963518b 234 int num_contacts_left;
ac8d1010 235 int bat_charging;
71fa641e 236 int bat_connected;
ac8d1010 237 int ps_connected;
f81a1295
BT
238 u8 bt_features;
239 u8 bt_high_speed;
7704ac93 240 struct hid_data hid_data;
3bea733a
PC
241};
242
243#endif