* [PATCH] HID: ntrig: use input_configured() callback to set the name
@ 2013-02-08 14:51 Benjamin Tissoires
2013-02-18 2:38 ` Rafi Rubin
2013-02-20 20:33 ` Henrik Rydberg
0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2013-02-08 14:51 UTC (permalink / raw)
To: Benjamin Tissoires, Rafi Rubin, Henrik Rydberg, Jiri Kosina,
Stephane Chatty, linux-input, linux-kernel
The use of input_configured() allows the ntrig driver to actually
change the name of the input and its bitmask before it is added to the
input subsystem. Thus, the logs are coherents and udev catch the real
bitmask when the device is added.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
---
drivers/hid/hid-ntrig.c | 68 ++++++++++++++++++++++++-------------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 2ffc0e3..7757e82 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -858,12 +858,43 @@ not_claimed_input:
return 1;
}
+static void ntrig_input_configured(struct hid_device *hid,
+ struct hid_input *hidinput)
+
+{
+ struct input_dev *input = hidinput->input;
+
+ if (hidinput->report->maxfield < 1)
+ return;
+
+ switch (hidinput->report->field[0]->application) {
+ case HID_DG_PEN:
+ input->name = "N-Trig Pen";
+ break;
+ case HID_DG_TOUCHSCREEN:
+ /* These keys are redundant for fingers, clear them
+ * to prevent incorrect identification */
+ __clear_bit(BTN_TOOL_PEN, input->keybit);
+ __clear_bit(BTN_TOOL_FINGER, input->keybit);
+ __clear_bit(BTN_0, input->keybit);
+ __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
+ /*
+ * The physical touchscreen (single touch)
+ * input has a value for physical, whereas
+ * the multitouch only has logical input
+ * fields.
+ */
+ input->name = (hidinput->report->field[0]->physical) ?
+ "N-Trig Touchscreen" :
+ "N-Trig MultiTouch";
+ break;
+ }
+}
+
static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
struct ntrig_data *nd;
- struct hid_input *hidinput;
- struct input_dev *input;
struct hid_report *report;
if (id->driver_data)
@@ -901,38 +932,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
goto err_free;
}
-
- list_for_each_entry(hidinput, &hdev->inputs, list) {
- if (hidinput->report->maxfield < 1)
- continue;
-
- input = hidinput->input;
- switch (hidinput->report->field[0]->application) {
- case HID_DG_PEN:
- input->name = "N-Trig Pen";
- break;
- case HID_DG_TOUCHSCREEN:
- /* These keys are redundant for fingers, clear them
- * to prevent incorrect identification */
- __clear_bit(BTN_TOOL_PEN, input->keybit);
- __clear_bit(BTN_TOOL_FINGER, input->keybit);
- __clear_bit(BTN_0, input->keybit);
- __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
- /*
- * The physical touchscreen (single touch)
- * input has a value for physical, whereas
- * the multitouch only has logical input
- * fields.
- */
- input->name =
- (hidinput->report->field[0]
- ->physical) ?
- "N-Trig Touchscreen" :
- "N-Trig MultiTouch";
- break;
- }
- }
-
/* This is needed for devices with more recent firmware versions */
report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
if (report) {
@@ -1023,6 +1022,7 @@ static struct hid_driver ntrig_driver = {
.remove = ntrig_remove,
.input_mapping = ntrig_input_mapping,
.input_mapped = ntrig_input_mapped,
+ .input_configured = ntrig_input_configured,
.usage_table = ntrig_grabbed_usages,
.event = ntrig_event,
};
--
1.8.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: ntrig: use input_configured() callback to set the name
2013-02-08 14:51 [PATCH] HID: ntrig: use input_configured() callback to set the name Benjamin Tissoires
@ 2013-02-18 2:38 ` Rafi Rubin
2013-02-18 9:17 ` Jiri Kosina
2013-02-20 20:33 ` Henrik Rydberg
1 sibling, 1 reply; 4+ messages in thread
From: Rafi Rubin @ 2013-02-18 2:38 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Henrik Rydberg, Jiri Kosina, Stephane Chatty, linux-input,
linux-kernel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Looks good, and I can confirm it works fine.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
On 02/08/13 09:51, Benjamin Tissoires wrote:
> The use of input_configured() allows the ntrig driver to actually
> change the name of the input and its bitmask before it is added to
> the input subsystem. Thus, the logs are coherents and udev catch
> the real bitmask when the device is added.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
> --- drivers/hid/hid-ntrig.c | 68
> ++++++++++++++++++++++++------------------------- 1 file changed,
> 34 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
> index 2ffc0e3..7757e82 100644 --- a/drivers/hid/hid-ntrig.c +++
> b/drivers/hid/hid-ntrig.c @@ -858,12 +858,43 @@ not_claimed_input:
> return 1; }
>
> +static void ntrig_input_configured(struct hid_device *hid, +
> struct hid_input *hidinput) + +{ + struct input_dev *input =
> hidinput->input; + + if (hidinput->report->maxfield < 1) +
> return; + + switch (hidinput->report->field[0]->application) { +
> case HID_DG_PEN: + input->name = "N-Trig Pen"; + break; + case
> HID_DG_TOUCHSCREEN: + /* These keys are redundant for fingers,
> clear them + * to prevent incorrect identification */ +
> __clear_bit(BTN_TOOL_PEN, input->keybit); +
> __clear_bit(BTN_TOOL_FINGER, input->keybit); + __clear_bit(BTN_0,
> input->keybit); + __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); +
> /* + * The physical touchscreen (single touch) + * input has a
> value for physical, whereas + * the multitouch only has logical
> input + * fields. + */ + input->name =
> (hidinput->report->field[0]->physical) ? + "N-Trig
> Touchscreen" : + "N-Trig MultiTouch"; + break; + } +} +
> static int ntrig_probe(struct hid_device *hdev, const struct
> hid_device_id *id) { int ret; struct ntrig_data *nd; - struct
> hid_input *hidinput; - struct input_dev *input; struct hid_report
> *report;
>
> if (id->driver_data) @@ -901,38 +932,6 @@ static int
> ntrig_probe(struct hid_device *hdev, const struct hid_device_id
> *id) goto err_free; }
>
> - - list_for_each_entry(hidinput, &hdev->inputs, list) { - if
> (hidinput->report->maxfield < 1) - continue; - - input =
> hidinput->input; - switch
> (hidinput->report->field[0]->application) { - case HID_DG_PEN: -
> input->name = "N-Trig Pen"; - break; - case HID_DG_TOUCHSCREEN:
> - /* These keys are redundant for fingers, clear them - * to
> prevent incorrect identification */ - __clear_bit(BTN_TOOL_PEN,
> input->keybit); - __clear_bit(BTN_TOOL_FINGER, input->keybit); -
> __clear_bit(BTN_0, input->keybit); -
> __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); - /* - * The
> physical touchscreen (single touch) - * input has a value for
> physical, whereas - * the multitouch only has logical input -
> * fields. - */ - input->name = -
> (hidinput->report->field[0] - ->physical) ? - "N-Trig
> Touchscreen" : - "N-Trig MultiTouch"; - break; - } - } - /*
> This is needed for devices with more recent firmware versions */
> report =
> hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a]; if
> (report) { @@ -1023,6 +1022,7 @@ static struct hid_driver
> ntrig_driver = { .remove = ntrig_remove, .input_mapping =
> ntrig_input_mapping, .input_mapped = ntrig_input_mapped, +
> .input_configured = ntrig_input_configured, .usage_table =
> ntrig_grabbed_usages, .event = ntrig_event, };
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJRIZQxAAoJEPILXytRLnK26REP+weeAIqA4kfDn+tWqFOXIbcL
u65bkvNQmlEqx/mUeO7i7+tOsgTJnKpMy3ec5zsfyZd5DKs2yc3DTvrNXZbnqumZ
NkUYe7+aob1ge4+edJKw9nWDHp2E1sCm7VDNXVcEUTQN1ntMp/BjMenhDjgWhXVw
/3meslXrD3TOvXx/FzDLzJdV1WdBPeOHTHZq/yxsI3Z5jWCFba/Xz1CHc62sd2Og
hRTe9CthK3Hq9EQJXOc8qSBgNkhQ6XtBZb7KTw7FXAyKH3htus6t3c57ZPqGUUER
i6rasUYs3QGQQDG3tEU4wnWEtkS0i+9SO9L8tkUJwTKmdn7rDd5oAwovwMghkEkb
L1+tKL8EamC1oD8CMfHa7zCOTlkfTT0eRJiyHIErWpxn+VQxx2fpR7/MS2fF9n60
ecNGCRGrQo1UvIpYHmmGfigptcp6kyDgl8H9KBjafbQI5OWrJanwPi3aIXYhZmo8
XLjqCRJfgeJKFZD3mTdgqKL0hpNldskNUUauFD5GJblAB3UQ/MZ5Nmm+hWi3Y7y2
e0zxkPzw1puBFNNA06KLUNJ1DyibBZTPua1h36bD+OtqcRXIi8cdMHVf7bZhWSUK
ePVxgYjbgybAh4gMTgRQP/ucEuc6eDHGQ6MRe16ezwk3+fvUiLPntAtTXro1e3ck
nN0+r/NQSn7PKOdCqgeF
=ltkV
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: ntrig: use input_configured() callback to set the name
2013-02-18 2:38 ` Rafi Rubin
@ 2013-02-18 9:17 ` Jiri Kosina
0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2013-02-18 9:17 UTC (permalink / raw)
To: Rafi Rubin
Cc: Benjamin Tissoires, Henrik Rydberg, Stephane Chatty, linux-input,
linux-kernel
On Sun, 17 Feb 2013, Rafi Rubin wrote:
> Looks good, and I can confirm it works fine.
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: ntrig: use input_configured() callback to set the name
2013-02-08 14:51 [PATCH] HID: ntrig: use input_configured() callback to set the name Benjamin Tissoires
2013-02-18 2:38 ` Rafi Rubin
@ 2013-02-20 20:33 ` Henrik Rydberg
1 sibling, 0 replies; 4+ messages in thread
From: Henrik Rydberg @ 2013-02-20 20:33 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Rafi Rubin, Jiri Kosina, Stephane Chatty, linux-input,
linux-kernel
On Fri, Feb 08, 2013 at 03:51:30PM +0100, Benjamin Tissoires wrote:
> The use of input_configured() allows the ntrig driver to actually
> change the name of the input and its bitmask before it is added to the
> input subsystem. Thus, the logs are coherents and udev catch the real
> bitmask when the device is added.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
> ---
> drivers/hid/hid-ntrig.c | 68 ++++++++++++++++++++++++-------------------------
> 1 file changed, 34 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
> index 2ffc0e3..7757e82 100644
> --- a/drivers/hid/hid-ntrig.c
> +++ b/drivers/hid/hid-ntrig.c
> @@ -858,12 +858,43 @@ not_claimed_input:
> return 1;
> }
>
> +static void ntrig_input_configured(struct hid_device *hid,
> + struct hid_input *hidinput)
> +
> +{
> + struct input_dev *input = hidinput->input;
> +
> + if (hidinput->report->maxfield < 1)
> + return;
> +
> + switch (hidinput->report->field[0]->application) {
> + case HID_DG_PEN:
> + input->name = "N-Trig Pen";
> + break;
> + case HID_DG_TOUCHSCREEN:
> + /* These keys are redundant for fingers, clear them
> + * to prevent incorrect identification */
> + __clear_bit(BTN_TOOL_PEN, input->keybit);
> + __clear_bit(BTN_TOOL_FINGER, input->keybit);
> + __clear_bit(BTN_0, input->keybit);
> + __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
> + /*
> + * The physical touchscreen (single touch)
> + * input has a value for physical, whereas
> + * the multitouch only has logical input
> + * fields.
> + */
> + input->name = (hidinput->report->field[0]->physical) ?
> + "N-Trig Touchscreen" :
> + "N-Trig MultiTouch";
> + break;
> + }
> +}
> +
> static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
> {
> int ret;
> struct ntrig_data *nd;
> - struct hid_input *hidinput;
> - struct input_dev *input;
> struct hid_report *report;
>
> if (id->driver_data)
> @@ -901,38 +932,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
> goto err_free;
> }
>
> -
> - list_for_each_entry(hidinput, &hdev->inputs, list) {
> - if (hidinput->report->maxfield < 1)
> - continue;
> -
> - input = hidinput->input;
> - switch (hidinput->report->field[0]->application) {
> - case HID_DG_PEN:
> - input->name = "N-Trig Pen";
> - break;
> - case HID_DG_TOUCHSCREEN:
> - /* These keys are redundant for fingers, clear them
> - * to prevent incorrect identification */
> - __clear_bit(BTN_TOOL_PEN, input->keybit);
> - __clear_bit(BTN_TOOL_FINGER, input->keybit);
> - __clear_bit(BTN_0, input->keybit);
> - __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
> - /*
> - * The physical touchscreen (single touch)
> - * input has a value for physical, whereas
> - * the multitouch only has logical input
> - * fields.
> - */
> - input->name =
> - (hidinput->report->field[0]
> - ->physical) ?
> - "N-Trig Touchscreen" :
> - "N-Trig MultiTouch";
> - break;
> - }
> - }
> -
> /* This is needed for devices with more recent firmware versions */
> report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
> if (report) {
> @@ -1023,6 +1022,7 @@ static struct hid_driver ntrig_driver = {
> .remove = ntrig_remove,
> .input_mapping = ntrig_input_mapping,
> .input_mapped = ntrig_input_mapped,
> + .input_configured = ntrig_input_configured,
> .usage_table = ntrig_grabbed_usages,
> .event = ntrig_event,
> };
> --
> 1.8.1
>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Thanks,
Henrik
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-20 20:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-08 14:51 [PATCH] HID: ntrig: use input_configured() callback to set the name Benjamin Tissoires
2013-02-18 2:38 ` Rafi Rubin
2013-02-18 9:17 ` Jiri Kosina
2013-02-20 20:33 ` Henrik Rydberg
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).