简体   繁体   中英

Navigator.getGamepads() doesn't return different instances of the same type of gamepad

As the title says, I don't get 2 different gamepads for the same type of controller (yes, I can see them in the Control Panel joy.cpl )

ie using Windows I can see in joy.cpl the following list:

Controller (XBOX 360 for Windows)
Saitek Pro Flight X-56 Rhino Stick
Saitek Pro Flight X-56 Rhino Throttle
6B Controller
6B Controller

while in Chrome (v84) I only get this:

Array.from(navigator.getGamepads()).map(g => g.id);
// [
//  "Xbox 360 Controller (XInput STANDARD GAMEPAD)"
//  "6B controller (Vendor: 0ca3 Product: 0024)"
//  "Saitek Pro Flight X-56 Rhino Throttle (Vendor: 0738 Product: a221)"
//  "Saitek Pro Flight X-56 Rhino Stick (Vendor: 0738 Product: 2221)"
// ]

I was trying to investigate how to differentiate them if there were the same type, but it comes that I don't even get them...

Any way to get the 2nd 6B Controller ?

Edit After testing with a newer Chrome version, I can confirm that is working now... so probably was an issue in an older version and it's fixed:)

I just did a quick test and plugged in two identical gamepads into my machine, and both were detected:

0: Gamepad {id: "Xbox 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)", index: 0, connected: true, timestamp: 222286.67000000132, mapping: "standard", …}
1: Gamepad {id: "Xbox 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)", index: 1, connected: true, timestamp: 245434.25500000012, mapping: "standard", …}

Have you tried waking both controllers up (by pressing a button) before calling navigator.getGamepads() ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM