Windows: SDL DirectInput enumeration in sceVideoOutOpen blocks forever on a HID device, so video out never opens #1042
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-07T03:09:33Z.
On a Windows 11 machine with several vendor HID devices,
VideoOutDriver'sSDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER)never returns. The main thread sits in SDL's DirectInput joystick enumeration, in aDeviceIoControlissued byHidD_GetProductStringfor one of the devices. Every title reaches this call throughsceVideoOutOpen, so nothing gets past video-out open on such a machine. The code is onmain(0c952fe5) and is not specific to one title.Environment
4b69833b.Reproduction
guest_video_out_wqhd_detectiontimes out at 20 s on every run (CI-equivalent build:-G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON). The other 377 tests pass, with 0 skipped. The test does nothing device-related; it fails becausesceVideoOutOpenconstructsVideoOutDriver.gdb attached to the hung process, main thread:
Only
[time] scheduler tick raised to 0.5 msis printed before the hang.SDL_DIRECTINPUT_ENABLED=0in the environment the test passes in 0.13 s.schtasks /ITin the logged-on user's session instead of over SSH, it hangs the same way, so it is not a session-0 effect.Notes
SDL's own
SDL_DINPUT_JoystickInitguards the DirectInput path withSDL_HINT_DIRECTINPUT_ENABLEDand comments: "In some environments, IDirectInput8_Initialize / _EnumDevices can take a minute even with no controllers." Here it does not return at all.PadInput::openFirstAvailableControlleralready setsSDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, and the controllers the project documents (docs/user/INPUT_MAPPING.md) are covered by SDL's XInput, RawInput and HIDAPI backends. Possible directions, none chosen here:SDL_HINT_DIRECTINPUT_ENABLEDto0inVideoOutDriverbeforeSDL_InitSubSystem, so DirectInput-only devices are not detected but video out always opens.SDL_INIT_GAMECONTROLLERon a separate thread with a timeout and continue without pads if it does not finish.SDL_DIRECTINPUT_ENABLED=0as a workaround indocs/user/INPUT_MAPPING.md.I can test a change for any of these on this machine.
Investigated with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T08:54:57Z.
Your issue report offered to test a change. PR #1050 is now the sole open PR for this fix; the other overlapping PR was closed. A Windows test on a machine with many HID devices passed but did not reproduce the hang, so confirmation on the original reproducing setup is still needed. Could you test #1050 with the default environment (without
SDL_DIRECTINPUT_ENABLED=0) and report whethersceVideoOutOpenreturns? That would answer the remaining question before merge.Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-10T03:52:33Z.
Confirmed on the reproducing machine: #1050 with the default environment makes
sceVideoOutOpenreturn andguest_video_out_wqhd_detectionpass, both over SSH and in the desktop session, while the unpatched build still hangs the same day. Details: https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6093486267