Skip to content

Commit 0b43615

Browse files
author
Jiri Kosina
committed
Merge branch 'for-6.8/wacom' into for-linus
- functional fix for handling Confidence in Wacom driver (Jason Gerecke) - power management fix for Wacom userspace battery exporting (Tatsunosuke Tobita) Conflicts: tools/testing/selftests/hid/tests/test_wacom_generic.py
2 parents 53eb935 + b0fb904 commit 0b43615

File tree

5 files changed

+301
-29
lines changed

5 files changed

+301
-29
lines changed

drivers/hid/wacom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ struct wacom {
164164
struct work_struct battery_work;
165165
struct work_struct remote_work;
166166
struct delayed_work init_work;
167+
struct delayed_work aes_battery_work;
167168
struct wacom_remote *remote;
168169
struct work_struct mode_change_work;
169170
struct timer_list idleprox_timer;

drivers/hid/wacom_sys.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,13 @@ static void wacom_destroy_battery(struct wacom *wacom)
18131813
}
18141814
}
18151815

1816+
static void wacom_aes_battery_handler(struct work_struct *work)
1817+
{
1818+
struct wacom *wacom = container_of(work, struct wacom, aes_battery_work.work);
1819+
1820+
wacom_destroy_battery(wacom);
1821+
}
1822+
18161823
static ssize_t wacom_show_speed(struct device *dev,
18171824
struct device_attribute
18181825
*attr, char *buf)
@@ -2794,6 +2801,7 @@ static int wacom_probe(struct hid_device *hdev,
27942801

27952802
mutex_init(&wacom->lock);
27962803
INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work);
2804+
INIT_DELAYED_WORK(&wacom->aes_battery_work, wacom_aes_battery_handler);
27972805
INIT_WORK(&wacom->wireless_work, wacom_wireless_work);
27982806
INIT_WORK(&wacom->battery_work, wacom_battery_work);
27992807
INIT_WORK(&wacom->remote_work, wacom_remote_work);

drivers/hid/wacom_wac.c

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,11 +2528,12 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
25282528
struct input_dev *input = wacom_wac->pen_input;
25292529
bool range = wacom_wac->hid_data.inrange_state;
25302530
bool sense = wacom_wac->hid_data.sense_state;
2531+
bool entering_range = !wacom_wac->tool[0] && range;
25312532

25322533
if (wacom_wac->is_invalid_bt_frame)
25332534
return;
25342535

2535-
if (!wacom_wac->tool[0] && range) { /* first in range */
2536+
if (entering_range) { /* first in range */
25362537
/* Going into range select tool */
25372538
if (wacom_wac->hid_data.invert_state)
25382539
wacom_wac->tool[0] = BTN_TOOL_RUBBER;
@@ -2583,6 +2584,15 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
25832584
input_sync(input);
25842585
}
25852586

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+
25862596
if (!sense) {
25872597
wacom_wac->tool[0] = 0;
25882598
wacom_wac->id[0] = 0;
@@ -2649,8 +2659,8 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
26492659
{
26502660
struct hid_data *hid_data = &wacom_wac->hid_data;
26512661
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);
26542664

26552665
if (touch_is_muted(wacom_wac)) {
26562666
if (!wacom_wac->shared->touch_down)
@@ -2700,24 +2710,6 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
27002710
}
27012711
}
27022712

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-
27212713
static void wacom_wac_finger_event(struct hid_device *hdev,
27222714
struct hid_field *field, struct hid_usage *usage, __s32 value)
27232715
{
@@ -2768,14 +2760,8 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
27682760
}
27692761

27702762
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);
27792765
}
27802766
}
27812767

drivers/hid/wacom_wac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define WACOM_MAX_REMOTES 5
1515
#define WACOM_STATUS_UNKNOWN 255
1616
#define WACOM_REMOTE_BATTERY_TIMEOUT 21000000000ll
17+
#define WACOM_AES_BATTERY_TIMEOUT 1800000
1718

1819
/* packet length for individual models */
1920
#define WACOM_PKGLEN_BBFUN 9

0 commit comments

Comments
 (0)