-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Axes value stuck at +/- Infinity or zero #150
Comments
Are you seeing this on Chrome for Windows? Can you link to product pages for the devices you'd like to see supported? If it's a HID device you may be able to use WebHID to access the raw input reports, for example here's a page that reads inputs from a DualSense controller: https://nondebug.github.io/dualsense/dualsense-explorer.html |
Yes, I am using Chrome on windows. The dualsense page did not find my devices, but that was an interesting suggestion, thanks! So the controller I am currently testing on is this |
I suspect the turntable inputs are implemented in HID as relative inputs, which would explain the wrapping behavior in Windows joystick tester. In Chrome on Windows, axis inputs are read using HidP_GetScaledUsageValue or HidP_GetUsageValue and then normalized using the physical bounds (for scaled usages) or the logical bounds. I'm guessing there's something wrong with either the physical or logical bounds reported by the device that's causing Chrome to divide by zero during normalization. If you can capture the HID report descriptor from the device then I can take look and see what's going wrong. (If you can't get the raw HID report descriptor, connect to the device in WebHID Explorer and copy the "Device info" text box.) Currently, the Gamepad API spec only considers joystick-like inputs. For joystick axes, we need to know their minimum and maximum values in order to normalize to the Standard Gamepad's [-1.0,+1.0] axis range. On some platforms, bounds information may not be available for relative inputs. (For instance, on Linux relative axes are delivered as EV_REL input events which have no associated bounds information.) We also need to recognize when the axis is reporting an "at rest" value so we can detect when the user is not interacting with the axis. For a relative axis with no recentering behavior, the axis could report any value at rest so we need to watch for changes in the input. I filed https://crbug.com/1213273 to document the ID and axis issues in Chrome. |
HID Explorer is nice tool. Here is the device info
Physical Bounds are just not specified here. |
Thanks! Actually, it looks like both turntables use Absolute inputs with reasonable Logical bounds. Physical bounds aren't required and usually aren't provided for joystick axes. I think it's just a bug in Chrome. See https://crbug.com/1213273#c1 I'm closing this issue since there aren't any spec-related changes required to support this device. |
I have gamepads that are not the standard gamepad, (e.g. rhythm game controllers, custom axis behavior)
In windows joystick tester, the axis works fine, goes from left to right and wraps around,
but in the browser I am only getting -Infinity, 0, or Infinity.
I would assume what is happening is it is dividing by zero when converting the axis value to a number between 0.0~1.0
I am guessing standard joysticks report what their max axis values are and the gamepad lib just reads it and divides.
And if a gamepad is not aware of this field or maybe this gamepad is explicitly and incorrectly returning zero then this problem happens.
Is it possible to just expose the raw axis value + the "reported" max axis value in addition to the current calculated 0.0~1.0 so that in the rare cases that we are stuck with niche hardware reporting max value 0, we have a means of working around it?
Also how can I help get this done
The text was updated successfully, but these errors were encountered: