From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Jason Gerecke <killertofu@gmail.com>
Cc: linux-input@vger.kernel.org, Jiri Kosina <jkosina@suse.cz>,
Ping Cheng <pinglinux@gmail.com>,
Ping Cheng <ping.cheng@wacom.com>,
Aaron Skomra <skomra@gmail.com>,
Jason Gerecke <jason.gerecke@wacom.com>
Subject: Re: [PATCH 13/19] HID: wacom: generic: Pass 'hdev' to 'wacom_map_usage'
Date: Fri, 7 Oct 2016 17:46:55 +0200 [thread overview]
Message-ID: <20161007154655.GB30411@mail.corp.redhat.com> (raw)
In-Reply-To: <20161006212231.31440-14-killertofu@gmail.com>
On Oct 06 2016 or thereabouts, Jason Gerecke wrote:
> In the following "Add support for sensor offsets" patch we'll need access
> to the 'features' struct within 'wacom_map_usage', so update the function
> signature and calls to include a reference to the HID device so this can
> be done.
>
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> ---
> drivers/hid/wacom_wac.c | 53 ++++++++++++++++++++++++++-----------------------
> 1 file changed, 28 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index f2aadc4..8f493cc 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -1465,9 +1465,12 @@ static int wacom_equivalent_usage(int usage)
> return usage;
> }
>
> -static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
> - struct hid_field *field, __u8 type, __u16 code, int fuzz)
> +static void wacom_map_usage(struct input_dev *input, struct hid_device *hdev,
> + struct hid_usage *usage, struct hid_field *field, __u8 type,
> + __u16 code, int fuzz)
> {
> + struct wacom *wacom = hid_get_drvdata(hdev);
This might not be entirely relevant, but given the inputs are created
through wacom_allocate_input() and struct wacom * being stored in the
driver data, a simple call to input_get_drvdata(input) would provide the
struct wacom. Then from here, the hid_device can be retrieved from
struct wacom directly.
So I don't know if it's worth resending the series just for this and if
this has caveats... (my rev-by still applies).
Cheers,
Benjamin
> + struct wacom_wac *wacom_wac = &wacom->wacom_wac;
> int fmin = field->logical_minimum;
> int fmax = field->logical_maximum;
> unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
> @@ -1508,53 +1511,53 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
>
> switch (equivalent_usage) {
> case HID_GD_X:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_X, 4);
> break;
> case HID_GD_Y:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_Y, 4);
> break;
> case WACOM_HID_WD_DISTANCE:
> case HID_GD_Z:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_DISTANCE, 0);
> break;
> case HID_DG_TIPPRESSURE:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_PRESSURE, 0);
> break;
> case HID_DG_INRANGE:
> - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOOL_PEN, 0);
> break;
> case HID_DG_INVERT:
> - wacom_map_usage(input, usage, field, EV_KEY,
> + wacom_map_usage(input, hdev, usage, field, EV_KEY,
> BTN_TOOL_RUBBER, 0);
> break;
> case HID_DG_TILT_X:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_TILT_X, 0);
> break;
> case HID_DG_TILT_Y:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_TILT_Y, 0);
> break;
> case HID_DG_TWIST:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_Z, 0);
> break;
> case HID_DG_ERASER:
> case HID_DG_TIPSWITCH:
> - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOUCH, 0);
> break;
> case HID_DG_BARRELSWITCH:
> - wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_STYLUS, 0);
> break;
> case HID_DG_BARRELSWITCH2:
> - wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_STYLUS2, 0);
> break;
> case HID_DG_TOOLSERIALNUMBER:
> - wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_MSC, MSC_SERIAL, 0);
> break;
> case WACOM_HID_WD_SENSE:
> features->quirks |= WACOM_QUIRK_SENSE;
> - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOOL_PEN, 0);
> break;
> case WACOM_HID_WD_SERIALHI:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MISC, 0);
> set_bit(EV_KEY, input->evbit);
> input_set_capability(input, EV_KEY, BTN_TOOL_PEN);
> input_set_capability(input, EV_KEY, BTN_TOOL_RUBBER);
> @@ -1565,7 +1568,7 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
> input_set_capability(input, EV_KEY, BTN_TOOL_LENS);
> break;
> case WACOM_HID_WD_FINGERWHEEL:
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_WHEEL, 0);
> break;
> }
> }
> @@ -1722,24 +1725,24 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
> case HID_GD_X:
> features->last_slot_field = usage->hid;
> if (touch_max == 1)
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_X, 4);
> else
> - wacom_map_usage(input, usage, field, EV_ABS,
> + wacom_map_usage(input, hdev, usage, field, EV_ABS,
> ABS_MT_POSITION_X, 4);
> break;
> case HID_GD_Y:
> features->last_slot_field = usage->hid;
> if (touch_max == 1)
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_Y, 4);
> else
> - wacom_map_usage(input, usage, field, EV_ABS,
> + wacom_map_usage(input, hdev, usage, field, EV_ABS,
> ABS_MT_POSITION_Y, 4);
> break;
> case HID_DG_WIDTH:
> case HID_DG_HEIGHT:
> features->last_slot_field = usage->hid;
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0);
> - wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0);
> input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0);
> break;
> case HID_DG_CONTACTID:
> @@ -1753,7 +1756,7 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
> break;
> case HID_DG_TIPSWITCH:
> features->last_slot_field = usage->hid;
> - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0);
> + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOUCH, 0);
> break;
> case HID_DG_CONTACTCOUNT:
> wacom_wac->hid_data.cc_report = field->report->id;
> --
> 2.10.0
>
next prev parent reply other threads:[~2016-10-07 15:47 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-06 21:22 [PATCH 00/19] HID: wacom: Add support for MobileStudio Pro Jason Gerecke
2016-10-06 21:22 ` [PATCH 01/19] HID: wacom: Update vendor-defined usage names to better match standards Jason Gerecke
2016-10-06 21:22 ` [PATCH 02/19] HID: wacom: Have WACOM_PEN_FIELD and WACOM_FINGER_FIELD recgonize more fields Jason Gerecke
2016-10-06 21:22 ` [PATCH 03/19] HID: wacom: Refactor button-to-key translation into function Jason Gerecke
2016-10-06 21:22 ` [PATCH 04/19] HID: wacom: Detect and correct descriptors missing HID_DG_BARRELSWITCH2 Jason Gerecke
2016-10-06 21:22 ` [PATCH 05/19] HID: wacom: generic: Strip off excessive name prefixing Jason Gerecke
2016-10-06 21:22 ` [PATCH 06/19] HID: wacom: generic: Add support for height, tilt, and twist usages Jason Gerecke
2016-10-06 21:22 ` [PATCH 07/19] HID: wacom: generic: Support and use 'Custom HID' mode and usages Jason Gerecke
2016-10-06 21:22 ` [PATCH 08/19] HID: wacom: generic: Add support for vendor-defined "Distance" usage Jason Gerecke
2016-10-06 21:22 ` [PATCH 09/19] HID: wacom: generic: Add support for vendor-defined "Fingerwheel" usage Jason Gerecke
2016-10-06 21:22 ` [PATCH 10/19] HID: wacom: generic: Add support for vendor-defined "Sense" usage Jason Gerecke
2016-10-06 21:22 ` [PATCH 11/19] HID: wacom: Read and internally use corrected Intuos tool IDs Jason Gerecke
2016-10-06 21:22 ` [PATCH 12/19] HID: wacom: generic: Support tool ID and additional tool types Jason Gerecke
2016-10-06 21:22 ` [PATCH 13/19] HID: wacom: generic: Pass 'hdev' to 'wacom_map_usage' Jason Gerecke
2016-10-07 15:46 ` Benjamin Tissoires [this message]
2016-10-07 20:53 ` Jason Gerecke
2016-10-06 21:22 ` [PATCH 14/19] HID: wacom: Fix sensor outbounds and redefine as offsets from each edge Jason Gerecke
2016-10-06 21:22 ` [PATCH 15/19] HID: wacom: generic: Add support for sensor offsets Jason Gerecke
2016-10-06 21:22 ` [PATCH 16/19] HID: wacom: generic: Introduce pad support Jason Gerecke
2016-10-06 21:22 ` [PATCH 17/19] HID: wacom: generic: Add support for battery status on pen and pad interfaces Jason Gerecke
2016-10-06 21:22 ` [PATCH 18/19] HID: wacom: generic: Extend pad support Jason Gerecke
2016-10-06 21:22 ` [PATCH 19/19] HID: input: Recognize ABS_WHEEL in hidinput_calc_abs_res Jason Gerecke
2016-10-07 15:41 ` [PATCH 00/19] HID: wacom: Add support for MobileStudio Pro Benjamin Tissoires
2016-10-07 22:16 ` [PATCH v2 01/18] HID: wacom: Update vendor-defined usage names to better match standards Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 02/18] HID: wacom: Have WACOM_PEN_FIELD and WACOM_FINGER_FIELD recgonize more fields Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 03/18] HID: wacom: Refactor button-to-key translation into function Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 04/18] HID: wacom: Detect and correct descriptors missing HID_DG_BARRELSWITCH2 Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 05/18] HID: wacom: generic: Strip off excessive name prefixing Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 06/18] HID: wacom: generic: Add support for height, tilt, and twist usages Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 07/18] HID: wacom: generic: Support and use 'Custom HID' mode and usages Jason Gerecke
2016-10-18 15:26 ` Jiri Kosina
2016-10-18 17:09 ` Jason Gerecke
2016-10-18 21:39 ` Jiri Kosina
2016-10-20 1:04 ` Jason Gerecke
2016-10-20 8:32 ` Jiri Kosina
2016-10-07 22:16 ` [PATCH v2 08/18] HID: wacom: generic: Add support for vendor-defined "Distance" usage Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 09/18] HID: wacom: generic: Add support for vendor-defined "Fingerwheel" usage Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 10/18] HID: wacom: generic: Add support for vendor-defined "Sense" usage Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 11/18] HID: wacom: Read and internally use corrected Intuos tool IDs Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 12/18] HID: wacom: generic: Support tool ID and additional tool types Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 13/18] HID: wacom: Fix sensor outbounds and redefine as offsets from each edge Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 14/18] HID: wacom: generic: Add support for sensor offsets Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 15/18] HID: wacom: generic: Introduce pad support Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 16/18] HID: wacom: generic: Add support for battery status on pen and pad interfaces Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 17/18] HID: wacom: generic: Extend pad support Jason Gerecke
2016-10-07 22:16 ` [PATCH v2 18/18] HID: input: Recognize ABS_WHEEL in hidinput_calc_abs_res Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 01/18] HID: wacom: Update vendor-defined usage names to better match standards Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 02/18] HID: wacom: Have WACOM_PEN_FIELD and WACOM_FINGER_FIELD recgonize more fields Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 03/18] HID: wacom: Refactor button-to-key translation into function Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 04/18] HID: wacom: Detect and correct descriptors missing HID_DG_BARRELSWITCH2 Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 05/18] HID: wacom: generic: Strip off excessive name prefixing Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 06/18] HID: wacom: generic: Add support for height, tilt, and twist usages Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 07/18] HID: wacom: generic: Support and use 'Custom HID' mode and usages Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 08/18] HID: wacom: generic: Add support for vendor-defined "Distance" usage Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 09/18] HID: wacom: generic: Add support for vendor-defined "Fingerwheel" usage Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 10/18] HID: wacom: generic: Add support for vendor-defined "Sense" usage Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 11/18] HID: wacom: Read and internally use corrected Intuos tool IDs Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 12/18] HID: wacom: generic: Support tool ID and additional tool types Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 13/18] HID: wacom: Fix sensor outbounds and redefine as offsets from each edge Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 14/18] HID: wacom: generic: Add support for sensor offsets Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 15/18] HID: wacom: generic: Introduce pad support Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 16/18] HID: wacom: generic: Add support for battery status on pen and pad interfaces Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 17/18] HID: wacom: generic: Extend pad support Jason Gerecke
2016-10-20 1:03 ` [PATCH v3 18/18] HID: input: Recognize ABS_WHEEL in hidinput_calc_abs_res Jason Gerecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161007154655.GB30411@mail.corp.redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=jason.gerecke@wacom.com \
--cc=jkosina@suse.cz \
--cc=killertofu@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=ping.cheng@wacom.com \
--cc=pinglinux@gmail.com \
--cc=skomra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).