Query regarding hid-multitouch.c driver in 4.14/4.19
From: Neeraj Upadhyay
Date: Tue Nov 12 2019 - 21:30:07 EST
Hi,
I have one query regarding hid-multitouch.c driver and need your guidance on
how hid-multitouchc can restore/support the original behaviour, where, for
devices, for which application is not
HID_DG_TOUCHSCREEN/HID_DG_TOUCHPAD, and has
HID_DG_CONTACTID usage in its report, can still use generic input mappings.
We are using kernel versions 4.14 , 4.19 respectively in 2 different
projects:
4.14:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/hid/hid-multitouch.c?h=v4.14.153
4.19:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/hid/hid-multitouch.c?h=v4.19.83
I checked the application for our hid device, it's HID_DG_PEN, device
also has a HID_DG_CONTACTID usage defined in
its report.
In 4.19, is_mt_collection is set to 'true'. All multitouch code paths or
input mapping is configured
mt_allocate_report_data()
ÂÂÂÂÂÂÂ ...
ÂÂÂÂÂÂÂ for (n = 0; n < field->report_count; n++) {
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (field->usage[n].hid == HID_DG_CONTACTID)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ rdata->is_mt_collection = true;ÂÂ //
is_mt_collection is set to 'true'
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ }
ÂÂÂÂÂÂÂ }
mt_input_mapping()
ÂÂÂÂÂÂÂ ...
ÂÂÂÂÂÂÂ if (rdata->is_mt_collection)
ÂÂÂÂÂÂÂÂÂÂÂ return mt_touch_input_mapping(...)Â //
mt_touch_input_mapping() is called
mt_event()
ÂÂÂÂÂÂÂ if (rdata && rdata->is_mt_collection)
ÂÂÂÂÂÂÂÂÂÂÂ return mt_touch_event();Â // mt_touch_event() is called
However, in 4.14, the behaviour was different, mt input mapping was done
only
for HID_DG_TOUCHSCREEN/HID_DG_TOUCHPAD , and because our hid device is
HID_DG_PEN, generic mappings were applied for it; with these settings,
device
responds to events.
static int mt_input_mapping()
ÂÂÂÂÂÂÂ if (field->application == HID_DG_TOUCHSCREEN ||
ÂÂÂÂÂÂÂÂÂÂÂ field->application == HID_DG_TOUCHPAD)
ÂÂÂÂÂÂÂÂÂÂÂ return mt_touch_input_mapping();Â // This is not called.
mt_touch_input_mapping()
ÂÂÂÂÂÂÂ case HID_DG_CONTACTID:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ mt_store_field(usage, td, hi);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ td->touches_by_report++;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ td->mt_report_id = field->report->id; //
mt_report_id is not set.
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ return 1;
Looks like this behaviour changed, with below commits:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/hid/hid-multitouch.c?h=v4.19.83&id=8dfe14b3b47ff832cb638731f9fc696a3a84f804
8dfe14b3b47fÂÂÂ HID: multitouch: ditch mt_report_id
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/hid/hid-multitouch.c?h=v4.19.83&id=ba6b055e0f3b4ff4942e4ab273260affcfad9bff
ba6b055e0f3bÂÂÂÂ HID: input: enable Totem on the Dell Canvas 27
Can you please suggest on how we can support/preserve the original
behaviour?
Thanks
Neeraj
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation