@@ -824,6 +824,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
824
824
return 0 ;
825
825
}
826
826
827
+ static inline bool touch_is_muted (struct wacom_wac * wacom_wac )
828
+ {
829
+ return wacom_wac -> probe_complete &&
830
+ wacom_wac -> shared -> has_mute_touch_switch &&
831
+ !wacom_wac -> shared -> is_touch_on ;
832
+ }
833
+
827
834
static inline bool report_touch_events (struct wacom_wac * wacom )
828
835
{
829
836
return (touch_arbitration ? !wacom -> shared -> stylus_in_proximity : 1 );
@@ -1525,11 +1532,8 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
1525
1532
int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET ;
1526
1533
int y_offset = 2 ;
1527
1534
1528
- if (wacom -> shared -> has_mute_touch_switch &&
1529
- !wacom -> shared -> is_touch_on ) {
1530
- if (!wacom -> shared -> touch_down )
1531
- return 0 ;
1532
- }
1535
+ if (touch_is_muted (wacom ) && !wacom -> shared -> touch_down )
1536
+ return 0 ;
1533
1537
1534
1538
if (wacom -> features .type == WACOM_27QHDT ) {
1535
1539
current_num_contacts = data [63 ];
@@ -1987,14 +1991,17 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
1987
1991
features -> numbered_buttons ++ ;
1988
1992
features -> device_type |= WACOM_DEVICETYPE_PAD ;
1989
1993
break ;
1990
- case WACOM_HID_WD_TOUCHONOFF :
1991
1994
case WACOM_HID_WD_MUTE_DEVICE :
1995
+ /* softkey touch switch */
1996
+ wacom_wac -> is_soft_touch_switch = true;
1997
+ fallthrough ;
1998
+ case WACOM_HID_WD_TOUCHONOFF :
1992
1999
/*
1993
- * This usage , which is used to mute touch events, comes
1994
- * from the pad packet, but is reported on the touch
2000
+ * These two usages , which are used to mute touch events, come
2001
+ * from the pad packet, but are reported on the touch
1995
2002
* interface. Because the touch interface may not have
1996
2003
* been created yet, we cannot call wacom_map_usage(). In
1997
- * order to process this usage when we receive it , we set
2004
+ * order to process the usages when we receive them , we set
1998
2005
* the usage type and code directly.
1999
2006
*/
2000
2007
wacom_wac -> has_mute_touch_switch = true;
@@ -2533,8 +2540,7 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
2533
2540
bool prox = hid_data -> tipswitch &&
2534
2541
report_touch_events (wacom_wac );
2535
2542
2536
- if (wacom_wac -> shared -> has_mute_touch_switch &&
2537
- !wacom_wac -> shared -> is_touch_on ) {
2543
+ if (touch_is_muted (wacom_wac )) {
2538
2544
if (!wacom_wac -> shared -> touch_down )
2539
2545
return ;
2540
2546
prox = false;
@@ -2548,8 +2554,17 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
2548
2554
int slot ;
2549
2555
2550
2556
slot = input_mt_get_slot_by_key (input , hid_data -> id );
2551
- if (slot < 0 )
2557
+ if (slot < 0 ) {
2552
2558
return ;
2559
+ } else {
2560
+ struct input_mt_slot * ps = & input -> mt -> slots [slot ];
2561
+ int mt_id = input_mt_get_value (ps , ABS_MT_TRACKING_ID );
2562
+
2563
+ if (!prox && mt_id < 0 ) {
2564
+ // No data to send for this slot; short-circuit
2565
+ return ;
2566
+ }
2567
+ }
2553
2568
2554
2569
input_mt_slot (input , slot );
2555
2570
input_mt_report_slot_state (input , MT_TOOL_FINGER , prox );
@@ -2581,6 +2596,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
2581
2596
unsigned equivalent_usage = wacom_equivalent_usage (usage -> hid );
2582
2597
struct wacom_features * features = & wacom -> wacom_wac .features ;
2583
2598
2599
+ if (touch_is_muted (wacom_wac ) && !wacom_wac -> shared -> touch_down )
2600
+ return ;
2601
+
2584
2602
if (wacom_wac -> is_invalid_bt_frame )
2585
2603
return ;
2586
2604
@@ -2630,6 +2648,9 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
2630
2648
struct hid_data * hid_data = & wacom_wac -> hid_data ;
2631
2649
int i ;
2632
2650
2651
+ if (touch_is_muted (wacom_wac ) && !wacom_wac -> shared -> touch_down )
2652
+ return ;
2653
+
2633
2654
wacom_wac -> is_invalid_bt_frame = false;
2634
2655
2635
2656
for (i = 0 ; i < report -> maxfield ; i ++ ) {
@@ -2681,6 +2702,10 @@ static void wacom_wac_finger_report(struct hid_device *hdev,
2681
2702
struct input_dev * input = wacom_wac -> touch_input ;
2682
2703
unsigned touch_max = wacom_wac -> features .touch_max ;
2683
2704
2705
+ /* if there was nothing to process, don't send an empty sync */
2706
+ if (wacom_wac -> hid_data .num_expected == 0 )
2707
+ return ;
2708
+
2684
2709
/* If more packets of data are expected, give us a chance to
2685
2710
* process them rather than immediately syncing a partial
2686
2711
* update.
@@ -3835,6 +3860,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
3835
3860
input_dev -> evbit [0 ] |= BIT_MASK (EV_SW );
3836
3861
__set_bit (SW_MUTE_DEVICE , input_dev -> swbit );
3837
3862
wacom_wac -> has_mute_touch_switch = true;
3863
+ wacom_wac -> is_soft_touch_switch = true;
3838
3864
}
3839
3865
fallthrough ;
3840
3866
0 commit comments