glutanimate / anjoy-public

Temporary repository to host bug reports and documentation for the AnJoy Anki add-on
https://www.patreon.com/glutanimate/posts?tag=AnJoy
4 stars 0 forks source link

Gamepad recognition fails when multiple (erroneous) gamepads registered #7

Open glutanimate opened 5 years ago

glutanimate commented 5 years ago

At the moment, AnJoy will try to recognize the most recently connected gamepad and monitor it for input events. Unfortunately this detection seems to fail when there are multiple gamepads present on the system. This is exacerbated by the fact that Chromium will seemingly recognize HID devices as gamepads that a user would normally not expect it to, such as some touchpads (?), keyboards, or even notebook docks.

A series of debug logs of affected users follows below, illustrating the different types of input devices that are erroneously registered as gamepads by Chromium, which causes AnJoy's somewhat simplistic gamepad selection implementation to fail (htm5gamepad seems to handle this more graciously):

Noname Xbox controller, recognized as Xbox 360 Controller for Windows

Debug log

Original XBOX One S controller (bluetooth)

  • Submitter: Noah (email)
  • System: Windows 10 on a Surface book 2
Debug log

Original PS4 DS4 controller (bluetooth)

  • Submitter: Noah (email)
  • System: Windows 10 on a Surface book 2
Debug log The debug info: ===ANKI=== Anki 2.1.14 (7b93e985) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Windows 10 Flags: frz=True ao=True sv=1 Add-ons: Edit Field During Review Special Fields put ALL due learning cards first fork for 21 Image Occlusion Enhanced for Anki 21 alpha Symbols Night Mode Pop-up Dictionary beta More Decks Stats and Time Left Export cards selected in the Browser Customize Sidebar Progress Bar Highlight Search Results in the Browser Customize Keyboard Shortcuts Button Colours Good Again Progress Graphs and Stats for Learned and Matured Cards Batch Editing Mini Format Pack Add Hyperlink ReMemorize Rescheduler with sibling and logging v114 Frozen Fields add-on window search bar True Retention Syllabus - Anki Statistics and Export by Tag and Deck More Overview Stats 21 Create Filtered Deck from the Browser Web Browser - Search selection Import texts and images automatically AnJoy bettertags Review Heatmap Spell Checker ===ANJOY=== version: 0.1.0-beta.1 [ { "id": "Xbox 360 Controller (XInput STANDARD GAMEPAD)", "index": 0, "connected": true, "timestamp": 704860.6999999974, "mapping": "standard", "axes": [ -0.0038910508155822754, -0.019577383995056152, 0.035294175148010254, -0.027420520782470703 ], "buttons": [ { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 } ], "vibrationActuator": { "type": "dual-rumble", "playEffect": "function playEffect() { [native code] }", "reset": "function reset() { [native code] }" } }, { "id": "Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc)", "index": 1, "connected": true, "timestamp": 704853.6000000022, "mapping": "standard", "axes": [ -0.019607841968536377, -0.003921568393707275, 0.011764764785766602, -0.003921568393707275 ], "buttons": [ { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 }, { "pressed": false, "value": 0 } ], "vibrationActuator": { "type": "dual-rumble", "playEffect": "function playEffect() { [native code] }", "reset": "function reset() { [native code] }" } }, { "id": "Surface Dock Extender (Vendor: 045e Product: 0904)", "index": 2, "connected": true, "timestamp": 126.29999999626307, "mapping": "", "axes": [ 0, 0, 0 ], "buttons": [], "vibrationActuator": null }, { "id": "Unknown Gamepad (Vendor: 045e Product: 0951)", "index": 3, "connected": true, "timestamp": 229.89999999845168, "mapping": "", "axes": [ 0, 0 ], "buttons": [], "vibrationActuator": null }, 4, "function item() { [native code] }" ] Index: 3