Open vaguerant opened 2 years ago
I will note that the gamepad doesn't get formally disconnected--the "emergency shutdown" button combo (L+R+ZL+ZR+L3+R3) remains functional. For those affected by this issue, that's a bit faster recovery than power cycling the wiiu.
So, the way controller detection works is that we attempt to read the USB device ID, and then we compare that to our list of supported gamepads.
https://github.com/libretro/RetroArch/blame/master/input/connect/joypad_connection.c#L145-L173
Two things of note:
So, what I think is happening is that the Wii U is reading something super-generic like "USB Controller" as the device ID, and the substring search matches it against "Generic SNES USB Controller" and so we get the false match.
Nice work on #13321!
Sorry to bring the bad news, but now that I can actually use my keyboard without the GamePad dropping out, I am seeing some more keyboard-related issues.
EDIT: Tracking the first bug above, my first port of call was b46daac3, immediately before the start of the HID rewrite. Here, keyboard input is only semi-functional, with only about half of the keys working (regardless of the keyboard passthrough setting in the VICE x64 core). I had this issue a while ago in PUAE and assumed it was their issue, but it looks like something is going on with keyboards further up. I'm going to try to track down the last good keyboard commit, then try to find where it degraded each time.
Good old c substring bugs. Classic. The only bug i ever made a pr for retroarch was a 'hidden directory' linux filter that was finding... any directory with a '.' because it was trying to search for the '.' substring.
btw, not to make this post completely meaningless, try the 'game focus mode' before you give up on keyboard cores, because many many of them behave very weirdly with the retropad and hotkeys overlaid on them, which game focus mode on disables.
I even saw some weird behavior with auto deletes keypresses, and i basically disable every single hotkey in retroarch but 'f1'.
Aha, thank you for that. Game Focus is indeed what's causing the only half my keys are working "issue" on older builds. I found that keyboards "just worked" in 1.9.0 stable, while from the 1.9.1 stable until b46daac3, Game Focus needs to be toggled. However, the current state of keyboards seems to be that they don't work in-core at all, Game Focus or not.
As long as we're messing with things, perhaps Game Focus should be configured to default to on for Wii U (EDIT: or even on all platforms that aren't PC/Mac/Linux /EDIT)? Surely, nobody is plugging in their USB keyboard on Wii U to use RetroArch hotkeys. A far more sensible use case would be people wanting to use them to interact with the retro computer cores.
Will continue moving forward through commits to try to find where keyboards broke, although it's difficult due to the issues introduced during the HID rewrite which make it hard-to-impossible to test USB keyboards.
EDIT2: The first commit which didn't just outright crash when I have my keyboard inserted was acd1ba0. Obviously that build also disconnects the GamePad and all of that, but keyboard input is completely nonworking there--should have realized this as there was just a whole PR to get keyboard input working again. So core-side keyboard input does appear to have broken somewhere in the HID rewrite.
On to the subject of automating Game Focus on consoles, I see that the option (Settings -> Input -> Auto Enable 'Game Focus' Mode) is three-way: ON, OFF or Detect. Detect automatically switches Game Focus on in cores which ask for keyboard input. This seems like an extremely sensible default value for all consoles. On Win/Mac/Linux, I can see a situation where you still expect to be able to use your keyboard hotkeys, whereas on console most users who aren't already familiar with this option would expect keyboards to just work in keyboard-supporting cores.
Bonus note, it doesn't look like there's an option in Settings -> On-Screen Display -> On-Screen Notifications -> Notification Visibility to turn Game Focus notifications off. Since most notifications are optional, I don't see any reason Game Focus shouldn't be optional as well.
The notifications honestly shouldn't be optional because then people would complain about 'buggy keyboards' if they forgot they had it on and wanted to use retropad (or any hotkey except the one that toggles the game focus mode). That said, as this issue proves, the keyboards are already buggy.
@gblues I just discovered something about keyboard support that should help in narrowing down what's going on. Keyboard support appears to work if you Load Content from the RetroArch menu, but not if you Start Core directly--supported in most (all?) home computer cores since they generally can do things other than read a disk/tape/etc. I'd say this makes the issue almost entirely resolved: keyboard support is already working except in the specific case that you're running a core without any content loaded.
This used to work (as of b46daac), but doesn't any longer. Is there anything in your HID rewrite which only becomes active when running via Load Content that Start Core is getting left out of?
I can confirm that none of my USB gamepads work any more: "Generic SNES USB controller (0/0) not configured" Same message for all, although they are no "Generic SNES USB controller". I wanted to try an older version, but the oldest one offered to download is 1.9.0. Isn't there an archive? Looking through the commits, I think 1.8.5 could work.
The nightly builds now support USB gamepads again. To test it you just have to know a few things:
tl;dr
Reasons
joypad_autoconfig_dir = "sd:/retroarch/autoconfig/hid"
task_autodetect.c
That's the reason why you always see 0/0
instead of the real VID/PID.
The device names used for lookup are hardcoded in the various input/connect/connect_*.c get_name()
functions.
If you save an autoconfig file, it will contain this device name.Does this issue still happen or has it now been fixed?
Sorry for the late response.
The issue as originally filed no longer occurs, but the fix for the controller disconnection either exposed or caused a second issue, described in these (1) comments (2).
I'll recap the above comments here for better readability:
USB HID keyboards are now broken when running cores contentless. Most of the PC cores for platforms like Commodore 64, 128, Amiga, etc. allow the user to select Start Core and run the system's BIOS or operating system rather than launching directly into content.
When selecting Start Core, keyboards stop working completely. They do not respond within the running core or in the RetroArch menu. Resolving this issue requires a full restart of RetroArch.
When running cores via Load Content, this issue does not occur.
Keyboards worked normally via Start Core as of b46daac3, which was before the HID rewrite, but as the HID rewrite broke keyboards for a while, it's not really possible to get a proper bisect of exactly when the issue started.
I've also attached a log here of booting into VICE x64 fast with some content (a .g64
disk image), using the keyboard normally, then using Close Content followed by Start Core to boot contentless, where the keyboard completely stops working. I don't see anything informative in the log, the HID initializing steps look the same to me and there's nothing alarming as far as I can tell.
Description
Following on from #13198. Keyboards are working again with #13308, but the other HID issues remain. In order of severity:
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:
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 at2021-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:TH
. Its actual name isTHEC64 Joystick
.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.
Final log is for the Logitech K600 TV. Things of interest:
interface_index
lines. 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?Steps to reproduce the bug
or
Bisect Results
Discussed in the previous issue, came with the HID rewrite.
Version/Commit
Environment information