8bitdo usb adapter 2 in the NintendoMode (hid-nintendo.ko)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel and linux-input@xxxxxxxxxxxxxxx,

I've recently bought a 8bitdo usb adapter 2 -
https://www.8bitdo.com/usb-wireless-adapter-2/ - and it didn't work
with Linux in its Nintendo Switch Pro mode (emulating the Nintendo Pro
Controller over the USB).

It turned out that the following func sends 2 bytes in the
JC_OUTPUT_USB_CMD, while the adapter expects 64 bytes. Maybe it
expects fewer, but that's what the yuzu emulator sends to it over
hidraw (bypassing the hid-nintendo), and it works.

static int joycon_send_usb(struct joycon_ctlr *ctlr, u8 cmd, u32 timeout)
{
  int ret;
  u8 buf[2] = {JC_OUTPUT_USB_CMD};

  buf[1] = cmd;
   ctlr->usb_ack_match = cmd;
  ctlr->msg_type = JOYCON_MSG_TYPE_USB;
  ret = joycon_hid_send_sync(ctlr, buf, sizeof(buf), timeout);
  if (ret)
   hid_dbg(ctlr->hdev, "send usb command failed; ret=%d\n", ret);
  return ret;
}

If only 2 bytes are sent, then it causes the adapter to disconnect,
probably due to some desync on the protocol level on the adapter side
of things.

[135278.921421] nintendo 0003:057E:2009.00DD: hidraw16: USB HID v81.11
Joystick [Nintendo Co., Ltd. Pro Controller] on
usb-0000:07:00.3-3.1/input0
[135280.000469] nintendo 0003:057E:2009.00DD: failed reading SPI flash; ret=-71
[135280.000473] nintendo 0003:057E:2009.00DD: using factory cal for left stick
[135280.008470] nintendo 0003:057E:2009.00DD: failed reading SPI flash; ret=-71
[135280.008473] nintendo 0003:057E:2009.00DD: using factory cal for right stick
[135280.016469] nintendo 0003:057E:2009.00DD: failed reading SPI flash; ret=-71
[135280.016472] nintendo 0003:057E:2009.00DD: Failed to read left
stick cal, using defaults; e=-71
[135280.024468] nintendo 0003:057E:2009.00DD: failed reading SPI flash; ret=-71
[135280.024471] nintendo 0003:057E:2009.00DD: Failed to read right
stick cal, using defaults; e=-71
[135280.032470] nintendo 0003:057E:2009.00DD: failed reading SPI flash; ret=-71
[135280.032473] nintendo 0003:057E:2009.00DD: using factory cal for IMU
[135280.040468] nintendo 0003:057E:2009.00DD: failed reading SPI flash; ret=-71
[135280.040471] nintendo 0003:057E:2009.00DD: Failed to read IMU cal,
using defaults; ret=-71
[135280.040472] nintendo 0003:057E:2009.00DD: Unable to read IMU
calibration data
[135280.048470] nintendo 0003:057E:2009.00DD: Failed to set report mode; ret=-71
[135280.048743] nintendo 0003:057E:2009.00DD: probe - fail = -71
[135280.048749] nintendo: probe of 0003:057E:2009.00DD failed with error -71
[135280.050014] usb 3-3.1: USB disconnect, device number 53

In case it didn't create any problems with the actual Nintendo Pro
Controller, nor with the JoyCons, could we change this code from

u8 buf[2] = {JC_OUTPUT_USB_CMD};

to

u8 buf[64] = {JC_OUTPUT_USB_CMD};

?

I know this change is a bit "out of the blue", but given that the
protocol seems to be generally undocumented and reverse-engineered,
maybe that's fine here.

Thanks in advance.

-- 
Robert Święcki




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux