This bug report was migrated from our old Bugzilla tracker.
Reported in version: HG 2.1
Reported for operating system, platform: Windows 10, x86_64
Comments on the original bug report:
On 2020-04-02 20:57:34 +0000, Anthony Heathcoat wrote:
Using SDL revision 31702522ddbc
In short, when unplugging a joystick, SDL sends a correct remove event, but also sends a remove event followed by an added event for all the other joysticks on the system as well.
-- The setup:
I have 3 joystick devices connected: one actual flight stick, a throttle, and a steering wheel.
My program uses SDL_AddEventWatch to watch for add/remove events and act accordingly so it can continue to use a replugged joystick like nothing happened. I am using polling for button and axis state.
-- At runtime:
When unplugging just one joystick, I would expect to get just one removed event. Here's what happens instead:
Nothing special happens for about 23 seconds, everything continues to work except the joystick that was unplugged.
I get 3 separate SDL_JOYDEVICEREMOVED events, one for each joystick on the system.
About 7 seconds pass where no joysticks work for polling state, not even the ones still connected.
I get 2 SDL_JOYDEVICEADDED events, one for each of the joysticks that were never unplugged. My program picks this up, does the necessary work, and now the 2 that were never unplugged become pollable again. (However, opening haptics on the new instance of the wheel produces a haptic device that opens successfully but fails to run any events but this part may be my bug.)
As of now my program can't tell which of the 3 removed events are for joysticks that were really removed, because functions that query joystick layout and state continue to return valid values for all 3 devices.
This bug report was migrated from our old Bugzilla tracker.
Reported in version: HG 2.1 Reported for operating system, platform: Windows 10, x86_64
Comments on the original bug report:
On 2020-04-02 20:57:34 +0000, Anthony Heathcoat wrote: