@@ -2237,62 +2237,34 @@ void wacom_setup_device_quirks(struct wacom *wacom)
2237
2237
}
2238
2238
}
2239
2239
2240
- static void wacom_abs_set_axis (struct input_dev * input_dev ,
2241
- struct wacom_wac * wacom_wac )
2242
- {
2243
- struct wacom_features * features = & wacom_wac -> features ;
2244
-
2245
- if (features -> device_type & WACOM_DEVICETYPE_PEN ) {
2246
- input_set_abs_params (input_dev , ABS_X , features -> x_min ,
2247
- features -> x_max , features -> x_fuzz , 0 );
2248
- input_set_abs_params (input_dev , ABS_Y , features -> y_min ,
2249
- features -> y_max , features -> y_fuzz , 0 );
2250
- input_set_abs_params (input_dev , ABS_PRESSURE , 0 ,
2251
- features -> pressure_max , features -> pressure_fuzz , 0 );
2252
-
2253
- /* penabled devices have fixed resolution for each model */
2254
- input_abs_set_res (input_dev , ABS_X , features -> x_resolution );
2255
- input_abs_set_res (input_dev , ABS_Y , features -> y_resolution );
2256
- } else if (features -> device_type & WACOM_DEVICETYPE_TOUCH ) {
2257
- if (features -> touch_max == 1 ) {
2258
- input_set_abs_params (input_dev , ABS_X , 0 ,
2259
- features -> x_max , features -> x_fuzz , 0 );
2260
- input_set_abs_params (input_dev , ABS_Y , 0 ,
2261
- features -> y_max , features -> y_fuzz , 0 );
2262
- input_abs_set_res (input_dev , ABS_X ,
2263
- features -> x_resolution );
2264
- input_abs_set_res (input_dev , ABS_Y ,
2265
- features -> y_resolution );
2266
- }
2267
-
2268
- if (features -> touch_max > 1 ) {
2269
- input_set_abs_params (input_dev , ABS_MT_POSITION_X , 0 ,
2270
- features -> x_max , features -> x_fuzz , 0 );
2271
- input_set_abs_params (input_dev , ABS_MT_POSITION_Y , 0 ,
2272
- features -> y_max , features -> y_fuzz , 0 );
2273
- input_abs_set_res (input_dev , ABS_MT_POSITION_X ,
2274
- features -> x_resolution );
2275
- input_abs_set_res (input_dev , ABS_MT_POSITION_Y ,
2276
- features -> y_resolution );
2277
- }
2278
- }
2279
- }
2280
-
2281
- int wacom_setup_pentouch_input_capabilities (struct input_dev * input_dev ,
2240
+ int wacom_setup_pen_input_capabilities (struct input_dev * input_dev ,
2282
2241
struct wacom_wac * wacom_wac )
2283
2242
{
2284
2243
struct wacom_features * features = & wacom_wac -> features ;
2285
2244
2286
2245
input_dev -> evbit [0 ] |= BIT_MASK (EV_KEY ) | BIT_MASK (EV_ABS );
2287
2246
2247
+ if (!(features -> device_type & WACOM_DEVICETYPE_PEN ))
2248
+ return - ENODEV ;
2249
+
2288
2250
if (features -> type == HID_GENERIC )
2289
2251
/* setup has already been done */
2290
2252
return 0 ;
2291
2253
2292
2254
__set_bit (BTN_TOUCH , input_dev -> keybit );
2293
2255
__set_bit (ABS_MISC , input_dev -> absbit );
2294
2256
2295
- wacom_abs_set_axis (input_dev , wacom_wac );
2257
+ input_set_abs_params (input_dev , ABS_X , features -> x_min ,
2258
+ features -> x_max , features -> x_fuzz , 0 );
2259
+ input_set_abs_params (input_dev , ABS_Y , features -> y_min ,
2260
+ features -> y_max , features -> y_fuzz , 0 );
2261
+ input_set_abs_params (input_dev , ABS_PRESSURE , 0 ,
2262
+ features -> pressure_max , features -> pressure_fuzz , 0 );
2263
+
2264
+ /* penabled devices have fixed resolution for each model */
2265
+ input_abs_set_res (input_dev , ABS_X , features -> x_resolution );
2266
+ input_abs_set_res (input_dev , ABS_Y , features -> y_resolution );
2267
+
2296
2268
2297
2269
switch (features -> type ) {
2298
2270
case GRAPHIRE_BT :
@@ -2361,53 +2333,25 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2361
2333
case INTUOSPS :
2362
2334
__set_bit (INPUT_PROP_POINTER , input_dev -> propbit );
2363
2335
2364
- if (features -> device_type & WACOM_DEVICETYPE_PEN ) {
2365
- input_set_abs_params (input_dev , ABS_DISTANCE , 0 ,
2366
- features -> distance_max ,
2367
- 0 , 0 );
2368
-
2369
- input_set_abs_params (input_dev , ABS_Z , -900 , 899 , 0 , 0 );
2370
- input_abs_set_res (input_dev , ABS_Z , 287 );
2336
+ input_set_abs_params (input_dev , ABS_DISTANCE , 0 ,
2337
+ features -> distance_max ,
2338
+ 0 , 0 );
2371
2339
2372
- wacom_setup_intuos (wacom_wac );
2373
- } else if (features -> device_type & WACOM_DEVICETYPE_TOUCH ) {
2374
- __clear_bit (ABS_MISC , input_dev -> absbit );
2340
+ input_set_abs_params (input_dev , ABS_Z , -900 , 899 , 0 , 0 );
2341
+ input_abs_set_res (input_dev , ABS_Z , 287 );
2375
2342
2376
- input_set_abs_params (input_dev , ABS_MT_TOUCH_MAJOR ,
2377
- 0 , features -> x_max , 0 , 0 );
2378
- input_set_abs_params (input_dev , ABS_MT_TOUCH_MINOR ,
2379
- 0 , features -> y_max , 0 , 0 );
2380
- input_mt_init_slots (input_dev , features -> touch_max , INPUT_MT_POINTER );
2381
- }
2343
+ wacom_setup_intuos (wacom_wac );
2382
2344
break ;
2383
2345
2384
2346
case WACOM_24HDT :
2385
- if (features -> device_type & WACOM_DEVICETYPE_TOUCH ) {
2386
- input_set_abs_params (input_dev , ABS_MT_TOUCH_MAJOR , 0 , features -> x_max , 0 , 0 );
2387
- input_set_abs_params (input_dev , ABS_MT_WIDTH_MAJOR , 0 , features -> x_max , 0 , 0 );
2388
- input_set_abs_params (input_dev , ABS_MT_WIDTH_MINOR , 0 , features -> y_max , 0 , 0 );
2389
- input_set_abs_params (input_dev , ABS_MT_ORIENTATION , 0 , 1 , 0 , 0 );
2390
- }
2391
- /* fall through */
2392
-
2393
2347
case WACOM_27QHDT :
2394
2348
case MTSCREEN :
2395
2349
case MTTPC :
2396
2350
case MTTPC_B :
2397
2351
case TABLETPC2FG :
2398
- if (features -> device_type & WACOM_DEVICETYPE_TOUCH && features -> touch_max > 1 )
2399
- input_mt_init_slots (input_dev , features -> touch_max , INPUT_MT_DIRECT );
2400
- /* fall through */
2401
-
2402
2352
case TABLETPC :
2403
2353
case TABLETPCE :
2404
2354
__clear_bit (ABS_MISC , input_dev -> absbit );
2405
-
2406
- __set_bit (INPUT_PROP_DIRECT , input_dev -> propbit );
2407
-
2408
- if (!(features -> device_type & WACOM_DEVICETYPE_PEN ))
2409
- break ; /* no need to process stylus stuff */
2410
-
2411
2355
/* fall through */
2412
2356
2413
2357
case DTUS :
@@ -2435,48 +2379,114 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2435
2379
break ;
2436
2380
2437
2381
case INTUOSHT :
2438
- if (features -> device_type & WACOM_DEVICETYPE_TOUCH ) {
2439
- input_dev -> evbit [0 ] |= BIT_MASK (EV_SW );
2440
- __set_bit (SW_MUTE_DEVICE , input_dev -> swbit );
2441
- }
2442
- /* fall through */
2443
-
2444
2382
case BAMBOO_PT :
2445
2383
__clear_bit (ABS_MISC , input_dev -> absbit );
2446
2384
2447
- if (features -> device_type & WACOM_DEVICETYPE_TOUCH ) {
2448
- if (features -> pktlen == WACOM_PKGLEN_BBTOUCH3 ) {
2449
- input_set_abs_params (input_dev ,
2450
- ABS_MT_TOUCH_MAJOR ,
2451
- 0 , features -> x_max , 0 , 0 );
2452
- input_set_abs_params (input_dev ,
2453
- ABS_MT_TOUCH_MINOR ,
2454
- 0 , features -> y_max , 0 , 0 );
2455
- }
2456
- input_mt_init_slots (input_dev , features -> touch_max , INPUT_MT_POINTER );
2457
- }
2458
- if (features -> device_type & WACOM_DEVICETYPE_PAD ) {
2459
- /* buttons/keys only interface */
2460
- __clear_bit (ABS_X , input_dev -> absbit );
2461
- __clear_bit (ABS_Y , input_dev -> absbit );
2462
- __clear_bit (BTN_TOUCH , input_dev -> keybit );
2385
+ __set_bit (INPUT_PROP_POINTER , input_dev -> propbit );
2386
+ __set_bit (BTN_TOOL_RUBBER , input_dev -> keybit );
2387
+ __set_bit (BTN_TOOL_PEN , input_dev -> keybit );
2388
+ __set_bit (BTN_STYLUS , input_dev -> keybit );
2389
+ __set_bit (BTN_STYLUS2 , input_dev -> keybit );
2390
+ input_set_abs_params (input_dev , ABS_DISTANCE , 0 ,
2391
+ features -> distance_max ,
2392
+ 0 , 0 );
2393
+ break ;
2394
+ case BAMBOO_PAD :
2395
+ __clear_bit (ABS_MISC , input_dev -> absbit );
2396
+ break ;
2397
+ }
2398
+ return 0 ;
2399
+ }
2463
2400
2464
- /* PAD is setup by wacom_setup_pad_input_capabilities later */
2465
- return 1 ;
2466
- }
2467
- if (features -> device_type & WACOM_DEVICETYPE_PEN ) {
2468
- __set_bit (INPUT_PROP_POINTER , input_dev -> propbit );
2469
- __set_bit (BTN_TOOL_RUBBER , input_dev -> keybit );
2470
- __set_bit (BTN_TOOL_PEN , input_dev -> keybit );
2471
- __set_bit (BTN_STYLUS , input_dev -> keybit );
2472
- __set_bit (BTN_STYLUS2 , input_dev -> keybit );
2473
- input_set_abs_params (input_dev , ABS_DISTANCE , 0 ,
2474
- features -> distance_max ,
2475
- 0 , 0 );
2401
+ int wacom_setup_touch_input_capabilities (struct input_dev * input_dev ,
2402
+ struct wacom_wac * wacom_wac )
2403
+ {
2404
+ struct wacom_features * features = & wacom_wac -> features ;
2405
+
2406
+ input_dev -> evbit [0 ] |= BIT_MASK (EV_KEY ) | BIT_MASK (EV_ABS );
2407
+
2408
+ if (!(features -> device_type & WACOM_DEVICETYPE_TOUCH ))
2409
+ return - ENODEV ;
2410
+
2411
+ if (features -> type == HID_GENERIC )
2412
+ /* setup has already been done */
2413
+ return 0 ;
2414
+
2415
+ __set_bit (BTN_TOUCH , input_dev -> keybit );
2416
+
2417
+ if (features -> touch_max == 1 ) {
2418
+ input_set_abs_params (input_dev , ABS_X , 0 ,
2419
+ features -> x_max , features -> x_fuzz , 0 );
2420
+ input_set_abs_params (input_dev , ABS_Y , 0 ,
2421
+ features -> y_max , features -> y_fuzz , 0 );
2422
+ input_abs_set_res (input_dev , ABS_X ,
2423
+ features -> x_resolution );
2424
+ input_abs_set_res (input_dev , ABS_Y ,
2425
+ features -> y_resolution );
2426
+ }
2427
+ else if (features -> touch_max > 1 ) {
2428
+ input_set_abs_params (input_dev , ABS_MT_POSITION_X , 0 ,
2429
+ features -> x_max , features -> x_fuzz , 0 );
2430
+ input_set_abs_params (input_dev , ABS_MT_POSITION_Y , 0 ,
2431
+ features -> y_max , features -> y_fuzz , 0 );
2432
+ input_abs_set_res (input_dev , ABS_MT_POSITION_X ,
2433
+ features -> x_resolution );
2434
+ input_abs_set_res (input_dev , ABS_MT_POSITION_Y ,
2435
+ features -> y_resolution );
2436
+ }
2437
+
2438
+ switch (features -> type ) {
2439
+ case INTUOS5 :
2440
+ case INTUOS5L :
2441
+ case INTUOSPM :
2442
+ case INTUOSPL :
2443
+ case INTUOS5S :
2444
+ case INTUOSPS :
2445
+ __set_bit (INPUT_PROP_POINTER , input_dev -> propbit );
2446
+
2447
+ input_set_abs_params (input_dev , ABS_MT_TOUCH_MAJOR , 0 , features -> x_max , 0 , 0 );
2448
+ input_set_abs_params (input_dev , ABS_MT_TOUCH_MINOR , 0 , features -> y_max , 0 , 0 );
2449
+ input_mt_init_slots (input_dev , features -> touch_max , INPUT_MT_POINTER );
2450
+ break ;
2451
+
2452
+ case WACOM_24HDT :
2453
+ input_set_abs_params (input_dev , ABS_MT_TOUCH_MAJOR , 0 , features -> x_max , 0 , 0 );
2454
+ input_set_abs_params (input_dev , ABS_MT_WIDTH_MAJOR , 0 , features -> x_max , 0 , 0 );
2455
+ input_set_abs_params (input_dev , ABS_MT_WIDTH_MINOR , 0 , features -> y_max , 0 , 0 );
2456
+ input_set_abs_params (input_dev , ABS_MT_ORIENTATION , 0 , 1 , 0 , 0 );
2457
+ /* fall through */
2458
+
2459
+ case WACOM_27QHDT :
2460
+ case MTSCREEN :
2461
+ case MTTPC :
2462
+ case MTTPC_B :
2463
+ case TABLETPC2FG :
2464
+ input_mt_init_slots (input_dev , features -> touch_max , INPUT_MT_DIRECT );
2465
+ /*fall through */
2466
+
2467
+ case TABLETPC :
2468
+ case TABLETPCE :
2469
+ __set_bit (INPUT_PROP_DIRECT , input_dev -> propbit );
2470
+ break ;
2471
+
2472
+ case INTUOSHT :
2473
+ input_dev -> evbit [0 ] |= BIT_MASK (EV_SW );
2474
+ __set_bit (SW_MUTE_DEVICE , input_dev -> swbit );
2475
+ /* fall through */
2476
+
2477
+ case BAMBOO_PT :
2478
+ if (features -> pktlen == WACOM_PKGLEN_BBTOUCH3 ) {
2479
+ input_set_abs_params (input_dev ,
2480
+ ABS_MT_TOUCH_MAJOR ,
2481
+ 0 , features -> x_max , 0 , 0 );
2482
+ input_set_abs_params (input_dev ,
2483
+ ABS_MT_TOUCH_MINOR ,
2484
+ 0 , features -> y_max , 0 , 0 );
2476
2485
}
2486
+ input_mt_init_slots (input_dev , features -> touch_max , INPUT_MT_POINTER );
2477
2487
break ;
2488
+
2478
2489
case BAMBOO_PAD :
2479
- __clear_bit (ABS_MISC , input_dev -> absbit );
2480
2490
input_mt_init_slots (input_dev , features -> touch_max ,
2481
2491
INPUT_MT_POINTER );
2482
2492
__set_bit (BTN_LEFT , input_dev -> keybit );
0 commit comments