Commit Graph

8 Commits

Author SHA1 Message Date
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
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