Skip to content

Commit f4e11d5

Browse files
skomraJiri Kosina
authored andcommitted
HID: wacom: generic: support the 'report valid' usage for touch
Finger data is separated into chunks in our Bluetooth report, where each report contains the same number of chunks. Those chunks are not aligned in any particular way to a set of finger touches. That is, the first half of a group of simultaneous touches may be in one chunk at the end of a report and the second half could be at the beginning of the next report. Also some chunks contain no data and potentially some chunks could contain leftover (bad) data. Introduce and process the WACOM_HID_WT_REPORT_VALID usage that the device uses to let us know if we should process a chunk of data. Signed-off-by: Aaron Armstrong Skomra <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 184eccd commit f4e11d5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

drivers/hid/wacom_wac.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,9 @@ int wacom_equivalent_usage(int usage)
17521752
int subpage = (usage & 0xFF00) << 8;
17531753
int subusage = (usage & 0xFF);
17541754

1755+
if (usage == WACOM_HID_WT_REPORT_VALID)
1756+
return usage;
1757+
17551758
if (subpage == HID_UP_UNDEFINED)
17561759
subpage = WACOM_HID_SP_DIGITIZER;
17571760

@@ -2494,6 +2497,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
24942497
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
24952498
struct wacom_features *features = &wacom->wacom_wac.features;
24962499

2500+
if (wacom_wac->is_invalid_bt_frame)
2501+
return;
2502+
24972503
switch (equivalent_usage) {
24982504
case HID_GD_X:
24992505
wacom_wac->hid_data.x = value;
@@ -2513,12 +2519,14 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
25132519
case HID_DG_TIPSWITCH:
25142520
wacom_wac->hid_data.tipswitch = value;
25152521
break;
2522+
case WACOM_HID_WT_REPORT_VALID:
2523+
wacom_wac->is_invalid_bt_frame = !value;
2524+
return;
25162525
case HID_DG_CONTACTMAX:
25172526
features->touch_max = value;
25182527
return;
25192528
}
25202529

2521-
25222530
if (usage->usage_index + 1 == field->report_count) {
25232531
if (equivalent_usage == wacom_wac->hid_data.last_slot_field)
25242532
wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input);
@@ -2533,6 +2541,8 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
25332541
struct hid_data* hid_data = &wacom_wac->hid_data;
25342542
int i;
25352543

2544+
wacom_wac->is_invalid_bt_frame = false;
2545+
25362546
for (i = 0; i < report->maxfield; i++) {
25372547
struct hid_field *field = report->field[i];
25382548
int j;

drivers/hid/wacom_wac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
#define WACOM_HID_WT_SERIALNUMBER (WACOM_HID_UP_WACOMTOUCH | 0x5b)
160160
#define WACOM_HID_WT_X (WACOM_HID_UP_WACOMTOUCH | 0x130)
161161
#define WACOM_HID_WT_Y (WACOM_HID_UP_WACOMTOUCH | 0x131)
162+
#define WACOM_HID_WT_REPORT_VALID (WACOM_HID_UP_WACOMTOUCH | 0x1d0)
162163

163164
#define WACOM_BATTERY_USAGE(f) (((f)->hid == HID_DG_BATTERYSTRENGTH) || \
164165
((f)->hid == WACOM_HID_WD_BATTERY_CHARGING) || \

0 commit comments

Comments
 (0)