You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe SDL expects no updates to return values of SDL_JoystickNameForIndex or SDL_NumJoysticks inbetween SDL event pumping and / or SDL_JoystickUpdate. Otherwise there might be race conditions.
Imagine these steps in an app:
A user asks SDL for the number of connected joystick devices
User disconnects the USB device
User takes device count from step 1. to loop over SDL joystick devices to ask for their name
I don't think our driver respects this.
We should check if / how other backends take care of this.
See #30 for another description of this / why I think this is violated.
The text was updated successfully, but these errors were encountered:
I started messing with caching the device list locally and only sync to the 'real' list on JoystickDetect but SDL backend was calling things in a way I didnt expect. (I.e GetNumofJoysticks was being called before JoystickDetect() on hotplugs for example which messed with my inital plans.
Ive looked into this more and to do it properly you must only pump hotplug connection events (SDL_PrivateJoystickRemoved and SDL_PrivateJoystickAdded) in JoystickDetect(). I was doing in the usb stack callbacks, instead these should only queue device removal/additions in the SDL backend.
I think JoystickDetect() should do this (in this order):
Resync with usb backend
process queued device removal/connection events
I havent got a working prototype yet, but some quick testing seems like this could work.
I believe SDL expects no updates to return values of
SDL_JoystickNameForIndex
orSDL_NumJoysticks
inbetween SDL event pumping and / orSDL_JoystickUpdate
. Otherwise there might be race conditions.Imagine these steps in an app:
I don't think our driver respects this.
We should check if / how other backends take care of this.
See #30 for another description of this / why I think this is violated.
The text was updated successfully, but these errors were encountered: