Skip to contentSkip to conversation

HID: nintendo: Don't fail on setting baud rate

PATCH Applied Max Staudt 2 participants 2 messages Mar 15, 2024 – Apr 3, 2024

Subsystems (2)
lore
Share & tools
lore

Max Staudt

author
#0 lore raw

PATCH v2 1/1 HID: nintendo: Don't fail on setting baud rate

Some third-party controllers can't change the baud rate.

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

---
Changes in v2:
- Made hid_err() a hid_warn() since it's not a fatal failure.

---
 drivers/hid/hid-nintendo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +5 -2
index 997c3a1adaca..395ed6b5ef59 100644
@@ -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) {
-			hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
-			goto out_unlock;
+			/*
+			 * We can function with the default baudrate.
+			 * Provide a warning, and continue on.
+			 */
+			hid_warn(hdev, "Failed to set baudrate (ret=%d), continuing anyway\n", ret);
 		}
 		/* handshake */
 		ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 17 lines · Max Staudt

Some third-party controllers can't change the baud rate.

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

---
Changes in v2:
- Made hid_err() a hid_warn() since it's not a fatal failure.

---
 drivers/hid/hid-nintendo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +0 -0
index 997c3a1adaca..395ed6b5ef59 100644

drivers/hid/hid-nintendo.c static int joycon_init(struct hid_device *hdev) · line 2171

Quoted 10 lines
drivers/hid/hid-nintendo.c +5 -2
@@ -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) {
-			hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
-			goto out_unlock;
+			/*
+			 * We can function with the default baudrate.
+			 * Provide a warning, and continue on.
+			 */
+			hid_warn(hdev, "Failed to set baudrate (ret=%d), continuing anyway\n", ret);

Applied, thank you.

Signature · 2 lines
Jiri Kosina
SUSE Labs