8BitDo Wireless Adapter in Switch mode does not support the baudrate command, and if it receives it, it goes into an error state and resets constantly. So, skip the command on devices made by 8BitDo. Identification has to be done by MAC address, since the USB VID:PID are set to match the Switch Pro Controller. Hence, the call to joycon_read_info before has to be moved earlier, to make sure the MAC is populated before setting the baudrate. --- drivers/hid/hid-nintendo.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index fb4985988615..26a53c78be8f 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -670,6 +670,11 @@ static inline bool joycon_device_is_chrggrip(struct joycon_ctlr *ctlr) return ctlr->hdev->product == USB_DEVICE_ID_NINTENDO_CHRGGRIP; } +static inline bool joycon_device_is_8bitdo(struct joycon_ctlr *ctlr) +{ + return !strncmp(ctlr->mac_addr_str, "E4:17:D8", 8); +} + /* * Controller type helpers * @@ -2467,6 +2472,21 @@ static int joycon_init(struct hid_device *hdev) /* if handshake command fails, assume ble pro controller */ if (joycon_using_usb(ctlr) && !joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) { hid_dbg(hdev, "detected USB controller\n"); + } else if (jc_type_is_chrggrip(ctlr)) { + hid_err(hdev, "Failed charging grip handshake\n"); + ret = -ETIMEDOUT; + goto out_unlock; + } + + /* needed to retrieve the controller type */ + ret = joycon_read_info(ctlr); + if (ret) { + hid_err(hdev, "Failed to retrieve controller info; ret=%d\n", + ret); + goto out_unlock; + } + + if (joycon_using_usb(ctlr) && !joycon_device_is_8bitdo(ctlr)) { /* set baudrate for improved latency */ ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ); if (ret) { @@ -2487,18 +2507,6 @@ static int joycon_init(struct hid_device *hdev) * This doesn't send a response, so ignore the timeout. */ joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10); - } else if (jc_type_is_chrggrip(ctlr)) { - hid_err(hdev, "Failed charging grip handshake\n"); - ret = -ETIMEDOUT; - goto out_unlock; - } - - /* needed to retrieve the controller type */ - ret = joycon_read_info(ctlr); - if (ret) { - hid_err(hdev, "Failed to retrieve controller info; ret=%d\n", - ret); - goto out_unlock; } if (joycon_has_joysticks(ctlr)) { -- 2.50.0