Skip to content

Commit

Permalink
Possible fix for bug 5010 - SDL_Init with SDL_INIT_JOYSTICK hangs for…
Browse files Browse the repository at this point in the history
… 10 seconds when playing audio from another application

Jake Breen

When I run SDL_INIT with SDL_INIT_JOYSTICK it stalls for about 10 seconds (last report was 10,615ms), but only if I'm currently playing audio. (Like in Spotify for example.)

querying something related to device access (last dll loaded)
'BabbysFirst64.exe' (Win32): Loaded 'C:\Windows\SysWOW64\deviceaccess.dll'.

I use a USB DAC because my mobo's audio out is pretty not great. And I've noticed unplugging it seems to solve the issue. I haven't noticed any other issues that are caused by my DAC.

My DAC is the Sound BlasterX G1 https://us.creative.com/p/gaming-headsets/sound-blasterx-g1
Vid = 041E
PID = 3249

My system specs:
- Windows 10 Pro
- Ryzen 2700x
- 16GB Ram
- Nvidia 2070 RTX

Additional USB devices plugged in:
- Valve Index
- Xbox One Elite Controller
  • Loading branch information
slouken committed Mar 2, 2020
1 parent a19757a commit 3b3ae4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/joystick/SDL_joystick.c
Expand Up @@ -1687,10 +1687,13 @@ static SDL_bool SDL_IsPS4RemapperRunning(void)

SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
{
/* This list is taken from:
/* This list (except for marked entries at the top) is taken from:
https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
*/
static Uint32 joystick_blacklist[] = {
/* Sound BlasterX G1 */
MAKE_VIDPID(0x041E, 0x3249),

/* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
/* Microsoft Wireless Desktop - Comfort Edition */
MAKE_VIDPID(0x045e, 0x009d),
Expand Down
3 changes: 2 additions & 1 deletion src/joystick/hidapi/SDL_hidapijoystick.c
Expand Up @@ -413,7 +413,7 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
const Uint16 USAGE_GAMEPAD = 0x0005;
const Uint16 USAGE_MULTIAXISCONTROLLER = 0x0008;
int i;
SDL_GameControllerType type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol);
SDL_GameControllerType type;

if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) {
return NULL;
Expand All @@ -426,6 +426,7 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
return NULL;
}

type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol);
for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) {
SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i];
if (driver->enabled && driver->IsSupportedDevice(device->name, type, device->vendor_id, device->product_id, device->version, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol)) {
Expand Down

0 comments on commit 3b3ae4d

Please sign in to comment.