From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gerecke Subject: Re: [PATCH 1/2] HID: wacom: Add WACOM_DEVICETYPE_DIRECT for Cintiqs and similar Date: Wed, 20 Jul 2016 10:48:36 -0700 Message-ID: <70d3efd5-0e6c-743d-e962-967210ecd753@gmail.com> References: <20160711180711.17537-1-killertofu@gmail.com> <20160712073653.GF4663@mail.corp.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-pa0-f68.google.com ([209.85.220.68]:35866 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754759AbcGTRsj (ORCPT ); Wed, 20 Jul 2016 13:48:39 -0400 Received: by mail-pa0-f68.google.com with SMTP id ez1so3678691pab.3 for ; Wed, 20 Jul 2016 10:48:39 -0700 (PDT) In-Reply-To: <20160712073653.GF4663@mail.corp.redhat.com> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Benjamin Tissoires Cc: linux-input@vger.kernel.org, Ping Cheng , Aaron Skomra , Jason Gerecke On 07/12/2016 12:36 AM, Benjamin Tissoires wrote: > On Jul 11 2016 or thereabouts, Jason Gerecke wrote: >> "Direct" input deviecs like Cintiqs and Tablet PCs set the INPUT_PRO= P_DIRECT >> property to notify userspace that the sensor and screen are overlaye= d. This >> information can also be useful elsewhere within the kernel driver, h= owever, >> so we introduce a new WACOM_DEVICETYPE_DIRECT that signals this to o= ther >> kernel code. >> >> Signed-off-by: Jason Gerecke >> --- >> drivers/hid/wacom_wac.c | 40 ++++++++++++++++++++++++--------------= -- >> drivers/hid/wacom_wac.h | 1 + >> 2 files changed, 25 insertions(+), 16 deletions(-) >> >> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c >> index e499cdb..2523a29 100644 >> --- a/drivers/hid/wacom_wac.c >> +++ b/drivers/hid/wacom_wac.c >> @@ -1757,8 +1757,10 @@ void wacom_wac_usage_mapping(struct hid_devic= e *hdev, >> { >> struct wacom *wacom =3D hid_get_drvdata(hdev); >> struct wacom_wac *wacom_wac =3D &wacom->wacom_wac; >> + struct wacom_features *features =3D &wacom_wac->features; >> =20 >> /* currently, only direct devices have proper hid report descripto= rs */ >> + features->device_type |=3D WACOM_DEVICETYPE_DIRECT; >> __set_bit(INPUT_PROP_DIRECT, wacom_wac->pen_input->propbit); >> __set_bit(INPUT_PROP_DIRECT, wacom_wac->touch_input->propbit); >=20 > nitpick: you might as well remove these additions of INPUT_PROP_DIREC= T, > as you are handling the test later and adding them no matter what. >=20 Are you seeing something I'm missing? The new calls in wacom_setup_{pen,touch}_input_capabilities that setup INPUT_PROP_DIRECT won't be called for HID_GENERIC devices since we bail out at the top of the functions. Perhaps you'd prefer me to move their setting of INPUT_PROP_DIRECT to before the point we bail, letting me remove them from here? Jason --- Now instead of four in the eights place / you=E2=80=99ve got three, =E2=80=98Cause you added one / (That is to say, eight) to the two, / But you can=E2=80=99t take seven from three, / So you look at the sixty-fours.... > Rest looks good to me. >=20 > Reviewed-by: Benjamin Tissoires >=20 > Cheers, > Benjamin >=20 >> =20 >> @@ -2465,6 +2467,19 @@ void wacom_setup_device_quirks(struct wacom *= wacom) >> if (features->type =3D=3D REMOTE) >> features->device_type =3D WACOM_DEVICETYPE_PAD; >> =20 >> + if (features->type =3D=3D PL || features->type =3D=3D DTU= || >> + features->type =3D=3D DTUS || features->type =3D=3D DTU= SX || >> + features->type =3D=3D WACOM_21UX2 || features->type =3D=3D WAC= OM_22HD || >> + features->type =3D=3D DTK || features->type =3D=3D WAC= OM_24HD || >> + features->type =3D=3D WACOM_27QHD || features->type =3D=3D CIN= TIQ_HYBRID || >> + features->type =3D=3D CINTIQ_COMPANION_2 || features->type =3D= =3D CINTIQ || >> + features->type =3D=3D WACOM_BEE || features->type =3D=3D WAC= OM_13HD || >> + features->type =3D=3D WACOM_24HDT || features->type =3D=3D WAC= OM_27QHDT || >> + features->type =3D=3D TABLETPC || features->type =3D=3D TAB= LETPCE || >> + features->type =3D=3D TABLETPC2FG || features->type =3D=3D MTS= CREEN || >> + features->type =3D=3D MTTPC || features->type =3D=3D MTT= PC_B) >> + features->device_type |=3D WACOM_DEVICETYPE_DIRECT; >> + >> if (wacom->hdev->bus =3D=3D BUS_BLUETOOTH) >> features->quirks |=3D WACOM_QUIRK_BATTERY; >> =20 >> @@ -2516,6 +2531,10 @@ int wacom_setup_pen_input_capabilities(struct= input_dev *input_dev, >> input_abs_set_res(input_dev, ABS_X, features->x_resolution); >> input_abs_set_res(input_dev, ABS_Y, features->y_resolution); >> =20 >> + if (features->device_type & WACOM_DEVICETYPE_DIRECT) >> + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); >> + else >> + __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> =20 >> switch (features->type) { >> case GRAPHIRE_BT: >> @@ -2540,8 +2559,6 @@ int wacom_setup_pen_input_capabilities(struct = input_dev *input_dev, >> __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); >> __set_bit(BTN_STYLUS, input_dev->keybit); >> __set_bit(BTN_STYLUS2, input_dev->keybit); >> - >> - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> break; >> =20 >> case WACOM_27QHD: >> @@ -2556,7 +2573,6 @@ int wacom_setup_pen_input_capabilities(struct = input_dev *input_dev, >> case CINTIQ_COMPANION_2: >> input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); >> input_abs_set_res(input_dev, ABS_Z, 287); >> - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); >> wacom_setup_cintiq(wacom_wac); >> break; >> =20 >> @@ -2572,8 +2588,6 @@ int wacom_setup_pen_input_capabilities(struct = input_dev *input_dev, >> /* fall through */ >> =20 >> case INTUOS: >> - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> - >> wacom_setup_intuos(wacom_wac); >> break; >> =20 >> @@ -2583,8 +2597,6 @@ int wacom_setup_pen_input_capabilities(struct = input_dev *input_dev, >> case INTUOSPL: >> case INTUOS5S: >> case INTUOSPS: >> - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> - >> input_set_abs_params(input_dev, ABS_DISTANCE, 0, >> features->distance_max, >> features->distance_fuzz, 0); >> @@ -2614,8 +2626,6 @@ int wacom_setup_pen_input_capabilities(struct = input_dev *input_dev, >> __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); >> __set_bit(BTN_STYLUS, input_dev->keybit); >> __set_bit(BTN_STYLUS2, input_dev->keybit); >> - >> - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); >> break; >> =20 >> case PTU: >> @@ -2626,16 +2636,12 @@ int wacom_setup_pen_input_capabilities(struc= t input_dev *input_dev, >> __set_bit(BTN_TOOL_PEN, input_dev->keybit); >> __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); >> __set_bit(BTN_STYLUS, input_dev->keybit); >> - >> - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> break; >> =20 >> case INTUOSHT: >> case BAMBOO_PT: >> case BAMBOO_PEN: >> case INTUOSHT2: >> - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> - >> if (features->type =3D=3D INTUOSHT2) { >> wacom_setup_basic_pro_pen(wacom_wac); >> } else { >> @@ -2693,6 +2699,11 @@ int wacom_setup_touch_input_capabilities(stru= ct input_dev *input_dev, >> features->y_resolution); >> } >> =20 >> + if (features->device_type & WACOM_DEVICETYPE_DIRECT) >> + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); >> + else >> + __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> + >> switch (features->type) { >> case INTUOS5: >> case INTUOS5L: >> @@ -2700,8 +2711,6 @@ int wacom_setup_touch_input_capabilities(struc= t input_dev *input_dev, >> case INTUOSPL: >> case INTUOS5S: >> case INTUOSPS: >> - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); >> - >> input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->= x_max, 0, 0); >> input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->= y_max, 0, 0); >> input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POIN= TER); >> @@ -2724,7 +2733,6 @@ int wacom_setup_touch_input_capabilities(struc= t input_dev *input_dev, >> =20 >> case TABLETPC: >> case TABLETPCE: >> - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); >> break; >> =20 >> case INTUOSHT: >> diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h >> index 8a8974c..7ad6273 100644 >> --- a/drivers/hid/wacom_wac.h >> +++ b/drivers/hid/wacom_wac.h >> @@ -82,6 +82,7 @@ >> #define WACOM_DEVICETYPE_TOUCH 0x0002 >> #define WACOM_DEVICETYPE_PAD 0x0004 >> #define WACOM_DEVICETYPE_WL_MONITOR 0x0008 >> +#define WACOM_DEVICETYPE_DIRECT 0x0010 >> =20 >> #define WACOM_VENDORDEFINED_PEN 0xff0d0001 >> #define WACOM_G9_PAGE 0xff090000 >> --=20 >> 2.9.0 >> -- To unsubscribe from this list: send the line "unsubscribe linux-input" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html