* Re: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related] [not found] <20200817070040.7952-1-mail@mariuszachmann.de> @ 2020-08-17 15:35 ` Guenter Roeck 2020-08-18 13:12 ` Marius Zachmann 0 siblings, 1 reply; 4+ messages in thread From: Guenter Roeck @ 2020-08-17 15:35 UTC (permalink / raw) To: Marius Zachmann Cc: Jean Delvare, linux-hwmon, linux-kernel, Jiri Kosina, Benjamin Tissoires, linux-input On Mon, Aug 17, 2020 at 09:00:40AM +0200, Marius Zachmann wrote: > 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. > > Signed-off-by: Marius Zachmann <mail@mariuszachmann.de> Let's just ask the HID maintainers. Is this expected, and the correct fix ? Thanks, Guenter > --- > v2: > - fix accidentally deleted comment > > --- > drivers/hwmon/corsair-cpro.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/hwmon/corsair-cpro.c b/drivers/hwmon/corsair-cpro.c > index 591929ec217a..c04fac1d820f 100644 > --- a/drivers/hwmon/corsair-cpro.c > +++ b/drivers/hwmon/corsair-cpro.c > @@ -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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related] 2020-08-17 15:35 ` [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related] Guenter Roeck @ 2020-08-18 13:12 ` Marius Zachmann 2020-08-18 13:42 ` Guenter Roeck 2020-08-18 17:51 ` Jiri Kosina 0 siblings, 2 replies; 4+ messages in thread From: Marius Zachmann @ 2020-08-18 13:12 UTC (permalink / raw) To: Guenter Roeck Cc: Jean Delvare, linux-hwmon, linux-kernel, Jiri Kosina, Benjamin Tissoires, linux-input On 18.08.20 at 17:35:33 CEST, Guenter Roeck wrote > On Mon, Aug 17, 2020 at 09:00:40AM +0200, Marius Zachmann wrote: > > 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. > > > > Signed-off-by: Marius Zachmann <mail@mariuszachmann.de> > > 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 > > --- > > v2: > > - fix accidentally deleted comment > > > > --- > > drivers/hwmon/corsair-cpro.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/hwmon/corsair-cpro.c b/drivers/hwmon/corsair-cpro.c > > index 591929ec217a..c04fac1d820f 100644 > > --- a/drivers/hwmon/corsair-cpro.c > > +++ b/drivers/hwmon/corsair-cpro.c > > @@ -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 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related] 2020-08-18 13:12 ` Marius Zachmann @ 2020-08-18 13:42 ` Guenter Roeck 2020-08-18 17:51 ` Jiri Kosina 1 sibling, 0 replies; 4+ messages in thread From: Guenter Roeck @ 2020-08-18 13:42 UTC (permalink / raw) To: Marius Zachmann Cc: Jean Delvare, linux-hwmon, linux-kernel, Jiri Kosina, Benjamin Tissoires, linux-input On 8/18/20 6:12 AM, Marius Zachmann wrote: > On 18.08.20 at 17:35:33 CEST, Guenter Roeck wrote >> On Mon, Aug 17, 2020 at 09:00:40AM +0200, Marius Zachmann wrote: >>> 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. >>> >>> Signed-off-by: Marius Zachmann <mail@mariuszachmann.de> >> >> 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. > I even was involved in that patch. Sigh. Guenter > Thanks, > Marius > >>> --- >>> v2: >>> - fix accidentally deleted comment >>> >>> --- >>> drivers/hwmon/corsair-cpro.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/drivers/hwmon/corsair-cpro.c b/drivers/hwmon/corsair-cpro.c >>> index 591929ec217a..c04fac1d820f 100644 >>> --- a/drivers/hwmon/corsair-cpro.c >>> +++ b/drivers/hwmon/corsair-cpro.c >>> @@ -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 >> > > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related] 2020-08-18 13:12 ` Marius Zachmann 2020-08-18 13:42 ` Guenter Roeck @ 2020-08-18 17:51 ` Jiri Kosina 1 sibling, 0 replies; 4+ messages in thread From: Jiri Kosina @ 2020-08-18 17:51 UTC (permalink / raw) To: Marius Zachmann Cc: Guenter Roeck, Jean Delvare, linux-hwmon, linux-kernel, Benjamin Tissoires, Dmitry Torokhov, linux-input On Tue, 18 Aug 2020, Marius Zachmann wrote: > > > 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. > > > > > > Signed-off-by: Marius Zachmann <mail@mariuszachmann.de> > > > > 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_start and 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, -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-18 17:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200817070040.7952-1-mail@mariuszachmann.de>
2020-08-17 15:35 ` [PATCH v2] hwmon: corsair-cpro: fix ccp_probe, add delay [HID related] Guenter Roeck
2020-08-18 13:12 ` Marius Zachmann
2020-08-18 13:42 ` Guenter Roeck
2020-08-18 17:51 ` 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).