30 Commits

Author SHA1 Message Date
Asriadi Rahim
bd7cf95cc1 wahoo: usbGadget.cpp: Fix compilation unqualified call to 'std::move'
device/google/wahoo/usb/UsbGadget.cpp:577:14: warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
  mEpollFd = move(epollFd);
             ^
             std::
device/google/wahoo/usb/UsbGadget.cpp:578:16: warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
  mInotifyFd = move(inotifyFd);
               ^
               std::
device/google/wahoo/usb/UsbGadget.cpp:579:14: warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
  mEventFd = move(eventFd);
             ^
             std::
3 warning generated.

Signed-off-by: Asriadi Rahim <asriadirahim03@gmail.com>
2024-06-08 22:09:10 +08:00
Xin Li
40107d2ac0 Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3a1e355f510e6328d05e76ba2961562fe711da1b
Change-Id: I51411eabdf7f95382b4049a26f261b6d7af9aa86
2020-08-31 13:46:03 -07:00
Kyle Tso
4918545e03 Usb: Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference


BUG=162536543

Change-Id: I303f77c2763abab2ea630c451187fadc380eaf52
2020-07-31 09:55:00 +00:00
Howard Yen
e126b9e361 Update USB Gadget HAL to V1.1 implementation
Bug: 138702846
Test: build pass, function works
Change-Id: I80c295a73aa982b09c81b7cbc3f3a1003c273101
2020-02-20 23:05:41 +08:00
Josh Gao
f1a17bc0eb Merge "Enable MS OS descriptors for adb." 2020-01-27 21:41:48 +00:00
Steven Moreland
9b959cb514 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: Iba2cd20b8b20fac3e7564de6b853b475fd4ebd2a
2019-10-02 12:49:15 -07:00
Josh Gao
0a7d54e462 Enable MS OS descriptors for adb.
Bug: http://b/68993980
Test: check_ms_os_desc
Change-Id: I5754065b5fb81c4edeebe9037503f9f4fe53674c
2019-09-05 15:25:52 -07:00
raychi
a56fdd593c Do not enable the funcion when it is not in list
rndis and rmnet cannot co-exist in QCOM spec and
cause ramdump. Besides, enabling functions with
the wrong PID may cause it cannot install proper
PC driver on Windows. A better way is to not allow
enabling the function which is not in support list.

Bug: 130733202
Test: enable tethering with/without rmnet enabled
Signed-off-by: raychi <raychi@google.com>

(cherry picked from commit 79ef1d2d35f3e00ce8ab98ff4a3430af579a5419
and fix merge conflict)

Change-Id: Ia50058f498c5b99ff58251fd7064963ccdbdd940
2019-05-17 17:53:59 +08:00
Jeff Vander Stoep
84304df642 usb HAL: remove all DAC capabilities
We can verify via selinux policy that no capabilies are allowed,
so there's no reason to grant them in DAC. Currently this is
resulting in an selinux denial.

avc: denied { dac_override } for comm="usb@1.1-service" capability=1
scontext=u:r:hal_usb_impl:s0 tcontext=u:r:hal_usb_impl:s0
tclass=capability permissive=0

Test: build
Change-Id: Iddea654be7c8f374a2c5f3c4fbebf066deca1796
2019-02-06 15:02:11 -08:00
Chih-Hung Hsieh
1dcb87eee2 Fix performance-for-range-copy warnings
Bug: 30413223
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance*
Change-Id: Ia47cc330399e3d524da90109deb2d736e6fe056b
2018-12-12 13:46:20 -08:00
Badhri Jagan Sridharan
a063ae4f55 usb gadget hal: Increase disconnect timeout
Increase disconnect timeout from 10ms to 100ms for the host ports which
dont strictly adhere to the spec to sense disconnect.

This is a work around given that some of the root ports dont detect
it. From the USB 2.0 spec guidelines, the disconnect should be
detected in 2.5us.

From the USB 2.0 spec (pg 186)
Time to detect a disconnect event
at a hub’s downstream facing port
TDDIS Section 7.1.7.3 2 2.5 µs


Bug: 110412433
Test: Walleye entering accessory mode in USB 3.0 with IOGear cable
and USB 3.0 host.

Change-Id: I8d8f62dc1a7bcbc9c7727c51cad7f3cb07ba6b50
(cherry picked from commit 28ad0a90cf)
2018-08-16 16:39:04 +00:00
Jerry Zhang
9515673027 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
2018-05-01 21:34:14 +00:00
TreeHugger Robot
ab5ad5f733 Merge changes from topic "oem_functions_for_wahoo" into pi-dev
* changes:
  set usb oem functions to diag,serial_cdev,rmnet_gsi by default
  Set VID/PID for diag functions
2018-03-27 16:48:58 +00:00
Badhri Jagan Sridharan
c5ec9e09d1 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
2018-03-23 17:07:46 -07:00
Jerry Zhang
0c556bbbac Mount ptp separately from mtp
Ptp is now mounted in its own directory so the
mtp endpoint does not need to be closed to write
the ptp descriptors.

