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 <aaron.skomra@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
Aaron Armstrong Skomra 2019-06-12 14:19:30 -07:00 коммит произвёл Jiri Kosina
Родитель 184eccd403
Коммит f4e11d5996
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -1752,6 +1752,9 @@ int wacom_equivalent_usage(int usage)
int subpage = (usage & 0xFF00) << 8;
int subusage = (usage & 0xFF);
if (usage == WACOM_HID_WT_REPORT_VALID)
return usage;
if (subpage == HID_UP_UNDEFINED)
subpage = WACOM_HID_SP_DIGITIZER;
@ -2494,6 +2497,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
struct wacom_features *features = &wacom->wacom_wac.features;
if (wacom_wac->is_invalid_bt_frame)
return;
switch (equivalent_usage) {
case HID_GD_X:
wacom_wac->hid_data.x = value;
@ -2513,12 +2519,14 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
case HID_DG_TIPSWITCH:
wacom_wac->hid_data.tipswitch = value;
break;
case WACOM_HID_WT_REPORT_VALID:
wacom_wac->is_invalid_bt_frame = !value;
return;
case HID_DG_CONTACTMAX:
features->touch_max = value;
return;
}
if (usage->usage_index + 1 == field->report_count) {
if (equivalent_usage == wacom_wac->hid_data.last_slot_field)
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,
struct hid_data* hid_data = &wacom_wac->hid_data;
int i;
wacom_wac->is_invalid_bt_frame = false;
for (i = 0; i < report->maxfield; i++) {
struct hid_field *field = report->field[i];
int j;

Просмотреть файл

@ -159,6 +159,7 @@
#define WACOM_HID_WT_SERIALNUMBER (WACOM_HID_UP_WACOMTOUCH | 0x5b)
#define WACOM_HID_WT_X (WACOM_HID_UP_WACOMTOUCH | 0x130)
#define WACOM_HID_WT_Y (WACOM_HID_UP_WACOMTOUCH | 0x131)
#define WACOM_HID_WT_REPORT_VALID (WACOM_HID_UP_WACOMTOUCH | 0x1d0)
#define WACOM_BATTERY_USAGE(f) (((f)->hid == HID_DG_BATTERYSTRENGTH) || \
((f)->hid == WACOM_HID_WD_BATTERY_CHARGING) || \