| Summary: | disconnecting and reconnecting game controller from/to system does not generate button/axis events | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Rafael Kitover <rkitover> |
| Component: | joystick | Assignee: | Sam Lantinga <slouken> |
| Status: | NEW --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus |
| Version: | 2.0.10 | Keywords: | target-2.0.16 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
|
Description
Rafael Kitover
2019-12-06 07:36:03 UTC
I solved this problem in our app by falling back to polling the controllers on an interval after calling SDL_PollEvent(). The ADDED/REMOVED events allow for having a valid device handle. Just to be clear, did you work around a problem in SDL or was this fixing the app to use the API correctly? It's a common mistake to confuse device indexes and instance IDs for controllers. Plugging the same controller again will give it a different instance_id (and definitely can't use the existing SDL_GameController pointer without reopening the device). I'm trying to decide if we have a bug to fix in SDL or if this bug can just be closed as resolved. --ryan. This is my joystick handler: https://github.com/visualboyadvance-m/visualboyadvance-m/blob/master/src/wx/widgets/wx/sdljoy.h https://github.com/visualboyadvance-m/visualboyadvance-m/blob/master/src/wx/widgets/sdljoy.cpp As far as I know I am following the API correctly. I am closing the device and obtaining a new device pointer on a device added event. I've tried various variations of this, and it makes no difference. |