@@ -2528,11 +2528,12 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
2528
2528
struct input_dev * input = wacom_wac -> pen_input ;
2529
2529
bool range = wacom_wac -> hid_data .inrange_state ;
2530
2530
bool sense = wacom_wac -> hid_data .sense_state ;
2531
+ bool entering_range = !wacom_wac -> tool [0 ] && range ;
2531
2532
2532
2533
if (wacom_wac -> is_invalid_bt_frame )
2533
2534
return ;
2534
2535
2535
- if (! wacom_wac -> tool [ 0 ] && range ) { /* first in range */
2536
+ if (entering_range ) { /* first in range */
2536
2537
/* Going into range select tool */
2537
2538
if (wacom_wac -> hid_data .invert_state )
2538
2539
wacom_wac -> tool [0 ] = BTN_TOOL_RUBBER ;
@@ -2583,6 +2584,15 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
2583
2584
input_sync (input );
2584
2585
}
2585
2586
2587
+ /* Handle AES battery timeout behavior */
2588
+ if (wacom_wac -> features .quirks & WACOM_QUIRK_AESPEN ) {
2589
+ if (entering_range )
2590
+ cancel_delayed_work (& wacom -> aes_battery_work );
2591
+ if (!sense )
2592
+ schedule_delayed_work (& wacom -> aes_battery_work ,
2593
+ msecs_to_jiffies (WACOM_AES_BATTERY_TIMEOUT ));
2594
+ }
2595
+
2586
2596
if (!sense ) {
2587
2597
wacom_wac -> tool [0 ] = 0 ;
2588
2598
wacom_wac -> id [0 ] = 0 ;
@@ -2649,8 +2659,8 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
2649
2659
{
2650
2660
struct hid_data * hid_data = & wacom_wac -> hid_data ;
2651
2661
bool mt = wacom_wac -> features .touch_max > 1 ;
2652
- bool prox = hid_data -> tipswitch &&
2653
- report_touch_events (wacom_wac );
2662
+ bool touch_down = hid_data -> tipswitch && hid_data -> confidence ;
2663
+ bool prox = touch_down && report_touch_events (wacom_wac );
2654
2664
2655
2665
if (touch_is_muted (wacom_wac )) {
2656
2666
if (!wacom_wac -> shared -> touch_down )
@@ -2700,24 +2710,6 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
2700
2710
}
2701
2711
}
2702
2712
2703
- static bool wacom_wac_slot_is_active (struct input_dev * dev , int key )
2704
- {
2705
- struct input_mt * mt = dev -> mt ;
2706
- struct input_mt_slot * s ;
2707
-
2708
- if (!mt )
2709
- return false;
2710
-
2711
- for (s = mt -> slots ; s != mt -> slots + mt -> num_slots ; s ++ ) {
2712
- if (s -> key == key &&
2713
- input_mt_get_value (s , ABS_MT_TRACKING_ID ) >= 0 ) {
2714
- return true;
2715
- }
2716
- }
2717
-
2718
- return false;
2719
- }
2720
-
2721
2713
static void wacom_wac_finger_event (struct hid_device * hdev ,
2722
2714
struct hid_field * field , struct hid_usage * usage , __s32 value )
2723
2715
{
@@ -2768,14 +2760,8 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
2768
2760
}
2769
2761
2770
2762
if (usage -> usage_index + 1 == field -> report_count ) {
2771
- if (equivalent_usage == wacom_wac -> hid_data .last_slot_field ) {
2772
- bool touch_removed = wacom_wac_slot_is_active (wacom_wac -> touch_input ,
2773
- wacom_wac -> hid_data .id ) && !wacom_wac -> hid_data .tipswitch ;
2774
-
2775
- if (wacom_wac -> hid_data .confidence || touch_removed ) {
2776
- wacom_wac_finger_slot (wacom_wac , wacom_wac -> touch_input );
2777
- }
2778
- }
2763
+ if (equivalent_usage == wacom_wac -> hid_data .last_slot_field )
2764
+ wacom_wac_finger_slot (wacom_wac , wacom_wac -> touch_input );
2779
2765
}
2780
2766
}
2781
2767
0 commit comments