HID: input: Finish TransducerSerialNumber implementation
PATCH 1/1 HID: input: Finish TransducerSerialNumber implementation
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the code to send a MSC_SERIAL event to userspace when this usage is seen in a report is nowhere to be found. This commit addresses both issues.
--- drivers/hid/hid-input.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hid/hid-input.c +9 -0
@@ -690,6 +690,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase 0x5b :/* TransducerSerialNumber */ set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;default : goto unknown;
@@ -1041,6 +1045,11 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, structinput_event (input,EV_KEY ,BTN_TOUCH , value > a + ((b - a) >>3 )); } +if (usage->hid == (HID_UP_DIGITIZER |0x005b )) {/* TransducerSerialNumber */ +input_event (input,EV_MSC ,MSC_SERIAL , value); +return ; + } +if (usage->hid == (HID_UP_PID |0x83UL )) {/* Simultaneous Effects Max */ dbg_hid ("Maximum Effects - %d\n" ,value);return ;
Signature · 1 line
2.1.0
Hi Jason,
Quoted 28 lines · Jason Gerecke
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the code to send a
MSC_SERIALevent to userspace when this usage is seen in a report is nowhere to be found. This commit addresses both issues.Signed-off-by Jason Gerecke <[email protected]>--- drivers/hid/hid-input.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/hid/hid-input.c +4
-0@@ -690,6 +690,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase 0x5b :/* TransducerSerialNumber */ set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;default : goto unknown;
drivers/hid/hid-input.c void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct · line 1052
Quoted 8 lines
drivers/hid/hid-input.c +5
-0@@ -1041,6 +1045,11 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, structinput_event (input,EV_KEY ,BTN_TOUCH , value > a + ((b - a) >>3 )); } +if (usage->hid == (HID_UP_DIGITIZER |0x005b )) {/* TransducerSerialNumber */ +input_event (input,EV_MSC ,MSC_SERIAL , value); +return ; + } +
Are you sure that the generic call to
"input_event(input, usage->type, usage->code, value);" in the end of hidinput_hid_event() is not sufficient enough?
As long as the usage/code are set in the hid_usage struct, you should be fine.
Cheers,
Benjamin
Quoted 6 lines
drivers/hid/hid-input.c +0
-0if (usage->hid == (HID_UP_PID |0x83UL )) {/* Simultaneous Effects Max */ dbg_hid ("Maximum Effects - %d\n" ,value);return ;Signature · 1 line
2.1.0
Quoted 58 lines
-----Original Message-----
From: Benjamin Tissoires [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 8:12 AM
To: Jason Gerecke
Cc: [email protected]; [email protected]; [email protected]; Jason Gerecke
Subject: Re: [PATCH] HID: input: Finish TransducerSerialNumber implementationHi Jason,
Quoted 6 lines · Jason Gerecke
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the code to send a
MSC_SERIALevent to userspace when this usage is seen in a report is nowhere to be found. This commitaddresses both issues.
drivers/hid/hid-input.c void hidinput_hid_event(struct hid_device *hid,
Quoted 23 lines
Signed-off-by Jason Gerecke <[email protected]>--- drivers/hid/hid-input.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/hid/hid-input.c index renamed from drivers/hid/hid-input.c +0
-02619f7f..abed624 100644
drivers/hid/hid-input.c +0
-0@@ -690,6 +690,10 @@ static void hidinput_configure_usage(struct
hid_input*hidinput, structhid_fieldrivers/hid/hid-input.c +4
-0case 0x5b :/* TransducerSerialNumber */ set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;default : goto unknown;@@ -1041,6 +1045,11 @@ void hidinput_hid_event(struct hid_device *hid,struct
hid_field*field, structdrivers/hid/hid-input.c void hidinput_hid_event(struct hid_device *hid, · line 1049
Quoted 5 lines
drivers/hid/hid-input.c +1
-0input_event (input,EV_KEY ,BTN_TOUCH , value > a + ((b - a) >3 )); } +if (usage->hid == (HID_UP_DIGITIZER |0x005b )) {/* TransducerSerialNumber */
drivers/hid/hid-input.c void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct · line 1052
Quoted 4 lines
drivers/hid/hid-input.c +4
-0+input_event (input,EV_MSC ,MSC_SERIAL , value); +return ; + } +Are you sure that the generic call to
"input_event(input, usage->type, usage->code, value);" in the end ofhidinput_hid_event()is not sufficient enough?
Quoted 5 lines
As long as the usage/code are set in the
hid_usagestruct, you should be fine.Cheers,
Benjamin
Hmmm... This might be an issue with the HID descriptor, actually. It looks like my hardware doesn't set the logical minimum and maximum for the field, so the (quite out-of-range) value is ignored. I start seeing data after patching the descriptor to add these in, but the code is set to MSC_PULSELED instead of MSC_SERIAL. I suspect that the existing call to 'set_bit' in the TransducerSerialNumber case is to blame (which makes it act like 'map_foo' instead of 'map_foo_clear').
Updated patch forthcoming...
Jason
Quoted 7 lines
drivers/hid/hid-input.c void hidinput_hid_event(struct hid_device *hid, · line 1054
Quoted 1 line
drivers/hid/hid-input.c +0
-0if (usage->hid == (HID_UP_PID |0x83UL )) {/* Simultaneous Effects Max */
Quoted 5 lines
drivers/hid/hid-input.c +0
-0dbg_hid ("Maximum Effects - %d\n" ,value);return;
--
2.1.0
A message that is not in the archive (sent off-list or not yet received): Message-ID: <[email protected]
PATCH 1/1 HID: input: Fix TransducerSerialNumber implementation
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the call to 'set_bit' causes MSC_PULSELED to be sent instead of the expected MSC_SERIAL. This commit addreses both issues.
--- drivers/hid/hid-input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-input.c +4 -1
@@ -689,7 +689,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielbreak ;case 0x5b :/* TransducerSerialNumber */ -set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;default : goto unknown;
Signature · 1 line
2.1.0
Re: [PATCH] HID: input: Fix TransducerSerialNumber implementation
Quoted 29 lines · Jason Gerecke
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the call to '
set_bit' causesMSC_PULSELEDto be sent instead of the expectedMSC_SERIAL. This commit addreses both issues.Signed-off-by Jason Gerecke <[email protected]>--- drivers/hid/hid-input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/hid/hid-input.c +4
-2@@ -689,7 +689,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielbreak ;case 0x5b :/* TransducerSerialNumber */ -set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;default : goto unknown; --
Quoted 2 lines
2.1.0
This patch still seems to be in limbo. Anyone (Ping? Benjamin?) care to provide an ACK or review?
Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Benjamin Tissoires
Reviewed-byRe: [PATCH] HID: input: Fix TransducerSerialNumber implementation
Quoted 28 lines · Jason Gerecke
Quoted 27 lines · Jason Gerecke
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the call to '
set_bit' causesMSC_PULSELEDto be sent instead of the expectedMSC_SERIAL. This commit addreses both issues.Signed-off-by Jason Gerecke <[email protected]>--- drivers/hid/hid-input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/hid/hid-input.c +4
-1@@ -689,7 +689,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielbreak ;case 0x5b :/* TransducerSerialNumber */ -set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;
Quoted 8 lines
Quoted 4 lines
drivers/hid/hid-input.c +0
-1default : goto unknown; --2.1.0
This patch still seems to be in limbo. Anyone (Ping? Benjamin?) care to provide an ACK or review?
Sorry for that, I was persuaded I already have answered to this one.
The patch makes sense, but I think it will be better to extend hid_map_usage() with MSC bits and define map_msc_clear(). The code will be more consistent with the rest this way.
Anyway, if Jiri does not find this to be mandatory, then this code is:
Cheers,
Benjamin
A message that is not in the archive (sent off-list or not yet received): CAF8JNhKYmBpgp4yRvQbxuaAPSk5dG3YW7qqZnrBAB22bRXPEJg@mail.gmail.com
PATCH 1/1 HID: input: Fix TransducerSerialNumber implementation
Quoted 9 lines · Jason Gerecke
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the call to '
set_bit' causesMSC_PULSELEDto be sent instead of the expectedMSC_SERIAL. This commit addreses both issues.Signed-off-by Jason Gerecke <[email protected]>
Thank you, Jason, for the fix.
Ping
Quoted 23 lines
--- drivers/hid/hid-input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/hid/hid-input.c +4
-2@@ -689,7 +689,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielbreak ;case 0x5b :/* TransducerSerialNumber */ -set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;default : goto unknown; --2.1.0
Re: [PATCH] HID: input: Fix TransducerSerialNumber implementation
In reply to Jason GereckeQuoted 17 lines · Jason Gerecke
The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the call to '
set_bit' causesMSC_PULSELEDto be sent instead of the expectedMSC_SERIAL. This commit addreses both issues.Signed-off-by Jason Gerecke <[email protected]>--- drivers/hid/hid-input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/hid/hid-input.c +0
-0
drivers/hid/hid-input.c static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · line 697
Quoted 10 lines
drivers/hid/hid-input.c +4
-1@@ -689,7 +689,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielbreak ;case 0x5b :/* TransducerSerialNumber */ -set_bit (MSC_SERIAL , input->mscbit); + usage->type =EV_MSC ; + usage->code =MSC_SERIAL ; + bit = input->mscbit; + max =MSC_MAX ;break ;
Apologizes for the delay. I have now queued this for 3.18 still.
Signature · 2 lines
Jiri Kosina SUSE Labs