From: Bastien Nocera <hadess@hadess.net>
To: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, "Jiri Kosina" <jikos@kernel.org>,
"Benjamin Tissoires" <benjamin.tissoires@redhat.com>,
"Peter F . Patel-Schneider" <pfpschneider@gmail.com>,
"Filipe Laíns" <lains@riseup.net>,
"Nestor Lopez Casado" <nlopezcasad@logitech.com>
Subject: Re: [PATCH 2/3] HID: logitech-hidpp: Don't restart communication if not necessary
Date: Tue, 24 Jan 2023 18:20:21 +0100 [thread overview]
Message-ID: <a75e34efce22ab1de8f0a2e247294a441e710193.camel@hadess.net> (raw)
In-Reply-To: <20221220092207.428640-2-hadess@hadess.net>
On Tue, 2022-12-20 at 10:22 +0100, Bastien Nocera wrote:
> Don't stop and restart communication with the device unless we need
> to
> modify the connect flags used because of a device quirk.
FIWW, Andreas Bergmeier told me off-list that this fixed their problem
with the Litra Glow not connecting properly.
Would be great to have reviews on this and my other HID++ patches.
Cheers
> ---
> drivers/hid/hid-logitech-hidpp.c | 31 +++++++++++++++++++-----------
> -
> 1 file changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-
> logitech-hidpp.c
> index 7f9187201913..b4e4a8c79c75 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -4310,6 +4310,7 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> bool connected;
> unsigned int connect_mask = HID_CONNECT_DEFAULT;
> struct hidpp_ff_private_data data;
> + bool will_restart = false;
>
> /* report_fixup needs drvdata to be set before we call
> hid_parse */
> hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL);
> @@ -4360,6 +4361,9 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> return ret;
> }
>
> + if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT)
> + will_restart = true;
> +
> INIT_WORK(&hidpp->work, delayed_work_cb);
> mutex_init(&hidpp->send_mutex);
> init_waitqueue_head(&hidpp->wait);
> @@ -4374,7 +4378,7 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> * Plain USB connections need to actually call start and open
> * on the transport driver to allow incoming data.
> */
> - ret = hid_hw_start(hdev, 0);
> + ret = hid_hw_start(hdev, will_restart ? 0 : connect_mask);
> if (ret) {
> hid_err(hdev, "hw start failed\n");
> goto hid_hw_start_fail;
> @@ -4411,6 +4415,7 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> hidpp->wireless_feature_index = 0;
> else if (ret)
> goto hid_hw_init_fail;
> + ret = 0;
> }
>
> if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)) {
> @@ -4425,19 +4430,21 @@ static int hidpp_probe(struct hid_device
> *hdev, const struct hid_device_id *id)
>
> hidpp_connect_event(hidpp);
>
> - /* Reset the HID node state */
> - hid_device_io_stop(hdev);
> - hid_hw_close(hdev);
> - hid_hw_stop(hdev);
> + if (will_restart) {
> + /* Reset the HID node state */
> + hid_device_io_stop(hdev);
> + hid_hw_close(hdev);
> + hid_hw_stop(hdev);
>
> - if (hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT)
> - connect_mask &= ~HID_CONNECT_HIDINPUT;
> + if (hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT)
> + connect_mask &= ~HID_CONNECT_HIDINPUT;
>
> - /* Now export the actual inputs and hidraw nodes to the world
> */
> - ret = hid_hw_start(hdev, connect_mask);
> - if (ret) {
> - hid_err(hdev, "%s:hid_hw_start returned error\n",
> __func__);
> - goto hid_hw_start_fail;
> + /* Now export the actual inputs and hidraw nodes to
> the world */
> + ret = hid_hw_start(hdev, connect_mask);
> + if (ret) {
> + hid_err(hdev, "%s:hid_hw_start returned
> error\n", __func__);
> + goto hid_hw_start_fail;
> + }
> }
>
> if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920) {
next prev parent reply other threads:[~2023-01-24 17:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 9:22 [PATCH 1/3] Revert "HID: logitech-hidpp: add a module parameter to keep firmware gestures" Bastien Nocera
2022-12-20 9:22 ` [PATCH 2/3] HID: logitech-hidpp: Don't restart communication if not necessary Bastien Nocera
2023-01-24 17:20 ` Bastien Nocera [this message]
2023-01-25 10:18 ` Benjamin Tissoires
2023-01-25 11:52 ` Bastien Nocera
2022-12-20 9:22 ` [PATCH 3/3] HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk Bastien Nocera
2022-12-20 15:44 ` [PATCH 1/3] Revert "HID: logitech-hidpp: add a module parameter to keep firmware gestures" Bastien Nocera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a75e34efce22ab1de8f0a2e247294a441e710193.camel@hadess.net \
--to=hadess@hadess.net \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=lains@riseup.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nlopezcasad@logitech.com \
--cc=pfpschneider@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).