HID: sensor-hub: Enable hid core report processing for all devices
Subsystems (3)
PATCH 1/1 HID: sensor-hub: Enable hid core report processing for all devices
After the commit 666cf30a589a ("HID: sensor-hub: Allow multi-function sensor devices") hub devices are claimed by hidraw driver in hid_connect(). This causes stoppping of processing HID reports by hid core due to optimization.
In such case, the hid-sensor-custom driver cannot match a known custom sensor in hid_sensor_custom_get_known() because it try to check custom properties which weren't filled from the report because hid core didn't parsed it.
As result, custom sensors like hinge angle sensor and LISS sensors don't work.
Mark the sensor hub devices claimed by some driver to avoid hidraw-related optimizations.
--- drivers/hid/hid-sensor-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +1 -1
@@ -632,7 +632,7 @@ static int sensor_hub_probe(struct hid_device *hdev, }INIT_LIST_HEAD (&hdev->inputs); - ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT |HID_CONNECT_DRIVER );if (ret) {hid_err (hdev,"hw start failed\n" );return ret;
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerQuoted 10 lines · On Wed, 20 Dec 2023 01:15:03 +0200 Yauhen Kharuzhy <[email protected]> wrote:
After the commit
666cf30a589a("HID: sensor-hub: Allow multi-function sensor devices") hub devices are claimed by hidraw driver inhid_connect(). This causes stoppping of processing HID reports by hid core due to optimization.In such case, the hid-sensor-custom driver cannot match a known custom sensor in
hid_sensor_custom_get_known()because it try to check custom properties which weren't filled from the report because hid core didn't parsed it.
Quoted 7 lines
As result, custom sensors like hinge angle sensor and LISS sensors don't work.
Mark the sensor hub devices claimed by some driver to avoid hidraw-related optimizations.
Signed-off-by Yauhen Kharuzhy <[email protected]>
Fixes tag?
Quoted 17 lines
--- drivers/hid/hid-sensor-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hid/hid-sensor-hub.c +1
-1@@ -632,7 +632,7 @@ static int sensor_hub_probe(struct hid_device *hdev, }INIT_LIST_HEAD (&hdev->inputs); - ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT |HID_CONNECT_DRIVER );if (ret) {hid_err (hdev,"hw start failed\n" );return ret;
ср, 20 дек. 2023 г. в 16:52, Jonathan Cameron <[email protected]>:
Quoted 14 lines
Quoted 10 lines · On Wed, 20 Dec 2023 01:15:03 +0200 Yauhen Kharuzhy <[email protected]> wrote:
After the commit
666cf30a589a("HID: sensor-hub: Allow multi-function sensor devices") hub devices are claimed by hidraw driver inhid_connect(). This causes stoppping of processing HID reports by hid core due to optimization.In such case, the hid-sensor-custom driver cannot match a known custom sensor in
hid_sensor_custom_get_known()because it try to check custom properties which weren't filled from the report because hid core didn't parsed it.
Quoted 8 lines
Quoted 7 lines
As result, custom sensors like hinge angle sensor and LISS sensors don't work.
Mark the sensor hub devices claimed by some driver to avoid hidraw-related optimizations.
Signed-off-by Yauhen Kharuzhy <[email protected]>Fixes tag?
Quoted 19 lines
Quoted 18 lines
--- drivers/hid/hid-sensor-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hid/hid-sensor-hub.c +1
-1@@ -632,7 +632,7 @@ static int sensor_hub_probe(struct hid_device *hdev, }INIT_LIST_HEAD (&hdev->inputs); - ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT |HID_CONNECT_DRIVER );if (ret) {hid_err (hdev,"hw start failed\n" );return ret;
Signature · 1 line
Yauhen Kharuzhy
srinivas pandruvada
maintainerQuoted 29 lines · Yauhen Kharuzhy
ср, 20 дек. 2023 г. в 16:52, Jonathan Cameron <[email protected]>:
Quoted 28 lines
Quoted 24 lines · On Wed, 20 Dec 2023 01:15:03 +0200 Yauhen Kharuzhy <[email protected]> wrote:
After the commit
666cf30a589a("HID: sensor-hub: Allow multi- function
sensor devices") hub devices are claimed by hidraw driver inhid_connect().
This causes stoppping of processing HID reports by hid core due to
optimization.In such case, the hid-sensor-custom driver cannot match a known custom
sensor inhid_sensor_custom_get_known()because it try to check custom
properties which weren't filled from the report because hid core didn't
parsed it.As result, custom sensors like hinge angle sensor and LISS sensors
don't work.Mark the sensor hub devices claimed by some driver to avoid hidraw-related
optimizations.
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Yauhen Kharuzhy <[email protected]>Fixes tag?
Fixes 666cf30a589a ("HID: sensor-hub: Allow multi-function sensordevices")
This flag causes
hdev->claimed |= HID_CLAIMED_DRIVER;
I don't see the flag is used anywhere after this assignment in hid core. Only two other drivers are setting this flag. We need Jiri's help here why this is a special case.
Thanks,
Srinivas
Quoted 24 lines
Quoted 22 lines
Quoted 21 lines
---
drivers/hid/hid-sensor-hub.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/hid/hid- renamed from drivers/hid/hid-sensor-hub.c +0
-0
sensor-hub.c
index2eba152e8b90..26e93a331a51100644drivers/hid/hid-sensor-hub.c +1
-1@@ -632,7 +632,7 @@ static int sensor_hub_probe(struct hid_device *hdev, } INIT_LIST_HEAD(&hdev->inputs); - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |HID_CONNECT_DRIVER ); if (ret) {
hid_err(hdev, "hw start failed\n");
return ret;
Quoted 34 lines · srinivas pandruvada
Quoted 32 lines · Yauhen Kharuzhy
ср, 20 дек. 2023 г. в 16:52, Jonathan Cameron <[email protected]>:
Quoted 30 lines
Quoted 20 lines · On Wed, 20 Dec 2023 01:15:03 +0200 Yauhen Kharuzhy <[email protected]> wrote:
After the commit
666cf30a589a("HID: sensor-hub: Allow multi- function
sensor devices") hub devices are claimed by hidraw driver inhid_connect().
This causes stoppping of processing HID reports by hid core due to
optimization.In such case, the hid-sensor-custom driver cannot match a known custom
sensor inhid_sensor_custom_get_known()because it try to check custom
properties which weren't filled from the report because hid core didn't
parsed it.As result, custom sensors like hinge angle sensor and LISS sensors
don't work.Quoted 5 lines
Mark the sensor hub devices claimed by some driver to avoid hidraw-related
optimizations.Signed-off-by Yauhen Kharuzhy <[email protected]>Fixes tag?
Quoted 8 lines
Quoted 3 lines
Fixes 666cf30a589a ("HID: sensor-hub: Allow multi-function sensordevices")
This flag causes
hdev->claimed |= HID_CLAIMED_DRIVER;I don't see the flag is used anywhere after this assignment in hid core. Only two other drivers are setting this flag. We need Jiri's help here why this is a special case.
It's used in hid_report_raw_event()[0]:
```
if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
hid_process_report(hid, report, cdata, interrupt);
hdrv = hid->driver;
if (hdrv && hdrv->report)
hdrv->report(hid, report);
}
```The whole point of setting HID_CLAIMED_DRIVER is to have hid->claimed not equal to HID_CLAIMED_HIDRAW, in case we need the hid core processing.
Cheers,
Benjamin
[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/hid/hid-core.c#n2015
Quoted 29 lines
Thanks,
SrinivasQuoted 24 lines
Quoted 22 lines
Quoted 21 lines
--- drivers/hid/hid-sensor-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hid/hid- renamed from drivers/hid/hid-sensor-hub.c +0
-0
sensor-hub.c
index2eba152e8b90..26e93a331a51100644drivers/hid/hid-sensor-hub.c +1
-1@@ -632,7 +632,7 @@ static int sensor_hub_probe(struct hid_device *hdev, }INIT_LIST_HEAD (&hdev->inputs); - ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT |HID_CONNECT_DRIVER );if (ret) {hid_err(hdev, "hw start failed\n"); return ret;
Quoted 61 lines · Benjamin Tissoires
Quoted 42 lines · srinivas pandruvada
Quoted 33 lines · Yauhen Kharuzhy
ср, 20 дек. 2023 г. в 16:52, Jonathan Cameron <[email protected]>:
Quoted 32 lines
Quoted 28 lines · On Wed, 20 Dec 2023 01:15:03 +0200 Yauhen Kharuzhy <[email protected]> wrote:
After the commit
666cf30a589a("HID: sensor-hub: Allow multi- function
sensor devices") hub devices are claimed by hidraw driver inhid_connect().
This causes stoppping of processing HID reports by hid core due
to
optimization.In such case, the hid-sensor-custom driver cannot match a known
custom
sensor inhid_sensor_custom_get_known()because it try to check
custom
properties which weren't filled from the report because hid core
didn't
parsed it.As result, custom sensors like hinge angle sensor and LISS sensors
don't work.Mark the sensor hub devices claimed by some driver to avoid hidraw-related
optimizations.Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Yauhen Kharuzhy <[email protected]>Fixes tag?
Fixes 666cf30a589a ("HID: sensor-hub: Allow multi-functionsensor
devices")Quoted 6 lines
This flag causes
hdev->claimed|=HID_CLAIMED_DRIVER;
I don't see the flag is used anywhere after this assignment in hid core. Only two other drivers are setting this flag. We need Jiri's help
here why this is a special case.It's used in hid_report_raw_event()[0]:
``` if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { hid_process_report(hid, report, cdata, interrupt); hdrv = hid->driver; if (hdrv && hdrv->report) hdrv->report(hid, report); } ```
Quoted 3 lines
The whole point of setting
HID_CLAIMED_DRIVERis to havehid->claimednot equal toHID_CLAIMED_HIDRAW, in case we need the hid core processing.
Thanks Benjamin for explaining.
Then this change looks fine as sensor hub driver will claim this device and it needs hid core to process report.
Thanks,
Srinivas
Quoted 39 lines
Cheers,
Benjamin[0]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/hid/hid-core.c#n2015Quoted 30 lines
Thanks,
SrinivasQuoted 25 lines
Quoted 23 lines
Quoted 22 lines
---
drivers/hid/hid-sensor-hub.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/hid/hid- renamed from drivers/hid/hid-sensor-hub.c +0
-0
sensor-hub.c
index2eba152e8b90..26e93a331a51100644drivers/hid/hid-sensor-hub.c +0
-0@@ -632,7 +632,7 @@ static int sensor_hub_probe(struct
hid_device
*hdev,
}
INIT_LIST_HEAD(&hdev->inputs);- ret =
hid_hw_start(hdev, HID_CONNECT_DEFAULT); + ret =hid_hw_start(hdev, HID_CONNECT_DEFAULT | HID_CONNECT_DRIVER);
if (ret) {
hid_err(hdev, "hw start failed\n"); return ret;
Quoted 10 lines · Yauhen Kharuzhy
After the commit
666cf30a589a("HID: sensor-hub: Allow multi-function sensor devices") hub devices are claimed by hidraw driver inhid_connect(). This causes stoppping of processing HID reports by hid core due to optimization.In such case, the hid-sensor-custom driver cannot match a known custom sensor in
hid_sensor_custom_get_known()because it try to check custom properties which weren't filled from the report because hid core didn't parsed it.
Quoted 7 lines
As result, custom sensors like hinge angle sensor and LISS sensors don't work.
Mark the sensor hub devices claimed by some driver to avoid hidraw-related optimizations.
Signed-off-by Yauhen Kharuzhy <[email protected]>
I dusted off the Yoga C630 that provoked me into posting 666cf30a589a ("HID: sensor-hub: Allow multi-function sensor devices") in the first place. Keyboard is still going strong so isn't not comprehensive but for whatever it is worth this is:
Daniel.
Quoted 11 lines · Yauhen Kharuzhy
After the commit
666cf30a589a("HID: sensor-hub: Allow multi-function sensor devices") hub devices are claimed by hidraw driver inhid_connect(). This causes stoppping of processing HID reports by hid core due to optimization.In such case, the hid-sensor-custom driver cannot match a known custom sensor in
hid_sensor_custom_get_known()because it try to check custom properties which weren't filled from the report because hid core didn't parsed it.[...]
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git (for-6.8/sensor-hub), thanks!
[1/1] HID: sensor-hub: Enable hid core report processing for all devices
https://git.kernel.org/hid/hid/c/8e2f79f41a5d
Cheers,
Signature · 1 line
Benjamin Tissoires <[email protected]>