@@ -2121,18 +2121,126 @@ static int wacom_mspro_pen_irq(struct wacom_wac *wacom)
2121
2121
return 1 ;
2122
2122
}
2123
2123
2124
- static int wacom_mspro_irq (struct wacom_wac * wacom )
2124
+ static int wacom_Pro2022_pen_irq (struct wacom_wac * wacom )
2125
2125
{
2126
2126
unsigned char * data = wacom -> data ;
2127
2127
struct input_dev * input = wacom -> input ;
2128
+ struct wacom_features * features = & wacom -> features ;
2129
+ bool tip , sw1 , sw2 , sw3 , range , proximity ;
2130
+ unsigned int x , y ;
2131
+ unsigned int pressure ;
2132
+ int tilt_x , tilt_y ;
2133
+ int rotation ;
2134
+ unsigned int fingerwheel ;
2135
+ unsigned int height ;
2136
+ u64 tool_uid ;
2137
+ unsigned int tool_type ;
2138
+ unsigned int timestamp ;
2139
+ unsigned short sequence_number ;
2140
+
2141
+ if (delay_pen_events (wacom ))
2142
+ return 1 ;
2143
+
2144
+ tip = data [2 ] & 0x01 ;
2145
+ sw1 = data [2 ] & 0x02 ;
2146
+ sw2 = data [2 ] & 0x04 ;
2147
+ sw3 = data [2 ] & 0x08 ;
2148
+ /* eraser = data[2] & 0x10; */
2149
+ /* invert = data[2] & 0x20; */
2150
+ range = data [2 ] & 0x40 ;
2151
+ proximity = data [2 ] & 0x80 ;
2152
+ x = le32_to_cpup ((__le32 * )& data [3 ]) & 0xFFFFFF ;
2153
+ y = le32_to_cpup ((__le32 * )& data [6 ]) & 0xFFFFFF ;
2154
+ pressure = le16_to_cpup ((__le16 * )& data [9 ]);
2155
+ tilt_x = (char )le16_to_cpup ((__le16 * )& data [11 ]);
2156
+ tilt_y = (char )le16_to_cpup ((__le16 * )& data [13 ]);
2157
+ rotation = (int16_t )le16_to_cpup ((__le16 * )& data [15 ]);
2158
+ fingerwheel = le16_to_cpup ((__le16 * )& data [17 ]);
2159
+ height = data [19 ];
2160
+ tool_uid = le64_to_cpup ((__le64 * )& data [20 ]);
2161
+ tool_type = le16_to_cpup ((__le16 * )& data [28 ]);
2162
+ timestamp = le16_to_cpup ((__le16 * )& data [30 ]);
2163
+ sequence_number = le16_to_cpup ((__le16 * )& data [32 ]);
2164
+
2165
+ if (range ) {
2166
+ wacom -> serial [0 ] = (tool_uid & 0xFFFFFFFF );
2167
+ wacom -> id [0 ] = ((tool_uid >> 32 ) & 0xFFFFF ) | tool_type ;
2168
+ wacom -> tool [0 ] = wacom_intuos_get_tool_type (wacom -> id [0 ] & 0xFFFFF );
2169
+ }
2170
+
2171
+ /* pointer going from fully "in range" to merely "in proximity" */
2172
+ if (!range && wacom -> tool [0 ])
2173
+ height = wacom -> features .distance_max ;
2174
+
2175
+
2176
+ /*
2177
+ * only report data if there's a tool for userspace to associate
2178
+ * the events with.
2179
+ */
2180
+ if (wacom -> tool [0 ]) {
2181
+
2182
+ /* Fix rotation alignment: userspace expects zero at left */
2183
+ rotation += 1800 /4 ;
2184
+ if (rotation > 899 )
2185
+ rotation -= 1800 ;
2186
+
2187
+ /* Fix tilt zero-point: wacom_setup_cintiq declares 0..127, not -63..+64 */
2188
+ tilt_x += 64 ;
2189
+ tilt_y += 64 ;
2128
2190
2191
+ input_report_key (input , BTN_TOUCH , proximity ? tip : 0 );
2192
+ input_report_key (input , BTN_STYLUS , proximity ? sw1 : 0 );
2193
+ input_report_key (input , BTN_STYLUS2 , proximity ? sw2 : 0 );
2194
+ input_report_key (input , BTN_STYLUS3 , proximity ? sw3 : 0 );
2195
+ input_report_abs (input , ABS_X , proximity ? x : 0 );
2196
+ input_report_abs (input , ABS_Y , proximity ? y : 0 );
2197
+ input_report_abs (input , ABS_PRESSURE , proximity ? pressure : 0 );
2198
+ input_report_abs (input , ABS_TILT_X , proximity ? tilt_x : 0 );
2199
+ input_report_abs (input , ABS_TILT_Y , proximity ? tilt_y : 0 );
2200
+ input_report_abs (input , ABS_Z , proximity ? rotation : 0 );
2201
+ input_report_abs (input , ABS_WHEEL , proximity ? fingerwheel : 0 );
2202
+ input_report_abs (input , ABS_DISTANCE , proximity ? height : 0 );
2203
+ input_event (input , EV_MSC , MSC_TIMESTAMP , timestamp );
2204
+
2205
+ if (wacom -> features .type != WACOM_ONE ) {
2206
+ input_event (input , EV_MSC , MSC_SERIAL ,
2207
+ wacom -> serial [0 ]);
2208
+ input_report_abs (input , ABS_MISC , proximity ?
2209
+ wacom_intuos_id_mangle (wacom -> id [0 ])
2210
+ : 0 );
2211
+ } else {
2212
+ input_report_abs (input , ABS_MISC , proximity ?
2213
+ STYLUS_DEVICE_ID : 0 );
2214
+ }
2215
+ input_report_key (input , wacom -> tool [0 ], proximity ? 1 : 0 );
2216
+
2217
+ if (features -> sequence_number != sequence_number )
2218
+ hid_warn (wacom -> input , "dropped %hu packets" , sequence_number - features -> sequence_number );
2219
+
2220
+ features -> sequence_number = sequence_number + 1 ;
2221
+
2222
+ if (!proximity )
2223
+ wacom -> tool [0 ] = 0 ;
2224
+ }
2225
+
2226
+ wacom -> shared -> stylus_in_proximity = proximity ;
2227
+
2228
+ return 1 ;
2229
+ }
2230
+
2231
+ static int wacom_mspro_irq (struct wacom_wac * wacom )
2232
+ {
2233
+ unsigned char * data = wacom -> data ;
2234
+ struct input_dev * input = wacom -> input ;
2129
2235
switch (data [0 ]) {
2130
2236
case WACOM_REPORT_MSPRO :
2131
2237
return wacom_mspro_pen_irq (wacom );
2132
2238
case WACOM_REPORT_MSPROPAD :
2133
2239
return wacom_mspro_pad_irq (wacom );
2134
2240
case WACOM_REPORT_MSPRODEVICE :
2135
2241
return wacom_mspro_device_irq (wacom );
2242
+ case WACOM_REPORT_PRO2022 :
2243
+ return wacom_Pro2022_pen_irq (wacom );
2136
2244
default :
2137
2245
dev_dbg (input -> dev .parent ,
2138
2246
"%s: received unknown report #%d\n" , __func__ , data [0 ]);
@@ -2203,6 +2311,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
2203
2311
case WACOM_MSPRO :
2204
2312
case INTUOSP2 :
2205
2313
case INTUOSP2S :
2314
+ case WACOM_PRO2022 :
2206
2315
case CINTIQ_16 :
2207
2316
if (len == WACOM_PKGLEN_INTUOSP2T &&
2208
2317
wacom_wac -> data [0 ] == WACOM_REPORT_VENDOR_DEF_TOUCH )
@@ -2554,6 +2663,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
2554
2663
break ;
2555
2664
2556
2665
case WACOM_MSPRO :
2666
+ case WACOM_PRO2022 :
2557
2667
case CINTIQ_16 :
2558
2668
input_set_abs_params (input_dev , ABS_Z , -900 , 899 , 0 , 0 );
2559
2669
__set_bit (BTN_STYLUS3 , input_dev -> keybit );
@@ -3557,6 +3667,11 @@ static const struct wacom_features wacom_features_0x3B3 =
3557
3667
{ "Wacom Cintiq Pro 16 Touch" , WACOM_PKGLEN_MSPROT , /* Touch */
3558
3668
.type = WACOM_MSPROT , .touch_max = 10 ,
3559
3669
.oVid = USB_VENDOR_ID_WACOM , .oPid = 0x3B2 };
3670
+ static const struct wacom_features wacom_features_0x3C0 =
3671
+ { "Wacom Cintiq Pro 27" , WACOM_PKGLEN_MSPRO , 120032 , 67868 , 8191 , 63 ,
3672
+ WACOM_PRO2022 , WACOM_INTUOS3_RES , WACOM_INTUOS3_RES , 8 ,
3673
+ WACOM_CINTIQ_OFFSET , WACOM_CINTIQ_OFFSET ,
3674
+ WACOM_CINTIQ_OFFSET , WACOM_CINTIQ_OFFSET };
3560
3675
static const struct wacom_features wacom_features_0x3c5 =
3561
3676
{ "Intuos BT S" , WACOM_PKGLEN_INTUOSP2 , 15200 , 9500 , 4095 ,
3562
3677
63 , INTUOSHT3 , WACOM_INTUOS_RES , WACOM_INTUOS_RES , 4 };
@@ -3771,6 +3886,7 @@ const struct usb_device_id wacom_ids[] = {
3771
3886
{ USB_DEVICE_WACOM (0x3B2 ) },
3772
3887
{ USB_DEVICE_WACOM (0x3B3 ) },
3773
3888
{ USB_DEVICE_WACOM (0x3BD ) },
3889
+ { USB_DEVICE_WACOM (0x3C0 ) },
3774
3890
{ USB_DEVICE_WACOM (0x3c5 ) },
3775
3891
{ USB_DEVICE_WACOM (0x3c7 ) },
3776
3892
{ USB_DEVICE_WACOM (0x3dc ) },
0 commit comments