diff mbox series

[v1] HID: nintendo: Don't fail on setting baud rate

Message ID 20240115145000.12777-1-max@enpas.org (mailing list archive)
State Superseded
Delegated to: Jiri Kosina
Headers show
Series [v1] HID: nintendo: Don't fail on setting baud rate | expand

Commit Message

Max Staudt Jan. 15, 2024, 2:50 p.m. UTC
Some third-party controllers can't change the baud rate.

We can still use the gamepad as-is, so let's do that.

Signed-off-by: Max Staudt <max@enpas.org>
---
 drivers/hid/hid-nintendo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Max Staudt Feb. 20, 2024, 5:20 p.m. UTC | #1
Ping :)

Do you think this patch could be upstreamed to widen the controller support?


Thank you for looking at this!

Max




On 1/15/24 23:50, Max Staudt wrote:
> Some third-party controllers can't change the baud rate.
> 
> We can still use the gamepad as-is, so let's do that.
> 
> Signed-off-by: Max Staudt <max@enpas.org>
> ---
>   drivers/hid/hid-nintendo.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
> index 997c3a1adaca..8cba0612c3ae 100644
> --- a/drivers/hid/hid-nintendo.c
> +++ b/drivers/hid/hid-nintendo.c
> @@ -2164,8 +2164,11 @@ static int joycon_init(struct hid_device *hdev)
>   		/* set baudrate for improved latency */
>   		ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
>   		if (ret) {
> +			/*
> +			 * We can function with the default baudrate.
> +			 * Provide a warning, and continue on.
> +			 */
>   			hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
> -			goto out_unlock;
>   		}
>   		/* handshake */
>   		ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
diff mbox series

Patch

diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index 997c3a1adaca..8cba0612c3ae 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -2164,8 +2164,11 @@  static int joycon_init(struct hid_device *hdev)
 		/* set baudrate for improved latency */
 		ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
 		if (ret) {
+			/*
+			 * We can function with the default baudrate.
+			 * Provide a warning, and continue on.
+			 */
 			hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
-			goto out_unlock;
 		}
 		/* handshake */
 		ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);