From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757670AbdKOOmv (ORCPT ); Wed, 15 Nov 2017 09:42:51 -0500 Received: from esa2.dell-outbound.iphmx.com ([68.232.149.220]:37740 "EHLO esa2.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756046AbdKOOmn (ORCPT ); Wed, 15 Nov 2017 09:42:43 -0500 IronPort-PHdr: =?us-ascii?q?9a23=3AbMuqhxQSDIMUTXjaSM/+6Yq1z9psv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa6zYhGN2/xhgRfzUJnB7Loc0qyN4vCmATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSijewZbB/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf?= =?us-ascii?q?5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbD?= =?us-ascii?q?VwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlS?= =?us-ascii?q?gHLSY0/mHJhMJtkKJVrhGvpxJ9zI7VfI6bO/Vxc7jBfdwBR2pNQtpdWzBDD466?= =?us-ascii?q?coABD/ABPeFdr4TloFYAqgGxBROtBOPo0DNGgH723ag90+QnDQ7G3RIvH9YKsH?= =?us-ascii?q?TTt9j6KbkdUeSxzKXS0TrDaPZW1C775YPVfB4hpvSMUqhxccrX0UQvDR3KgUiQ?= =?us-ascii?q?qYP/IzOZzPgCs2+e7+Z4SOKvkHUopxt2oji1ycchjJTCiIENyl3c9Ch0w5w5Kc?= =?us-ascii?q?O2RUJle9KoDZtdui6AO4Z3TM4uW3xktDogxrEbtpO2cjIGxIooyhLBcfCKcYiF?= =?us-ascii?q?7gr+WOueLzp0nm9pdbO+ihqo7EStxe7xWtOq3FpXsyZIlMTHuGoX2BzJ8MeHT+?= =?us-ascii?q?Nw/kKm2TmSyQ/e8vpEIUUolarDLJ4h36IwmoITsUvdGi/2n137g7GNdko+9OWk?= =?us-ascii?q?8fnobavipp+YLoN0jRz+Mrg1lcy4HOQ4NBUBU3aB9eS9zL3j/Uj5QbpQgvIqla?= =?us-ascii?q?nZtYjWJcUdpqGnHw9Yyocu5hWlAzu43tkUg2MLIE9FdR+IlYTkOl/DLOj9Dfil?= =?us-ascii?q?glSslDlrx+rBPr3kGpjDKWLMkK3gfbZ68UJSzgszzdVY55JSFr4BIez8Wkv1tN?= =?us-ascii?q?zfFRI2LhK7w+LjCNlnyoweXmePDreDMKzOqV+I+v4vI+6UaY8RuTb9LeUl5vH3?= =?us-ascii?q?gX84n18dZbSp3YcMZXCmEfRpPV+ZbWDvgtgfC2cKuBQxTOjwhF2FSz5TaG64X7?= =?us-ascii?q?gg6TEjFIKmEYDDS5ipgLyA2ie7A5JXanlFCl+SC3focZuLW/MXZSKMLc9ujCYE?= =?us-ascii?q?WaKiS4A/zxGushH1y759IurT4C0YusGr6N8gs+fekxM78D1ySdicyHqKTnt5hU?= =?us-ascii?q?sSSjM21bw5qkt4nBPLhaR9guBCBJpP4OlOUQc9K7bTyuV7D5b5XQeXLfmTT1Pz?= =?us-ascii?q?FvCvGzA2CPYwxtgIaEdwH9GlphzO2y7sCLgQwe/YTKco+77RiiCib/12zGzLgf?= =?us-ascii?q?Es?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2GlAAAkUQxahz+a6ERdGQEBAQEBAQEBA?= =?us-ascii?q?QEBAQcBAQEBAYQKEG4nB4N4mT0vgU6IW44CghEKI4RJTwIahHNAFwEBAQEBAQE?= =?us-ascii?q?BAQECEAEBAQoLCQgoL4I4IhBHLAEBAQEBAQEBASMBAQEBAQEjAg1dAQEBAgEBI?= =?us-ascii?q?wQNRQwEAgEIEQQBAQECAiMDAgICHyUBCAgCBAENBQgBigMDDQgQqCOBbTqHPQ2?= =?us-ascii?q?DSQEBAQEBAQEBAQEBAQEBAQEBAQEBAR2BD4IlggeDPYMrgmtZSlM+EA8UgluCY?= =?us-ascii?q?wWhej2HbYgghHCTTYxvOokFgTkhAYIqeoNCCYJTEAyBZ3cBiUuBM4ERAQEB?= X-IPAS-Result: =?us-ascii?q?A2GlAAAkUQxahz+a6ERdGQEBAQEBAQEBAQEBAQcBAQEBAYQ?= =?us-ascii?q?KEG4nB4N4mT0vgU6IW44CghEKI4RJTwIahHNAFwEBAQEBAQEBAQECEAEBAQoLC?= =?us-ascii?q?QgoL4I4IhBHLAEBAQEBAQEBASMBAQEBAQEjAg1dAQEBAgEBIwQNRQwEAgEIEQQ?= =?us-ascii?q?BAQECAiMDAgICHyUBCAgCBAENBQgBigMDDQgQqCOBbTqHPQ2DSQEBAQEBAQEBA?= =?us-ascii?q?QEBAQEBAQEBAQEBAR2BD4IlggeDPYMrgmtZSlM+EA8UgluCYwWhej2HbYgghHC?= =?us-ascii?q?TTYxvOokFgTkhAYIqeoNCCYJTEAyBZ3cBiUuBM4ERAQEB?= From: X-LoopCount0: from 10.166.132.190 X-IronPort-AV: E=Sophos;i="5.44,399,1505797200"; d="scan'208";a="87922732" X-DLP: DLP_GlobalPCIDSS To: , CC: , , , Subject: RE: [PATCH] HID: input: enable Totem on the Dell Canvas 27 Thread-Topic: [PATCH] HID: input: enable Totem on the Dell Canvas 27 Thread-Index: AQHTXhDArz1/YpoC8EqttBXedlTGxqMVgtlw Date: Wed, 15 Nov 2017 14:42:40 +0000 Message-ID: <7d0ebb0aa5c74504ab43611fffe27ba6@ausx13mpc120.AMER.DELL.COM> References: <20171110102635.325-1-benjamin.tissoires@redhat.com> <20171114085043.GA29518@jelly> <20171114182610.cfqsnwj7lu2by7pu@dtor-ws> <20171115125326.GF403@mail.corp.redhat.com> In-Reply-To: <20171115125326.GF403@mail.corp.redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.242.75] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vAFEgumb022083 > -----Original Message----- > From: Benjamin Tissoires [mailto:benjamin.tissoires@redhat.com] > Sent: Wednesday, November 15, 2017 6:53 AM > To: Dmitry Torokhov > Cc: Peter Hutterer ; Jiri Kosina ; > Limonciello, Mario ; linux-input@vger.kernel.org; > linux-kernel@vger.kernel.org > Subject: Re: [PATCH] HID: input: enable Totem on the Dell Canvas 27 > > On Nov 14 2017 or thereabouts, Dmitry Torokhov wrote: > > On Tue, Nov 14, 2017 at 06:50:43PM +1000, Peter Hutterer wrote: > > > sorry, this one got stuck in my outbox. > > > > > > On Fri, Nov 10, 2017 at 11:26:35AM +0100, Benjamin Tissoires wrote: > > > > The Dell Canvas 27 has a tool that can be put on the surface and acts > > > > as a dial. The firmware processes the detection of the tool and forward > > > > regular HID reports with X, Y, Azimuth, rotation, width/height. > > > > > > > > The firmware also exports Contact ID, Countact Count which may hint that > > > > several totems can be used at the same time, but for now, only allow > > > > one totem at a time. > > > > > > > > We also ignore scan time in hid-input.c because there is not much point > > > > to forward it now given that the indication of the tool being present > > > > is already provided through BTN_TOOL_DIAL. > > > > > > > > We need to add a new BTN_TOOL_DIAL event because the HID mapping > > > > suggests that this tool is aimed at being used by the system and not > > > > the applications. Also this prevents current systemd heuristics to > > > > apply ID_INPUT_TOUCHSCREEN to this new type of devices. > > > > > > > > I mapped Azimuth to ABS_WHEEL to somehow ressemble the Wacom Pads. > > > > > > HID docs indicate this is a full tool rotation, so ABS_RZ would be more > > > appropriate? > > > > > > "Azimuth > > > The counter-clockwise rotation of the cursor about the Z-axis." > > > > Right. We night also want to consider whether we need to convert HID to > > Linux values, as HID is counter-clockwise, and I suspect Linux will be > > clockwise (what do we report for joysticks?), similar to what we had for > > ABS_MT_ORIENTATION. > > > > > > > > But you also say it has rotation, so this is a bit confusing now :) > > > We should also use INPUT_PROP_DIRECT here. > > > > > > > Last, both Width and Heigth are groupped together, the FW reports > > > > > > typo: grouped > > > > > > > similar values for both and we are out of ABS_* events. > > > > > > > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=1511846 > > > > > > > > Signed-off-by: Benjamin Tissoires > > > > --- > > > > > > > > Hi, > > > > > > > > This is probably v4.16 material as we are close to the merge window > > > > (I wouldn't mind it applied in v4.15 though ;-P) > > > > > > I'm going to be annoying here and say I'd like to figure out how to add this > > > to libinput first to figure out what details can go wrong before we merge it > > > and commit to this forever. Hopefully that shouldn't take that long... > > > > > I had a chat with Peter this morning. TL;DR is I'll need to rework on > this more heavily to provide the final version with MT axes, and skip > the single device implementation. I have no ideas if the Dell Canvas > can report more than one totem, but the report descriptor would say so, > so we better have a proper implementation instead of having one for > single device capable and one for multiple devices. The Canvas can only support one large totem at a time. > > I'll probably send a v2 just to address the issues raised here, but it > shouldn't be merged given that user space will not be accepting such > version. > > Cheers, > Benjamin > > > > > The patch does the job but we probably need to decide if the mappings > > > > I chose are correct. > > > > > > > > For the record, I uploaded some evemu-record traces and hid-recorder > > > > traces in the RH Bz linked above to keep traces of them. > > > > The interesting one is the evemu one for the totem with this patch > > > > applied: > > > > https://bugzilla.redhat.com/attachment.cgi?id=1350389 > > > > > > > > Cheers, > > > > Benjamin > > > > > > > > drivers/hid/hid-input.c | 28 +++++++++++++++++++++++++++- > > > > drivers/hid/hid-multitouch.c | 11 +++++++++++ > > > > include/linux/hid.h | 6 ++++++ > > > > include/uapi/linux/input-event-codes.h | 1 + > > > > 4 files changed, 45 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c > > > > index 04d01b57d94c..7da72b571b7d 100644 > > > > --- a/drivers/hid/hid-input.c > > > > +++ b/drivers/hid/hid-input.c > > > > @@ -229,6 +229,7 @@ __s32 hidinput_calc_abs_res(const struct hid_field > *field, __u16 code) > > > > case ABS_X: > > > > case ABS_Y: > > > > case ABS_Z: > > > > + case ABS_TOOL_WIDTH: > > > > case ABS_MT_POSITION_X: > > > > case ABS_MT_POSITION_Y: > > > > case ABS_MT_TOOL_X: > > > > @@ -786,13 +787,24 @@ static void hidinput_configure_usage(struct > hid_input *hidinput, struct hid_fiel > > > > map_abs_clear(ABS_TILT_Y); > > > > break; > > > > > > > > + case 0x3f: /* Azimuth */ > > > > + map_abs_clear(ABS_WHEEL); > > > > + break; > > > > + > > > > case 0x33: /* Touch */ > > > > - case 0x42: /* TipSwitch */ > > > > case 0x43: /* TipSwitch2 */ > > > > device->quirks &= ~HID_QUIRK_NOTOUCH; > > > > map_key_clear(BTN_TOUCH); > > > > break; > > > > > > > > + case 0x42: /* TipSwitch */ > > > > + if (field->application == HID_GD_SYSTEM_MULTIAXIS) { > > > > + map_key_clear(BTN_TOOL_DIAL); > > > > + } else { > > > > + device->quirks &= ~HID_QUIRK_NOTOUCH; > > > > + map_key_clear(BTN_TOUCH); > > > > + } > > > > + break; > > > > case 0x44: /* BarrelSwitch */ > > > > map_key_clear(BTN_STYLUS); > > > > break; > > > > @@ -806,6 +818,20 @@ static void hidinput_configure_usage(struct > hid_input *hidinput, struct hid_fiel > > > > map_key_clear(BTN_TOUCH); > > > > break; > > > > > > > > + case 0x48: /* WIDTH */ > > > > + case 0x49: /* HEIGHT */ > > > > + map_abs_clear(ABS_TOOL_WIDTH); > > > > + break; > > > > + > > > > + case 0x51: /* CONTACT ID */ > > > > + goto ignore; > > > > + > > > > + case 0x54: /* CONTACT COUNT */ > > > > + goto ignore; > > > > + > > > > + case 0x56: /* SCANTIME */ > > > > + goto ignore; > > > > + > > > > case 0x46: /* TabletPick */ > > > > case 0x5a: /* SecondaryBarrelSwitch */ > > > > map_key_clear(BTN_STYLUS2); > > > > diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c > > > > index 65ea23be9677..a0b332518eaa 100644 > > > > --- a/drivers/hid/hid-multitouch.c > > > > +++ b/drivers/hid/hid-multitouch.c > > > > @@ -974,6 +974,7 @@ static int mt_input_mapping(struct hid_device *hdev, > struct hid_input *hi, > > > > field->application != HID_DG_TOUCHPAD && > > > > field->application != HID_GD_KEYBOARD && > > > > field->application != HID_GD_SYSTEM_CONTROL && > > > > + field->application != HID_GD_SYSTEM_MULTIAXIS && > > > > field->application != HID_CP_CONSUMER_CONTROL && > > > > field->application != HID_GD_WIRELESS_RADIO_CTLS && > > > > !(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS && > > > > @@ -1003,6 +1004,14 @@ static int mt_input_mapping(struct hid_device > *hdev, struct hid_input *hi, > > > > return 1; > > > > } > > > > > > > > + /* > > > > + * We do not want to export scantime on System MultiAxis > > > > + * for now > > > > + */ > > > > + if (field->usage->hid == HID_DG_SCANTIME && > > > > + field->application == HID_GD_SYSTEM_MULTIAXIS) > > > > + return -1; > > > > + > > > > /* > > > > * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" > > > > * for the stylus. > > > > @@ -1193,6 +1202,8 @@ static int mt_input_configured(struct hid_device > *hdev, struct hid_input *hi) > > > > break; > > > > case HID_GD_MOUSE: > > > > suffix = "Mouse"; > > > > + case HID_GD_SYSTEM_MULTIAXIS: > > > > + suffix = "MultiAxis"; > > > > break; > > > > case HID_DG_STYLUS: > > > > suffix = "Pen"; > > > > diff --git a/include/linux/hid.h b/include/linux/hid.h > > > > index d491027a7c22..f93ebbe2f23d 100644 > > > > --- a/include/linux/hid.h > > > > +++ b/include/linux/hid.h > > > > @@ -189,6 +189,12 @@ struct hid_item { > > > > * > http://www.usb.org/developers/hidpage/HUTRR40RadioHIDUsagesFinal.pdf > > > > */ > > > > #define HID_GD_WIRELESS_RADIO_CTLS 0x0001000c > > > > +/* > > > > + * System Multi-Axis, see: > > > > + * http://www.usb.org/developers/hidpage/HUTRR62_- > _Generic_Desktop_CA_for_System_Multi-Axis_Controllers.txt > > > > + */ > > > > +#define HID_GD_SYSTEM_MULTIAXIS 0x0001000e > > > > + > > > > #define HID_GD_X 0x00010030 > > > > #define HID_GD_Y 0x00010031 > > > > #define HID_GD_Z 0x00010032 > > > > diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input- > event-codes.h > > > > index 179891074b3c..f886499fdd4c 100644 > > > > --- a/include/uapi/linux/input-event-codes.h > > > > +++ b/include/uapi/linux/input-event-codes.h > > > > @@ -406,6 +406,7 @@ > > > > #define BTN_TOOL_MOUSE 0x146 > > > > #define BTN_TOOL_LENS 0x147 > > > > #define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ > > > > +#define BTN_TOOL_DIAL 0x149 /* System MultiAxis */ > > > > #define BTN_TOUCH 0x14a > > > > #define BTN_STYLUS 0x14b > > > > #define BTN_STYLUS2 0x14c > > > > -- > > > > 2.14.3 > > > > > > > > -- > > Dmitry