New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 668872 link

Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Unexpected "Unknown device" in Gamepad API

Reported by dory.n.m...@gmail.com, Nov 27 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36

Steps to reproduce the problem:
1. Connect a USB gamepad to the computer.
2. Launch the browser.
3. Open a web page that utilizes gamepad API (for example, html5gamepad.com), and press any button on the gamepad.

What is the expected behavior?
Only one gamepad is available in the API.

What went wrong?
Not only the gamepad connected to the computer, but also a device whose ID is "Unknown Device" was listed in Gamepad API. Its timestamp was never updated.

Did this work before? N/A 

Chrome version: 54.0.2840.99  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 23.0 r0

In further investigation, it disappeared from the API when I disabled "HID-compliant touch screen" in the device manager,  (also, it appeared when I re-enable it). It is possible that the browser wrongly regarded the touch screen as a gamepad.

I was able to reproduce this issue with Chromium for Windows 57.0.2935.0.
 

Comment 1 by ajha@chromium.org, Nov 28 2016

Components: Blink>GamepadAPI
Labels: M-54
Cc: sureshkumari@chromium.org
Labels: Needs-Feedback
Unable to reproduce the issue on windows-7 and windows-10 using chrome stable version 55.0.2883.75 and latest canary 57.0.2938.0 with the steps mentioned above.
Please find the attached screen-cast and could you please let us know if anything missed here to reproduce the issue.

Thanks..
668872.mp4
290 KB View Download
Thank you very much for your response!

I investigated more, and now I'm more confident that this is an issue with touch screen
(I'll describe more details below).
Therefore, could you test it again with a device
which has "HID-compliant touch screen" listed and enabled in the device manager,
as in the attached screenshot (device_manager.png)?
I guess tablets and some laptops should have it.
 (the display of my laptop is not a touch screen, but it's listed somehow)

Also, I attached my screenshot of html5gamepad.com (html5gamepad.png).

Thanks!

-----------

# What I found so far:

SUMMARY:
The code doen't check UsagePage before checking UsageID, and it makes browser consider a touch screen as a "JoyStick".

DETAIL:
I found that "HID-compliant touch screen" device in my laptop has the following info:
- UsagePage : 13 (0x0D)
- UsageID : 04
According to USB UsagePage spec, it means "Digitizers" / "Touch Screen" respectively, and seems correct.
(See p103 of http://www.usb.org/developers/hidpage/Hut1_12v2.pdf )

On the other hand, game pad devices should have the following info (See p26 of the spec):
- UsagePage : Generic Desktop (0x01) 
- UsageID : JoyStick (04) or GamePad (05) or Multi-axis Controller (08)

However, in RawInputDataFetcher::ParseGamepadInfo,
it seems like the code checks UsageID (= hid.usUsage) without checking UsagePage when it enumerates devices.
https://cs.chromium.org/chromium/src/device/gamepad/raw_input_data_fetcher_win.cc?l=278

This makes browser consider a touch screen as a "JoyStick" since both UsageIDs are 04.

device_manager.png
87.7 KB View Download
html5gamepad.png
62.9 KB View Download
Owner: bajones@chromium.org
Status: Assigned (was: Unconfirmed)
Nice analysis of the issue, thanks! Should be pretty easy to solve, assuming that's the case. Hardest part will be hunting down a touch screen like the one you mentioned for verification. :)
I can confirm this bug is happening for me too still.

On the same computer with Chrome 57 on both OSs, I get the bug when running Windows 10 but not when running Ubuntu 17.04. The user-agent string in question is Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

The laptop I'm using is a Yoga 2 Pro and the touch screen ID is 04F3:016F, if that helps track a device down.

Sign in to add a comment