* 8bitdo usb adapter 2 in the NintendoMode (hid-nintendo.ko)
@ 2023-04-25 23:51 Robert Swiecki
0 siblings, 0 replies; only message in thread
From: Robert Swiecki @ 2023-04-25 23:51 UTC (permalink / raw)
To: Daniel J. Ogorchock; +Cc: linux-input
Hi Daniel and linux-input@vger.kernel.org,
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-25 23:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-25 23:51 8bitdo usb adapter 2 in the NintendoMode (hid-nintendo.ko) Robert Swiecki
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).