New issue
Advanced search Search tips

Issue 825368 link

Starred by 4 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Chrome
Pri: 3
Type: Feature



Sign in to add a comment

Dualshock4 vibration requires extra configuration on Linux/ChromeOS

Project Member Reported by mattreynolds@chromium.org, Mar 23 2018

Issue description

On Linux and Linux-based platforms like Chrome OS, support for DS4 haptics requires Read/Write access to the hidraw device node. By default, Linux does not provide this access but it can be granted by adding a udev rules file to the /etc/udev/rules.d/ directory. As an example, here is the rules file used by the ds4drv userspace driver, which is suitable for our purposes:

https://raw.githubusercontent.com/chrippa/ds4drv/master/udev/50-ds4drv.rules

As a workaround, Linux users can install ds4drv to enable DS4 haptics in Chrome as this will install the necessary rules. This can also be done on Chrome OS but it requires that the device is in developer mode. We may be able to work around this on Chrome OS by using the PermissionBrokerClient.

https://cs.chromium.org/chromium/src/device/usb/usb_device_linux.cc?l=63
 
Cc: pnangunoori@chromium.org
Observations on Xbox One Gampepad on Chrome OS device with #67.0.3376.0 - 

Enabled Flag #enable-gamepad-extensions

> https://codepen.io/anon/pen/yKgYGz - Observed in Console upon clicking on any of the button, "No connected gamepad at Index 0" message is displayed.

> html5gamepad.com - Observed that none of the values are displayed upon pressing the buttons on gamepad.

However, when gamepad is connected to the machine, there seems to be a little vibration.
Status: Started (was: Available)
I investigated the PermissionBrokerClient option and discovered that Chrome OS denies access to this device, preventing us from accessing the hidraw node.

Currently we block access to devices that look like they might be mice or keyboards. We do this by checking the capabilities of the device -- absolute inputs, relative inputs, and key inputs. DS4 (and probably most analog gamepads) are blocked because they expose analog sticks, triggers, and D-pads as absolute inputs.

To fix this, we need to improve the Chrome OS detection logic to allow gamepads while still restricting access to pointing devices (mice, touchpads) that may otherwise look similar to a gamepad.

In addition to the absolute capabilities check, the key capabilities check may also cause some gamepads to fail if they expose the Home or Back button as a System key. This is common on Android gamepads.
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 8 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/3fa90e0fd193d87e88fb8bfc8c04d3484855bc73

commit 3fa90e0fd193d87e88fb8bfc8c04d3484855bc73
Author: Matt Reynolds <mattreynolds@google.com>
Date: Fri Jun 08 06:33:27 2018

permission_broker: hidraw access for gamepads

PermissionBroker denies access to the raw HID device node (hidraw) if a
device presents itself over multiple interfaces and at least one of the
interfaces may transmit sensitive data.

The check currently denies access to any device that exposes absolute
pointer inputs. This denies most gamepads, which typically use absolute
inputs for analog axes and triggers.

This CL modifies the check to ignore the axes commonly used by
gamepads. Additionally, the check may be skipped entirely if the device
is recognized by the kernel as a joystick.

BUG=chromium:825368
TEST=existing tests pass

Change-Id: Ic747e5034b8d36125a4b6e7706655f1d3585eada
Reviewed-on: https://chromium-review.googlesource.com/1045517
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Matt Reynolds <mattreynolds@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>

[modify] https://crrev.com/3fa90e0fd193d87e88fb8bfc8c04d3484855bc73/permission_broker/deny_claimed_hidraw_device_rule_unittest.cc
[modify] https://crrev.com/3fa90e0fd193d87e88fb8bfc8c04d3484855bc73/permission_broker/deny_claimed_hidraw_device_rule.cc

Sign in to add a comment