* [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12.
@ 2014-07-11 21:35 Andrew Duggan
2014-07-11 21:35 ` [PATCH] HID: rmi: change logging level of log messages related to unexpected reports Andrew Duggan
2014-07-15 19:07 ` [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Benjamin Tissoires
0 siblings, 2 replies; 6+ messages in thread
From: Andrew Duggan @ 2014-07-11 21:35 UTC (permalink / raw)
To: linux-input, linux-kernel; +Cc: Andrew Duggan, Jiri Kosina, Benjamin Tissoires
There are additional queries which are optional and may not be present depending on the configuration of the firmware. Knowing which queries are present is needed to properly compute the address of Query 12 and all subsequent queries. Additional bits in Query 1 are used to indicate the presence of these optional queries.
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
---
drivers/hid/hid-rmi.c | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 578bbe6..3221a95 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -549,10 +549,12 @@ static int rmi_populate_f11(struct hid_device *hdev)
u8 buf[20];
int ret;
bool has_query9;
- bool has_query10;
+ bool has_query10 = false;
bool has_query11;
bool has_query12;
bool has_physical_props;
+ bool has_gestures;
+ bool has_rel;
unsigned x_size, y_size;
u16 query12_offset;
@@ -589,19 +591,32 @@ static int rmi_populate_f11(struct hid_device *hdev)
return -ENODEV;
}
- /* query 8 to find out if query 10 exists */
- ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf);
- if (ret) {
- hid_err(hdev, "can not read gesture information: %d.\n", ret);
- return ret;
+ has_rel = !!(buf[0] & BIT(3));
+ has_gestures = !!(buf[0] & BIT(5));
+
+ if (has_gestures) {
+ /* query 8 to find out if query 10 exists */
+ ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf);
+ if (ret) {
+ hid_err(hdev, "can not read gesture information: %d.\n",
+ ret);
+ return ret;
+ }
+ has_query10 = !!(buf[0] & BIT(2));
}
- has_query10 = !!(buf[0] & BIT(2));
/*
- * At least 8 queries are guaranteed to be present in F11
- * +1 for query12.
+ * At least 4 queries are guaranteed to be present in F11
+ * +1 for query 5 which is present since absolute events are
+ * reported and +1 for query 12.
*/
- query12_offset = 9;
+ query12_offset = 6;
+
+ if (has_rel)
+ ++query12_offset; /* query 6 is present */
+
+ if (has_gestures)
+ query12_offset += 2; /* query 7 and 8 are present */
if (has_query9)
++query12_offset;
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] HID: rmi: change logging level of log messages related to unexpected reports
2014-07-11 21:35 [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Andrew Duggan
@ 2014-07-11 21:35 ` Andrew Duggan
2014-07-15 19:07 ` Benjamin Tissoires
2014-07-15 19:07 ` [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Benjamin Tissoires
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Duggan @ 2014-07-11 21:35 UTC (permalink / raw)
To: linux-input, linux-kernel
Cc: Andrew Duggan, Jiri Kosina, Benjamin Tissoires
Userspace tools may use hidraw to perform operations on the device from userspace while
hid-rmi is bound to the device. This can cause hid-rmi to print error messages when its
->raw_event() callback gets called as the reports pass through the HID stack. In this case
receiving responses which were not initiated by hid-rmi is not actually an error so the resulting
error messages are incorrect and misleading. This patch changes the log messages to debug so
that the messages can be turned on in the event that there is a problem and there is not
a userspace tool running.
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
---
drivers/hid/hid-rmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 578bbe6..25f571a 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -377,7 +377,7 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)
irq_mask |= hdata->f30.irq_mask;
if (data[1] & ~irq_mask)
- hid_warn(hdev, "unknown intr source:%02lx %s:%d\n",
+ hid_dbg(hdev, "unknown intr source:%02lx %s:%d\n",
data[1] & ~irq_mask, __FILE__, __LINE__);
if (hdata->f11.interrupt_base < hdata->f30.interrupt_base) {
@@ -400,7 +400,7 @@ static int rmi_read_data_event(struct hid_device *hdev, u8 *data, int size)
struct rmi_data *hdata = hid_get_drvdata(hdev);
if (!test_bit(RMI_READ_REQUEST_PENDING, &hdata->flags)) {
- hid_err(hdev, "no read request pending\n");
+ hid_dbg(hdev, "no read request pending\n");
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12.
2014-07-11 21:35 [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Andrew Duggan
2014-07-11 21:35 ` [PATCH] HID: rmi: change logging level of log messages related to unexpected reports Andrew Duggan
@ 2014-07-15 19:07 ` Benjamin Tissoires
2014-07-29 9:10 ` Jiri Kosina
1 sibling, 1 reply; 6+ messages in thread
From: Benjamin Tissoires @ 2014-07-15 19:07 UTC (permalink / raw)
To: Andrew Duggan; +Cc: linux-input, linux-kernel, Jiri Kosina
On Jul 11 2014 or thereabouts, Andrew Duggan wrote:
> There are additional queries which are optional and may not be present depending on the configuration of the firmware. Knowing which queries are present is needed to properly compute the address of Query 12 and all subsequent queries. Additional bits in Query 1 are used to indicate the presence of these optional queries.
>
> Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> ---
Looks good to me
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cheers,
Benjamin
> drivers/hid/hid-rmi.c | 35 +++++++++++++++++++++++++----------
> 1 file changed, 25 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 578bbe6..3221a95 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -549,10 +549,12 @@ static int rmi_populate_f11(struct hid_device *hdev)
> u8 buf[20];
> int ret;
> bool has_query9;
> - bool has_query10;
> + bool has_query10 = false;
> bool has_query11;
> bool has_query12;
> bool has_physical_props;
> + bool has_gestures;
> + bool has_rel;
> unsigned x_size, y_size;
> u16 query12_offset;
>
> @@ -589,19 +591,32 @@ static int rmi_populate_f11(struct hid_device *hdev)
> return -ENODEV;
> }
>
> - /* query 8 to find out if query 10 exists */
> - ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf);
> - if (ret) {
> - hid_err(hdev, "can not read gesture information: %d.\n", ret);
> - return ret;
> + has_rel = !!(buf[0] & BIT(3));
> + has_gestures = !!(buf[0] & BIT(5));
> +
> + if (has_gestures) {
> + /* query 8 to find out if query 10 exists */
> + ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf);
> + if (ret) {
> + hid_err(hdev, "can not read gesture information: %d.\n",
> + ret);
> + return ret;
> + }
> + has_query10 = !!(buf[0] & BIT(2));
> }
> - has_query10 = !!(buf[0] & BIT(2));
>
> /*
> - * At least 8 queries are guaranteed to be present in F11
> - * +1 for query12.
> + * At least 4 queries are guaranteed to be present in F11
> + * +1 for query 5 which is present since absolute events are
> + * reported and +1 for query 12.
> */
> - query12_offset = 9;
> + query12_offset = 6;
> +
> + if (has_rel)
> + ++query12_offset; /* query 6 is present */
> +
> + if (has_gestures)
> + query12_offset += 2; /* query 7 and 8 are present */
>
> if (has_query9)
> ++query12_offset;
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] HID: rmi: change logging level of log messages related to unexpected reports
2014-07-11 21:35 ` [PATCH] HID: rmi: change logging level of log messages related to unexpected reports Andrew Duggan
@ 2014-07-15 19:07 ` Benjamin Tissoires
2014-07-29 9:10 ` Jiri Kosina
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Tissoires @ 2014-07-15 19:07 UTC (permalink / raw)
To: Andrew Duggan; +Cc: linux-input, linux-kernel, Jiri Kosina
On Jul 11 2014 or thereabouts, Andrew Duggan wrote:
> Userspace tools may use hidraw to perform operations on the device from userspace while
> hid-rmi is bound to the device. This can cause hid-rmi to print error messages when its
> ->raw_event() callback gets called as the reports pass through the HID stack. In this case
> receiving responses which were not initiated by hid-rmi is not actually an error so the resulting
> error messages are incorrect and misleading. This patch changes the log messages to debug so
> that the messages can be turned on in the event that there is a problem and there is not
> a userspace tool running.
>
> Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> ---
Fair enough
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cheers,
Benjamin
> drivers/hid/hid-rmi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 578bbe6..25f571a 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -377,7 +377,7 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)
> irq_mask |= hdata->f30.irq_mask;
>
> if (data[1] & ~irq_mask)
> - hid_warn(hdev, "unknown intr source:%02lx %s:%d\n",
> + hid_dbg(hdev, "unknown intr source:%02lx %s:%d\n",
> data[1] & ~irq_mask, __FILE__, __LINE__);
>
> if (hdata->f11.interrupt_base < hdata->f30.interrupt_base) {
> @@ -400,7 +400,7 @@ static int rmi_read_data_event(struct hid_device *hdev, u8 *data, int size)
> struct rmi_data *hdata = hid_get_drvdata(hdev);
>
> if (!test_bit(RMI_READ_REQUEST_PENDING, &hdata->flags)) {
> - hid_err(hdev, "no read request pending\n");
> + hid_dbg(hdev, "no read request pending\n");
> return 0;
> }
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] HID: rmi: change logging level of log messages related to unexpected reports
2014-07-15 19:07 ` Benjamin Tissoires
@ 2014-07-29 9:10 ` Jiri Kosina
0 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2014-07-29 9:10 UTC (permalink / raw)
To: Benjamin Tissoires ; +Cc: Andrew Duggan, linux-input, linux-kernel
On Tue, 15 Jul 2014, Benjamin Tissoires wrote:
> On Jul 11 2014 or thereabouts, Andrew Duggan wrote:
> > Userspace tools may use hidraw to perform operations on the device from userspace while
> > hid-rmi is bound to the device. This can cause hid-rmi to print error messages when its
> > ->raw_event() callback gets called as the reports pass through the HID stack. In this case
> > receiving responses which were not initiated by hid-rmi is not actually an error so the resulting
> > error messages are incorrect and misleading. This patch changes the log messages to debug so
> > that the messages can be turned on in the event that there is a problem and there is not
> > a userspace tool running.
> >
> > Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> > ---
>
> Fair enough
>
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
[ sorry for late response, I am just re-appearing from vacation-land ]
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12.
2014-07-15 19:07 ` [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Benjamin Tissoires
@ 2014-07-29 9:10 ` Jiri Kosina
0 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2014-07-29 9:10 UTC (permalink / raw)
To: Benjamin Tissoires; +Cc: Andrew Duggan, linux-input, linux-kernel
On Tue, 15 Jul 2014, Benjamin Tissoires wrote:
> On Jul 11 2014 or thereabouts, Andrew Duggan wrote:
> > There are additional queries which are optional and may not be present depending on the configuration of the firmware. Knowing which queries are present is needed to properly compute the address of Query 12 and all subsequent queries. Additional bits in Query 1 are used to indicate the presence of these optional queries.
> >
> > Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> > ---
>
> Looks good to me
>
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Applied.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-29 9:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11 21:35 [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Andrew Duggan
2014-07-11 21:35 ` [PATCH] HID: rmi: change logging level of log messages related to unexpected reports Andrew Duggan
2014-07-15 19:07 ` Benjamin Tissoires
2014-07-29 9:10 ` Jiri Kosina
2014-07-15 19:07 ` [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Benjamin Tissoires
2014-07-29 9:10 ` Jiri Kosina
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).