Project

General

Profile

Emulator Issues #10408

Mayflash GameCube Controller Adapter doesn't work over usbip

Added by macman31 over 2 years ago. Updated about 1 year ago.

Status:
Fix pending
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Game Name?

All games. Currently testing with Mario Kart Double Dash.

Game ID? (right click the game in the game list, properties, info tab)

GM4P01

MD5 Hash? (right click the game in the game list, properties, info tab, MD5 Hash: Compute)

d9a2e9c73f4be1a0456734445402d35d

What's the problem? Describe what went wrong.

I am using a "Mayflash GameCube Controller Adapter for Wii U and PC".
If connected directly to the PC, the adapter works perfectly fine with Dolphin.
If shared over usbip, the adapter doesn't work anymore with Dolphin.

What steps will reproduce the problem?

I don't want to use the adapter directly. I want to connect it to my Steam Link, and share the adapter in Wii U mode (not Xinput/PC mode) with my Linux PC.

The most common option to do so is to use VirtualHere which is integrated in Steam/Steam Link. But I don't want to pay 12$ for an option that should be available for free with the Steam Link in my opinion.
The more "experimental" option is to manage to build usbip (http://usbip.sourceforge.net/) for the Steam Link, then run it on the Steam Link to share all the USB devices we want for free with a laptop.

I have successfully managed to run usbip on the Steam Link, and I have succeeded in sharing USB devices (USB flash drive, mouse, etc.) from the Steam Link with my Linux PC.

The issue is with the Mayflash adapter. I can successfully share it in Wii U mode with my PC, and it appears with the correct USB ID 057e:0337 on my system. It is handled by the kernel module vhci_hcd as it is of course a virtual USB device on my PC.

However, the adapter is not working with Dolphin in this configuration. Other USB devices are shared and working great on the same USB port by using the same commands for sharing them with usbip.

To make sure that is isn't an issue with udev, I have tried manually chmoding the correct /dev/bus/usb/ file to give permissions to my user, and I have also tried running Dolphin as root (!) without success.

Please note that sharing the device in Wii U mode apparently doesn't work with VirtualHere either. See this link: https://www.reddit.com/r/Steam_Link/comments/5rjbfb/guide_using_a_gamecube_controller_with_a_mayflash/
"[...] we will be setting up the controller as a standard controller rather than Gamecube Adapter (Since it does not work, didn't even work with VirtualHere when i tested it)"

Which versions of Dolphin did you test on? Does using an older version of Dolphin solve your issue? If yes, which versions of Dolphin used to work?

Dolphin 5.0 (latest ArchLinux package community/dolphin-emu 1:5.0-4)

What are your PC specifications? (CPU, GPU, Operating System, more)

ArchLinux
Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz
GeForce GTX 670MX

History

#1 Updated by MayImilae over 2 years ago

  • Status changed from New to Questionable

To ask the obvious question... how is this our problem exactly? It works over the method we support - direct connection. You are adding an addition layer to that by using USBIP, and it doesn't work. Perhaps there is something wrong with your USBIP setup, or USBIP itself? In either case we don't support USBIP, and since it's an issue with USBIP itself, you should be contacting them for support.

#2 Updated by macman31 over 2 years ago

I did some more testing. With the Steam Link directly connected with Ethernet to my PC, the adapter is working perfectly well while being shared over usbip.

I very strongly suspect that the issue is with the 16ms timeout Dolphin uses for all the libusb_interrupt_transfer calls in ./Source/Core/InputCommon/GCAdapter.cpp.
If the adapter is connected over USB it's plenty of time for the call to succeed, but if the call has to be sent over the network then a timeout is likely to occur if the network adds too much latency (WiFi, Power-line communication, etc.).

I will try to recompile Dolphin with greater timeout values and see if it fixes the issue. Is there any reason why the timeout is set to 16ms and not something greater?

#3 Updated by macman31 over 2 years ago

I recompiled Dolphin (latest commit in master) with a 100ms timeout value in all libusb_interrupt_transfer calls in ./Source/Core/InputCommon/GCAdapter.cpp
When the Steam Link is not directly connected to my PC, it still doesn't work.

My network config is : Steam Link (Ethernet) => power-line communication device ====> power-line communication device => switch => PC (Ethernet)

For both Dolphin version (5.0 and master with greater timeout value), when Dolphin is launched and as long as no game is launched, I see a lot of URB_INTERRUPT messages being sent back and forth (I'm using Wireshark with the kernel module usbmon). There is 5ms to 10ms of latency between the URB_SUBMIT and URB_COMPLETE messages.

Just after a game is launched, the flow of URB_INTERRUPT stops, and I get an error in the logs.

It might be related to a network packet drop or a similar issue. I will investigate more later!

Logs:
~~~
[Binaries]$ ./dolphin-emu
51:46:398 InputCommon/GCAdapter.cpp:110 N[SI]: GC Adapter scanning thread started
51:46:398 InputCommon/GCAdapter.cpp:238 N[SI]: Found GC Adapter with Vendor: 57E Product: 337 Devnum: 1
51:46:415 InputCommon/GCAdapter.cpp:506 I[SI]: Rumble state reset
51:46:415 InputCommon/GCAdapter.cpp:125 N[SI]: Using libUSB hotplug detection
51:46:532 InputCommon/ControllerInterface/evdev/evdev.cpp:54 N[SI]: evdev hotplug thread started
52:10:460 InputCommon/GCAdapter.cpp:407 N[SI]: New device connected to Port 1 of Type: 10
52:10:797 Core/HW/SI/SI_DeviceGCController.cpp:79 I[SI]: PAD - Get Origin
52:10:798 Core/HW/SI/SI_DeviceGCController.cpp:313 I[SI]: PAD 0 set to mode 3
52:10:798 Core/HW/SI/SI_DeviceGCController.cpp:79 I[SI]: PAD - Get Origin
52:10:798 Core/HW/SI/SI_DeviceGCController.cpp:313 I[SI]: PAD 3 set to mode 3
52:11:501 InputCommon/GCAdapter.cpp:396 E[SI]: error reading payload (size: 0, type: 21)
52:11:510 InputCommon/GCAdapter.cpp:370 N[SI]: GC Adapter detached
~~~

#4 Updated by macman31 over 2 years ago

Edit of my previous message: I messed up, I did not apply the 100ms timeout value before compiling Dolphin. It's 4AM here! =P

After recompiling with the 100ms modification applied, and testing again from my Steam Link streaming the game, it works!
Of course, the latency is noticeable in game. But at least with the modification Dolphin now allows me to play with real GC controllers with the adapter.

So if there is no specific reason of setting the timeout value to 16ms (at least in my case it did not slow down the emulation), I would suggest increasing it to at least 100ms (or more? or just disabling the timeout?) so that people that share USB peripherals over the network can do so without issue (except input lag).
That would make Dolphin more compatible with VirtualHere which is included by default on Steam Links, in addition to the more "experimental" usbip approach. Especially with official GH controller adapters which don't have a "PC mode" (Xinput).

I'll probably do a pull request if there is no one against this idea here.

#5 Updated by JMC4789 over 2 years ago

Make a Pull Request please so there can be discussion about it. I'm not 100% sure why it's set to 16, but if it is, someone will speak up in a PR. A lot of the core devs don't watch the issue tracker as much.

#7 Updated by Billiard26 about 1 year ago

  • Status changed from Questionable to Fix pending

#8 Updated by BDClark about 1 year ago

I've been having a similar issue to this execpt I am using the VirtualHere to pass the adapter through the steam link. It works fine for the most part but occasionally the c-stick will act weird and sometimes the left stick will get permantly stuck in one direction. I'm getting a similar error in the logs.

11:00:555 inputcommon\gcadapter.cpp:412 E[SI]: error reading payload (size: 0, type: 21)
11:00:558 inputcommon\gcadapter.cpp:386 N[SI]: GC Adapter detached
11:00:953 inputcommon\gcadapter.cpp:263 N[SI]: Found GC Adapter with Vendor: 57E Product: 337 Devnum: 1
11:00:963 inputcommon\gcadapter.cpp:423 N[SI]: New device connected to Port 1 of Type: 14
11:00:965 inputcommon\gcadapter.cpp:522 I[SI]: Rumble state reset

This happened multiple times thoughout me playing the game in dolphin and it directly corresponds to the glitches with the controllers. Im using version 5.0-9779 so I'm not sure whether your 100ms time out change has made it into the build or not. How did you edit the source code to change it?

#9 Updated by BDClark about 1 year ago

So after messing around with it and some research I found this post https://bugs.dolphin-emu.org/issues/9486 and ended up trying their fix. I downloaded https://www.spice-space.org/download/windows/usbdk/UsbDk_1.0.15_x64.msi and installed it and my adapters been working fine.

Also available in: Atom PDF