Commit Graph

13 Commits

Author SHA1 Message Date
29e9a2a31c mata: Allow USB HAL to access dual_role_usb nodes
Since we're running the HAL as root but are NOT granting the
dac_override capability, we need to change the permissions on
these nodes so the HAL can properly access them.

Change-Id: I5ad86f43f1f32216dfd34c63c519e0c50b756997
2019-01-02 02:21:35 +01:00
912db8227c Add audio_source combinations to usb hal
This allows android auto and accessory hid
to both work, and matches functionality
on other device in O.

Bug: 74172000
Test: auto starts
Change-Id: I786cd66bed015c5ad2a4ca668f0d0fbc9c8af507
2019-01-02 02:21:08 +01:00
031db1fb30 Set VID/PID for diag functions
persist.vendor.usb.config stores the vendor specific functions that are
enabled in the target when ro.bootmode is set to usbradio through
the adb command. Since its a persistent property, the oem functions
are persisted once enabled. Alternatively, store the oem functions
in vendor.usb.config. vendor.usb.config is not persisted though.
vendor.usb.config will also reflect the enabled oem functions.

Configurations supported in this CL:
1. diag
2. diag,serial_cdev,rmnet_gsi

This would work irrespective of when ADB is not or not.

Bug: 74603740
Test: Made sure the QXDM recognized wahoo when adb is enabled/
disabled for diag and diag,serial_cdev,rmnet_gsi
Change-Id: Icbbe177e3f8958efc36f67692b9ec935b718fb03
2019-01-02 02:20:48 +01:00
0ec677b9ef Initialize booleans
Since mMonitorCreated wasnt initialized to false, join was called
on the thread eventhough the thread didnt exist.

Bug: 72691300
Test: Booted asan and verified that adb was enabled.
Change-Id: Iafb529b66084fbe196d6c8b10fabd62a5ec8ec4a
2019-01-02 02:20:22 +01:00
841419065a Usb Gadget hal implementation for mata
(cherry-pick of commit: e9af4669659c306a9c9b1a1ae3a1313a7631357d)

Bug: 63669128
Test: Tested USB gadget configurations and verified
that they enumerated.
Change-Id: If0f98697488f6c7cfe335d4c292acebaaba6c20f
2019-01-02 02:20:02 +01:00
6eaa9024c4 mata: usb: const -> constexpr
Change-Id: I401fa5413779620efb2c45425c640b6dd5090114
2019-01-02 02:19:43 +01:00
f541fa8cf9 usb: Convert writeFile to fstream
Change-Id: I9ceb1752481d7daf263f0b89c2c8964b532055d1
2019-01-02 02:19:29 +01:00
ebfe7d33e5 mata: usb: Check if audio device is connected by querying for sound cards
Change-Id: Ica0eecf245f35817439259813c74faf22e21dc30
2019-01-02 02:18:59 +01:00
1d6f357116 USB: HAL: run as user root, group root system
This allows USB HAL to write USB sysfs nodes.

Bug: 38352281
Change-Id: Iaf8f1bad1a0394e553996b7a42bc34745b769b16
2019-01-02 02:18:43 +01:00
99bb00cb31 USB: HAL: enable auto suspend for USB headsets
Adds a thread that handles add uevents of USB devices, and
enables auto suspend on that USB device (i.e. set power/control
to auto) if the device idProduct/idVendor is whitelisted.

The android kernel will already autosuspend audio devices,
however this enables autosuspend for the Essential USB-C to
3.5mm adapter, which presents an HID-only interface when
no 3.5mm headset is connected.

Test: with the selinux and .rc changes for access permission
- MIR without headset: power/control set to auto
- MIR with headset: power/control set to auto
- regular mouse: power/control set to on

Bug: 38352281
Change-Id: I81572584ea02f6bdc814e70ab3439ab86c34a50a
2019-01-02 02:18:27 +01:00
b37ce569c6 Fix potential racing by wall time change in USBhal
pthread_cond_timedwait used wall time so it might introduce racing,
pthread_cond_timedwait_monotonic_np is Android specific but it is being
deprecated. And now Android support pthread_condattr_setclock so use it
to wait on CLOCK_MONOTONIC instead.

Bug: 64623895
Test: USB switch function works, charging/MTP/PTP
Change-Id: I136533ff90ef1be2b042ef1e0829643f2f7aa968
2019-01-02 02:18:04 +01:00
8993050e16 mata: usb: Update to usb@1.1
Change-Id: Iff7aaeaca6f54f53442e89952485afbed2c297c1
2019-01-02 02:17:34 +01:00
7803f3bd63 mata: Import USB HAL from hardware/interfaces
Copied from 01787f47f4ee024889c13ec3a2b30624f6d5745d

Change-Id: I85c41fa0844adea68336a368de3bec1f5a60d3d9
2019-01-02 02:16:53 +01:00