http://bugs.winehq.org/show_bug.cgi?id=34297
Bug #: 34297 Summary: Allow reconnecting to disconnected joysticks Product: Wine Version: 1.7.0 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: directx-dinput AssignedTo: wine-bugs@winehq.org ReportedBy: achurch+wine@achurch.org Classification: Unclassified
Created attachment 45660 --> http://bugs.winehq.org/attachment.cgi?id=45660 Proof-of-concept patch
Currently, if a joystick is disconnected and then reconnected (because the cable is pulled out, for example), Wine acts as though the joystick is present but stuck at the last state it reported, and it fails to report any subsequent changes in device state, which is an arguably suboptimal user experience.
The attached patch (against 1.7.0) changes the Linux evdev driver to attempt to reopen a joystick device after a read fails. This patch uses the simple heuristic of "if it's on the same device file and has the same name, it's the same joystick", which means (1) it won't reconnect if the device file changes and (2) it could falsely reconnect if there are multiple input devices with the same name, but it works for simple circumstances.
Naturally, one could iterate over all possible input devices to try and find the device, but that could be fairly expensive to do on every poll operation, and it would probably involve concurrency issues relating to checking whether the device is already known as a different joystick. In the long run, it might be better to monitor the /dev/input directory for added and removed devices (perhaps using inotify) and use those events to handle reconnection.
http://bugs.winehq.org/show_bug.cgi?id=34297
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |hardware, patch
http://bugs.winehq.org/show_bug.cgi?id=34297
--- Comment #1 from Vincent Povirk madewokherd@gmail.com 2013-08-19 17:29:13 CDT --- Wouldn't it make more sense to report the disconnection to the app in this case?
http://bugs.winehq.org/show_bug.cgi?id=34297
--- Comment #2 from Andrew Church achurch+wine@achurch.org 2013-08-19 18:02:05 CDT --- I looked over the DirectInput interface and didn't see any method for reporting that, which is why I took the reconnect route. That said, I'm not at all familiar with DInput so if there's a better way to handle dead devices, that's fine too.
https://bugs.winehq.org/show_bug.cgi?id=34297
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |00cpxxx@gmail.com, | |winetest@luukku.com
https://bugs.winehq.org/show_bug.cgi?id=34297
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |STAGED CC| |leslie_alistair@hotmail.com Staged patchset| |https://github.com/wine-sta | |ging/wine-staging/tree/mast | |er/patches/dinput-reconnect | |-joystick Ever confirmed|0 |1
https://bugs.winehq.org/show_bug.cgi?id=34297
Rémi Bernon rbernon@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rbernon@codeweavers.com
--- Comment #3 from Rémi Bernon rbernon@codeweavers.com --- I tested that scenario recently and I believe it greatly improved. Could you check if you still see the buggy behavior with current Wine HEAD?
https://bugs.winehq.org/show_bug.cgi?id=34297
--- Comment #4 from Andrew Church achurch+wine@achurch.org --- DirectInput joystick handling in f712a98d seems to handle disconnect/reconnect fine, with the reconnect being transparent to applications (tested with Astebreed v1.21: http://edelweiss.skr.jp/works/astebreed/index.html). Thanks for your work on the code!
https://bugs.winehq.org/show_bug.cgi?id=34297
--- Comment #5 from Rémi Bernon rbernon@codeweavers.com --- Thanks for the confirmation!
https://bugs.winehq.org/show_bug.cgi?id=34297
Rémi Bernon rbernon@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |022076532fcc81fd6f7ebbb7741 | |9670ce93b995a Status|STAGED |RESOLVED Resolution|--- |FIXED
https://bugs.winehq.org/show_bug.cgi?id=34297
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.20.