hwmon: corsair-cpro: fix ccp_probe, add delay
Subsystems (3)
Marius Zachmann
maintainerPATCH v2 1/1 hwmon: corsair-cpro: fix ccp_probe, add delay
Possibly because of the changes in usbhid/hid-core.c the first raw input report is not received during ccp_probe function and it will timeout. I am not sure, whether this behaviour is expected after hid_device_io_start or if I am missing something.
As a solution this adds msleep(50) to ccp_probe so that all initial input reports can be received.
---
v2:
- fix accidentally deleted comment
--- drivers/hwmon/corsair-cpro.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwmon/corsair-cpro.c +2 -0
@@ -10,6 +10,7 @@#include <linux/bitops.h> #include <linux/completion.h> +#include <linux/delay.h> #include <linux/hid.h> #include <linux/hwmon.h> #include <linux/kernel.h>
@@ -513,6 +514,7 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id)init_completion (&ccp->wait_input_report);hid_device_io_start (hdev); +msleep (50 );/* wait before events can be received */ /* temp and fan connection status only updates when device is powered on */ ret =get_temp_cnct (ccp);
--
2.28.0
Guenter Roeck
maintainerRe: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related]
Quoted 8 lines · Marius Zachmann
Possibly because of the changes in
usbhid/hid-core.cthe first raw input report is not received duringccp_probefunction and it will timeout. I am not sure, whether this behaviour is expected afterhid_device_io_startor if I am missing something.
As a solution this adds msleep(50) toccp_probeso that all initial input reports can be received.Signed-off-by Marius Zachmann <[email protected]>
Let's just ask the HID maintainers. Is this expected, and the correct fix ?
Thanks,
Guenter
Quoted 30 lines
---
v2:
- fix accidentally deleted comment--- drivers/hwmon/corsair-cpro.c | 2 ++ 1 file changed, 2 insertions(+)drivers/hwmon/corsair-cpro.c +2
-1@@ -10,6 +10,7 @@#include <linux/bitops.h> #include <linux/completion.h> +#include <linux/delay.h> #include <linux/hid.h> #include <linux/hwmon.h> #include <linux/kernel.h> @@ -513,6 +514,7 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id)init_completion (&ccp->wait_input_report);hid_device_io_start (hdev); +msleep (50 );/* wait before events can be received */ /* temp and fan connection status only updates when device is powered on */ ret =get_temp_cnct (ccp); --2.28.0
Marius Zachmann
maintainerRe: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related]
On 18.08.20 at 17:35:33 CEST, Guenter Roeck wrote
Quoted 8 lines · Marius Zachmann
Quoted 7 lines
Possibly because of the changes in
usbhid/hid-core.cthe first raw input report is not received duringccp_probefunction and it will timeout. I am not sure, whether this behaviour is expected afterhid_device_io_startor if I am missing something.
As a solution this adds msleep(50) toccp_probeso that all initial input reports can be received.
Quoted 7 lines
Quoted 1 line
Signed-off-by Marius Zachmann <[email protected]>Let's just ask the HID maintainers. Is this expected, and the correct fix ?
Thanks,
Guenter
This seems to be a problem with "HID: usbhid: do not sleep when opening device". There is a bug report with some Logitech devices at the correct thread. These drivers also use hid_device_io_start and fail. Seems to me, this is the same problem and I retract this (not so beautiful) fix until this is sorted out.
Thanks,
Marius
Quoted 31 lines
Quoted 30 lines
---
v2:
- fix accidentally deleted comment--- drivers/hwmon/corsair-cpro.c | 2 ++ 1 file changed, 2 insertions(+)drivers/hwmon/corsair-cpro.c +2
-1@@ -10,6 +10,7 @@#include <linux/bitops.h> #include <linux/completion.h> +#include <linux/delay.h> #include <linux/hid.h> #include <linux/hwmon.h> #include <linux/kernel.h> @@ -513,6 +514,7 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id)init_completion (&ccp->wait_input_report);hid_device_io_start (hdev); +msleep (50 );/* wait before events can be received */ /* temp and fan connection status only updates when device is powered on */ ret =get_temp_cnct (ccp); --2.28.0
Guenter Roeck
maintainerRe: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related]
Quoted 17 lines · Marius Zachmann
On 18.08.20 at 17:35:33 CEST, Guenter Roeck wrote
Quoted 8 lines · Marius Zachmann
Quoted 7 lines
Possibly because of the changes in
usbhid/hid-core.cthe first raw input report is not received duringccp_probefunction and it will timeout. I am not sure, whether this behaviour is expected afterhid_device_io_startor if I am missing something.
As a solution this adds msleep(50) toccp_probeso that all initial input reports can be received.Quoted 7 lines
Quoted 1 line
Signed-off-by Marius Zachmann <[email protected]>Let's just ask the HID maintainers. Is this expected, and the correct fix ?
Thanks,
Guenter
Quoted 6 lines
This seems to be a problem with "HID: usbhid: do not sleep when opening device". There is a bug report with some Logitech devices at the correct thread. These drivers also use
hid_device_io_startand fail. Seems to me, this is the same problem and I retract this (not so beautiful) fix until this is sorted out.
I even was involved in that patch. Sigh.
Guenter
Quoted 38 lines
Thanks,
MariusQuoted 31 lines
Quoted 30 lines
---
v2:
- fix accidentally deleted comment--- drivers/hwmon/corsair-cpro.c | 2 ++ 1 file changed, 2 insertions(+)drivers/hwmon/corsair-cpro.c +2
-1@@ -10,6 +10,7 @@#include <linux/bitops.h> #include <linux/completion.h> +#include <linux/delay.h> #include <linux/hid.h> #include <linux/hwmon.h> #include <linux/kernel.h> @@ -513,6 +514,7 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id)init_completion (&ccp->wait_input_report);hid_device_io_start (hdev); +msleep (50 );/* wait before events can be received */ /* temp and fan connection status only updates when device is powered on */ ret =get_temp_cnct (ccp); --2.28.0
Jiri Kosina
maintainerRe: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related]
In reply to Marius ZachmannQuoted 9 lines · Marius Zachmann
Quoted 9 lines
Quoted 8 lines
Possibly because of the changes in
usbhid/hid-core.cthe first raw input report is not received duringccp_probefunction and it will timeout. I am not sure, whether this behaviour is expected afterhid_device_io_startor if I am missing something.
As a solution this adds msleep(50) toccp_probeso that all initial input reports can be received.Signed-off-by Marius Zachmann <[email protected]>
Quoted 7 lines
Quoted 1 line
Let's just ask the HID maintainers. Is this expected, and the correct fix ?
This seems to be a problem with "HID: usbhid: do not sleep when opening device". There is a bug report with some Logitech devices at the correct thread. These drivers also use
hid_device_io_startand fail. Seems to me, this is the same problem and I retract this (not so beautiful) fix until this is sorted out.
[ CCing Dmitry ]
Yeah, this problem popped out also in other contexts, where many Logitech devices didn't probe properly, because of the race where the first IRQ is dropped on the floor (after hid_device_io_start() happens, but before the 50ms timeout passess), and report descriptor never gets parsed and populated.
As this is just a boot time micro-optimization, I am going to revert the patch for 5.9 now, and we can try to fix this properly for next merge window.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs