Closed BrianAdams closed 7 years ago
The Gamepad API we have been using has been deprecated. The maintainer suggests just using the provided Web APIs
As per your steps for recreating the bug, I am having difficulty recreating it in MOCK mode on my machine. The PS4 controller always comes up when I start cockpit and plug in the gamepad. Am I missing something?
I do realize that these steps produce a bug:
Expected: Full control Actually: No control
I suspect this might fix it:
diff --git a/src/static/js/libs/gamepad.js b/src/static/js/libs/gamepad.js
index 5dc89de..9225f0a 100644
--- a/src/static/js/libs/gamepad.js
+++ b/src/static/js/libs/gamepad.js
@@ -582,7 +582,13 @@
console.log('Not supposed to go here!');
return; // should not happen
}
- if (gamepads.length !== this.gamepads.length) {
+ gamepads.nonNulllength = 0;
+ for (i = 0; i < gamepads.length; i++) {
+ if (gamepads[i]!==null){
+ gamepads.nonNulllength++;
+ }
+ }
+ if (gamepads.nonNulllength !== this.gamepads.length) {
var gamepad, i;
for (i = 0; i < gamepads.length; i++) {
gamepad = gamepads[i];
Trying to find a gamepad to test with
Start cockpit Plugin gamepad
Expected: full control Actually: no control from gamepad