[WIIU] Regression: Plugging in certain USB HID devices disconnects the Wii U GamePad
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 14.1k
- Forks
- 2.2k
- Avg merge
- 7h 35m
- Merged PRs (30d)
- 51
Description
Description
Following on from #13198. Keyboards are working again with #13308, but the other HID issues remain. In order of severity:
- the Wii U GamePad is disconnected by RetroArch if an unrecognized device is connected. This can occur either at launch if the devices are already inserted, or whenever the devices actually are inserted.
- certain unrecognized USB devices are detected as Generic SNES USB controllers, even though they aren't those. If a device is falsely recognized as a SNES USB controller, it doesn't seem to cause further issues, so fixing just this may make the above issue worse.
Expected behavior
At worst, plugging in USB devices should just not work (for unsupported devices) or work (for supported devices) without disconnecting the GamePad or being identified in the RetroArch interface as Generic SNES USB controllers.
Actual behavior
I've tested with four devices:
- PowerWave Analog Game Controller, some janky mid-2000s DInput Xbox knockoff pad
- pops a notification, "Generic SNES USB controller (0/0) not configured". PowerWave controller does not work. GamePad still works.
- THEC64 joystick, a reproduction DInput Commodore 64 joystick
- pops a notification, "Device disconnected from port #1." The notification does not say "Wii U GamePad", which I believe a normal disconnection notice would; there is no mention of what the "device" being disconnected was. I suspect it's trying to disconnect the THEC64 joystick but it was never assigned a port because it's not recognized, and the result is it disconnects the GamePad instead. Controller does not work, as expected since it finds no match. On the upside, that means this controller is not ID'd as a Generic SNES USB controller.
- Lenovo wired optical mouse from some old computer or other
- seems to do literally nothing. No notification pops and I don't think RetroArch on Wii U has any mouse support, so the mouse not actually working is expected behavior. No issues here.
- Logitech K600 TV, a wireless keyboard/mouse with dongle--in theory this is a proprietary Logitech Unifying device, but Unifying devices fall back on behaving as standard USB HID devices if they don't get a special init sequence from the Unifying driver, which Wii U obviously doesn't have, so I think this should be roughly equivalent to a wired keyboard and mouse plugged into a USB hub
- pops a notification, "Device disconnected from port #1." The keyboard works perfectly, but the GamePad obviously doesn't work any more. The mouse, as expected, does nothing.
Logs
I will note, I tried to log using wiiu/net_listen.sh as requested by @gblues, but only got output from Salamander; there's zero lines of log coming from the actual core. My RetroArch log level is set to 0 (Debug) for both Frontend and Core. I can share the log if you really want it, but it stops at 2021-12-02T21:20:03.964885 [INFO] [Config]: Loading config from: "sd:/retroarch/retroarch.cfg". There's really nothing there. Failing that, here's some regular RetroArch logs.
This first log is of me starting RetroArch, inserting the PowerWave controller (vid: 0x8f0e pid: 0x300), then the THEC64 joystick (vid: 0x591c pid: 0x2400). Things of interest:
- it doesn't say it failed to find an entry for the PowerWave controller--presumably because it "matches" the Generic SNES USB controller entry?
- when THEC64 joystick is connected, it explicitly says it failed to find a match. This is when the Wii U GamePad stops working.
- RetroArch reports the name of the device as
TH. Its actual name isTHEC64 Joystick.
[INFO] RetroArch 1.9.13 (Git 121ca3a482)
[INFO] === Build =======================================
[INFO] Capabilities:
[INFO] Built: Dec 2 2021
[INFO] Version: 1.9.13
[INFO] Git: 121ca3a482
[INFO] =================================================
[INFO] [Input]: Found input driver: "wiiu".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] Version of libretro API: 1
[INFO] Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Video @ 960x720
[INFO] [hid]: initializing
[INFO] [hid]: starting polling thread.
[INFO] [Input]: Found HID driver: "wiiu".
[INFO] [hid]: polling thread is starting
[INFO] [Joypad]: Found joypad driver: "wiiu".
[INFO] [Video]: Setting refresh rate to: 59.940 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Video]: Found display server: null
[INFO] [Display]: Found display driver: "gx2".
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [SRAM]: SRAM will not be saved.
[INFO] [Playlist]: Loading history file: [sd:/retroarch/content_history.lpl].
[INFO] [Playlist]: Loading history file: [sd:/retroarch/content_music_history.lpl].
[INFO] [Playlist]: Loading favorites file: [sd:/retroarch/content_favorites.lpl].
[INFO] handle: 1919081
[INFO] physical_device_inst: 0
[INFO] vid: 0x8f0e
[INFO] pid: 0x300
[INFO] interface_index: 0
[INFO] sub_class: 0
[INFO] protocol: 0
[INFO] max_packet_size_rx: 8
[INFO] max_packet_size_tx: 0
[INFO] connecting pad to slot 1
[INFO] handle: 1971588
[INFO] physical_device_inst: 0
[INFO] vid: 0x591c
[INFO] pid: 0x2400
[INFO] interface_index: 0
[INFO] sub_class: 0
[INFO] protocol: 0
[INFO] max_packet_size_rx: 8
[INFO] max_packet_size_tx: 0
[INFO] Failed to find entry for vid: 0x591c, pid: 0x2400, name: TH
[INFO] [Config]: Saving salamander config to: "sd:/retroarch/retroarch-salamander.cfg".
[INFO] [Config]: Saved new config to "sd:/retroarch/retroarch.cfg".
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] [Video]: Average monitor Hz: 59.941258 Hz. (0.978 % frame time deviation, based on 2048 last samples).
[INFO] [Video]: Average monitor Hz: 59.941258 Hz. (0.978 % frame time deviation, based on 2048 last samples).
This next log is for the Lenovo mouse. Nothing very interesting happens. Does it poll the mouse four times? Doesn't really matter, no issues here.
[INFO] RetroArch 1.9.13 (Git 121ca3a482)
[INFO] === Build =======================================
[INFO] Capabilities:
[INFO] Built: Dec 2 2021
[INFO] Version: 1.9.13
[INFO] Git: 121ca3a482
[INFO] =================================================
[INFO] [Input]: Found input driver: "wiiu".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] Version of libretro API: 1
[INFO] Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Video @ 960x720
[INFO] [hid]: initializing
[INFO] [hid]: starting polling thread.
[INFO] [Input]: Found HID driver: "wiiu".
[INFO] [hid]: polling thread is starting
[INFO] [Joypad]: Found joypad driver: "wiiu".
[INFO] [Video]: Setting refresh rate to: 59.940 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Video]: Found display server: null
[INFO] [Display]: Found display driver: "gx2".
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [SRAM]: SRAM will not be saved.
[INFO] [Playlist]: Loading history file: [sd:/retroarch/content_history.lpl].
[INFO] [Playlist]: Loading history file: [sd:/retroarch/content_music_history.lpl].
[INFO] [Playlist]: Loading favorites file: [sd:/retroarch/content_favorites.lpl].
[INFO] handle: 1971596
[INFO] physical_device_inst: 0
[INFO] vid: 0xef17
[INFO] pid: 0x1960
[INFO] interface_index: 0
[INFO] sub_class: 1
[INFO] protocol: 2
[INFO] max_packet_size_rx: 4
[INFO] max_packet_size_tx: 0
[INFO] handle: 1971598
[INFO] physical_device_inst: 0
[INFO] vid: 0xef17
[INFO] pid: 0x1960
[INFO] interface_index: 0
[INFO] sub_class: 1
[INFO] protocol: 2
[INFO] max_packet_size_rx: 4
[INFO] max_packet_size_tx: 0
[INFO] handle: 1971600
[INFO] physical_device_inst: 0
[INFO] vid: 0xef17
[INFO] pid: 0x1960
[INFO] interface_index: 0
[INFO] sub_class: 1
[INFO] protocol: 2
[INFO] max_packet_size_rx: 4
[INFO] max_packet_size_tx: 0
[INFO] handle: 1971602
[INFO] physical_device_inst: 0
[INFO] vid: 0xef17
[INFO] pid: 0x1960
[INFO] interface_index: 0
[INFO] sub_class: 1
[INFO] protocol: 2
[INFO] max_packet_size_rx: 4
[INFO] max_packet_size_tx: 0
[INFO] [Config]: Saving salamander config to: "sd:/retroarch/retroarch-salamander.cfg".
[INFO] [Config]: Saved new config to "sd:/retroarch/retroarch.cfg".
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] [Video]: Average monitor Hz: 59.941258 Hz. (0.958 % frame time deviation, based on 2048 last samples).
[INFO] [Video]: Average monitor Hz: 59.941258 Hz. (0.958 % frame time deviation, based on 2048 last samples).
Final log is for the Logitech K600 TV. Things of interest:
- The dongle reports three devices according to the
interface_indexlines. I assume a keyboard and mouse are two of those devices, no idea what the third would be. The storage for the configurable firmware maybe? - RetroArch does explicitly fail to find an entry for the USB receiver (or perhaps just one of the three devices?). Like the THEC64 joystick, this also results in the GamePad disconnecting. Seems related.
[INFO] RetroArch 1.9.13 (Git 121ca3a482)
[INFO] === Build =======================================
[INFO] Capabilities:
[INFO] Built: Dec 2 2021
[INFO] Version: 1.9.13
[INFO] Git: 121ca3a482
[INFO] =================================================
[INFO] [Input]: Found input driver: "wiiu".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] Version of libretro API: 1
[INFO] Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Video @ 960x720
[INFO] [hid]: initializing
[INFO] [hid]: starting polling thread.
[INFO] [Input]: Found HID driver: "wiiu".
[INFO] [hid]: polling thread is starting
[INFO] [Joypad]: Found joypad driver: "wiiu".
[INFO] [Video]: Setting refresh rate to: 59.940 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Video]: Found display server: null
[INFO] [Display]: Found display driver: "gx2".
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [Font]: Using font rendering backend: stb-unicode.
[INFO] [SRAM]: SRAM will not be saved.
[INFO] [Playlist]: Loading history file: [sd:/retroarch/content_history.lpl].
[INFO] [Playlist]: Loading history file: [sd:/retroarch/content_music_history.lpl].
[INFO] [Playlist]: Loading favorites file: [sd:/retroarch/content_favorites.lpl].
[INFO] handle: 1971610
[INFO] physical_device_inst: 0
[INFO] vid: 0x6d04
[INFO] pid: 0x2bc5
[INFO] interface_index: 0
[INFO] sub_class: 1
[INFO] protocol: 1
[INFO] max_packet_size_rx: 8
[INFO] max_packet_size_tx: 0
[INFO] handle: 1919083
[INFO] physical_device_inst: 0
[INFO] vid: 0x6d04
[INFO] pid: 0x2bc5
[INFO] interface_index: 1
[INFO] sub_class: 1
[INFO] protocol: 2
[INFO] max_packet_size_rx: 8
[INFO] max_packet_size_tx: 0
[INFO] handle: 2063277
[INFO] physical_device_inst: 0
[INFO] vid: 0x6d04
[INFO] pid: 0x2bc5
[INFO] interface_index: 2
[INFO] sub_class: 0
[INFO] protocol: 0
[INFO] max_packet_size_rx: 32
[INFO] max_packet_size_tx: 0
[INFO] Failed to find entry for vid: 0x6d04, pid: 0x2bc5, name: USB Receiver
[INFO] [Config]: Saving salamander config to: "sd:/retroarch/retroarch-salamander.cfg".
[INFO] [Config]: Saved new config to "sd:/retroarch/retroarch.cfg".
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] [Video]: Does not have enough samples for monitor refresh rate estimation. Requires to run for at least 4096 frames.
[INFO] [Video]: Does not have enough samples for monitor refresh rate estimation. Requires to run for at least 4096 frames.
Steps to reproduce the bug
- Start RetroArch.
- Plug some USB stuff.
- Don't profit.
or
- Plug some USB stuff.
- Start RetroArch.
- Don't profit.
Bisect Results
Discussed in the previous issue, came with the HID rewrite.
Version/Commit
- RetroArch: 121ca3a plus #13308 from @gblues
Environment information
- OS: Wii U, 5.5.5 PAL
- Compiler: official libretro-build-wiiu Docker image
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Wii U input, HID, and joypad drivers identified in the logs, then reproduce the issue with the THEC64 joystick and Logitech K600 while tracing device connection and slot assignment. Done means unsupported HID devices are ignored or handled safely, supported devices remain usable, and the Wii U GamePad is not disconnected or mislabeled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100