Bug: 72877174
Test: switch config to mtp/ptp
Change-Id: I9cec66eeb882fbf23851cdaf2e3906e8b3150b0a
2018-03-05 14:15:05 -08:00
Badhri Jagan Sridharan
cb840d8de7 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
2018-01-31 00:43:09 -08:00
Badhri Jagan Sridharan
5e309b9248 Usb Gadget hal implementation for wahoo
(cherry-pick of commit: e9af4669659c306a9c9b1a1ae3a1313a7631357d)

Bug: 63669128
Test: Tested USB gadget configurations and verified
that they enumerated.
Change-Id: If0f98697488f6c7cfe335d4c292acebaaba6c20f
2018-01-26 22:23:05 +00:00
Chih-Hung Hsieh
456f1bb4ef Use -Werror in device/google/wahoo am: 7d0bdbefcd am: 3d6511ce09
am: be8cb41927

Change-Id: I25651013fdd066d350c8caf98a496969cc4a452d
2017-11-06 19:31:36 +00:00
Chih-Hung Hsieh
be8cb41927 Use -Werror in device/google/wahoo am: 7d0bdbefcd
am: 3d6511ce09

Change-Id: I56ba4e810219bb3ea1c58d84cb032deb90bb03b6
2017-11-06 19:22:31 +00:00
Chih-Hung Hsieh
7d0bdbefcd Use -Werror in device/google/wahoo
* Remove unused variables.
* Return result of registerAsService().

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I79d1add6190e835de20a0b0c247bbbb259096c14
2017-11-02 15:26:20 -07:00
Jaekyun Seok
cc0d522669 Add 'vendor.' prefix to a vendor HAL service name
To prevent property name collisions between properties of system and
vendor, 'vendor.' prefix must be added to a vendor HAL service name.
You can see the details in http://go/treble-sysprop-compatibility.

Test: succeeded building and tested on a walleye device
Bug: 36796459
Change-Id: Idc995c550657feca5e0f934444a31805bc3538f9
2017-08-31 12:51:25 +09:00
Wei Wang
5934d8aab5 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
2017-08-15 13:40:11 -07:00
Yueyao Zhu
b9cd118403 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 Google 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
2017-07-26 10:41:32 -07:00
Yueyao Zhu
42d5bf7c24 USB: HAL: run as user root, group root system
This allows USB HAL to write USB sysfs nodes.

Bug: 38352281
Change-Id: Iaf8f1bad1a0394e553996b7a42bc34745b769b16
2017-07-24 19:49:17 -07:00
Badhri Jagan Sridharan
07caa115dc USB HAL: Use 1.1 IUsb intead of 1.0 IUsb
Use 1.1 IUsb in order to make register the service as 1.1 compatible.
This enables lshal to recognize the hal service as 1.1 implementation.

Bug: 62917546
Test: Manually verified lshal output
android.hardware.usb@1.0::IUsb/default   0/1             782     6024 568
android.hardware.usb@1.1::IUsb/default   0/1             782     6024 568

Change-Id: I9b0817841dbcc345a1d854ee4a5193797181ea3f
2017-06-27 17:03:49 -07:00
Badhri Jagan Sridharan
cb3e84691f Usb: HAL: Update wahoo HAL
This CL rebases wahoo HAL based on the kernel change to update
sysfs interface.

https://partner-android-review.googlesource.com/#/c/836088/

Bug: 62272992
Test: Verify USB dialog on wahoo
Change-Id: I8bc8f494176c7648abeb9783fbd18dc837793bda
2017-06-13 17:23:08 -07:00
Badhri Jagan Sridharan
fc32e28be9 USB: HAL: update wahoo hal to V1_1
This CL adds support to notify frameworks when an audio
or debug accessory is attached.

Bug: 36604276
Test: Manually test inserting an Audio accessory.
Change-Id: I9ec0f88ed85ed593b31132ba58bfedb51a435cd8
2017-04-26 21:09:10 +00:00
Badhri Jagan Sridharan
49e7f44507 USB: HIDL: check the status of registerAsService
registerAsService call could fail. Hence check the return value.

Bug: 36704362
Change-Id: I46dcd74dbee6aba72cf344f10854e5d4b1b6de18
2017-04-04 10:38:37 -07:00
Badhri Jagan Sridharan
dfc1cbd1d9 The IUsb interface uses "default" service name
By default, it is expected that the service does not rename itself
unless there is more than one service exposed by the interface. This
CL changes the usb hal service name back to "default" instead of
"usb_hal"

Bug: 36097487
Test: Manually tested role swap and UI behavior
Change-Id: I4a0aa4423c80cd893c578bc58b9276956daba732
2017-03-28 14:28:16 -07:00
Badhri Jagan Sridharan
1cf5094895 USB HAL: type-c hal for muskie/walleye
Bug: 36097487
Test: Manually tested role swap and UI behavior
Change-Id: I5ce520da521e0714001b60164ac850dddbd644c3
2017-03-27 20:18:35 +00:00