In the kernel, it is possible for the DisplayPort Alt Mode
driver to queue an Enter Mode message to the tcpm and have
that message be interupted by a Power Role or Vconn swap,
which results in the Port Partner never entering Alt Mode.
Add a debounce that checks to make sure that the port partner
enters Alt Mode when DisplayPort Alt Mode is active on the
port. On trigger, reattempt to send Enter Mode through the
tcpm up to 2 times.
Test: Manual test on device - put device into Preferred
Source role, test to see if Alt Mode reentry triggers
when original entry is interrupted by PR Swap from
monitor.
Bug: 308383356
Change-Id: I96563c9900a01e428850e4873371bcdb0225aa07
Signed-off-by: RD Babiera <rdbabiera@google.com>
Report COMPLIANCE_WARNING_INPUT_POWER_LIMITED instead of
COMPLIANCE_WARNING_OTHER to flag incompatible chargers. The underlying
logic that generates the warning remains the same, what's changed is
the enum that's being used.
The purpose of the change is to have a warning type that better
represents what actually happens and free up COMPLIANCE_WARNING_OTHER
that was intended to act as a fallback reason code.
The flag enable_input_power_limited_warning controls whether to switch
to the new enum, while the flag enable_usb_data_compliance_warning
controls the new enums that are added as FlaggedApi in the framework.
Both flags need to be on to enable the change.
Bug: 308700954
Test: manual tests with local flag override
Change-Id: I6595706d1b83d533fc2d3e29086773270e045ede
Upload metrics for the last data session that just ends upon
data role changes. The change is purely metric collection and
does not change any business logic.
Bug: 297224564
Test: Trigger metric upload for both host and device mode and
verify it by statsd_testdrive
Change-Id: I823ae8712b7914cfc7f6c6379acb3749d13c0974
Query the port partner's SVIDs when the DisplayPort driver sysfs
is not recognized so that the USB HAL can identify whether or not
the port partner supports Thunderbolt.
Test: manual verification on device - test to see that cableStatus
is set to NOT_CAPABLE on hub that supports Thunderbolt but not
DisplayPort Alt Mode. Then verify that device not capable of being
a DisplayPort sink but does support Thunderbolt does not trigger
this status.
Bug: 288150501
Change-Id: Iaba60ecc5510acecee1e1d3241611906c738a263
Signed-off-by: RD Babiera <rdbabiera@google.com>
Adds functionality for enabling and disabling DisplayPort Alt Mode
on the port through enableUsbData in the USB HAL to comply with USB
restrictions for heightened security mode.
Test: manual test on device - use enableUsbData dumpsys command to
turn off DisplayPort and then turn it back on while connected to a
partner sink.
Bug: 297208252
Change-Id: I9f071bce802b728f2229abc08efb2204e4c2505a
Signed-off-by: RD Babiera <rdbabiera@google.com>
Indicate to the kernel that the usb gadget is pulled up
by writing to `update_sdp_enum_timeout` sysfs node. Write
to this node will inform the kernel that it can lower the SDP
timeout alarm value which is used to detect an SDP port
vs a DCP.
(ported from c5c5b127a7ed0db559d286284fe77b656bef6945)
Bug:275687235
Test: Check `update_sdp_enum_timeout` is written into after usb
gadget is pulled up. Verify that the alarm timeout lowers.
Change-Id: Id3ae7e7a20b236cec6604414a7f81860e868bdd0
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
If Usb.cpp cannot write a zero value to the USB_DATA_PATH file, display
the message of "Not able to turn off usb connection notification".
Test: refactoring CL. Existing tests still pass.
Bug: 301016122
Change-Id: I5d2c24154bd1d2c20810bcb4db0a3b2cc575fcfe
UVC is a new USB function supported in Android. This CL adds UVC as a
valid function and gives it a new pid of 0x4ee[de]. UVC function is
guarded by the property `ro.usb.uvc.enabled`. When this property is set
to false, UVC won't be considered as a valid gadget function.
Bug: 242344221
Test: Manually tested that the UVC function is successfully configured
Merged-In: I5c2040a84ee8360b16c955403478d908fe109121
Change-Id: I5c2040a84ee8360b16c955403478d908fe109121
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
UVC is a new USB function supported in Android. This CL adds UVC as a
valid function and gives it a new pid of 0x4ee[de]. UVC function is
guarded by the property `ro.usb.uvc.enabled`. When this property is set
to false, UVC won't be considered as a valid gadget function.
Bug: 242344221
Test: Manually tested that the UVC function is successfully configured
Change-Id: I5c2040a84ee8360b16c955403478d908fe109121
Populates AltModeData within PortStatus with DisplayPort
Alt Mode statuses for pin assignment, hpd, link training
status, and port partner capability.
Test: manual test on device
Bug: 277466852
Change-Id: I52a56f7090ed6dbef6211f19d6350cecac58e4fa
Merged-In: I52a56f7090ed6dbef6211f19d6350cecac58e4fa
Poll the sysfs attributes that represents usb device state in
either of the following states: not attached, powered, default,
addressed, configured.
The information is useful in detecting non compliant USB cable,
which will be supported in later patch sets. This patch lays
the ground work to monitor the sysfs attributes in both device
and host modes.
The thread to poll uevent is re-used to poll sysfs because this
serialize type-C port events and usb device state changes, hence
prevent potential races.
Added a thin abstration layer and a map to keep epoll data so
that it's easier to dynamically add/delete files to epoll, which
is needed for usb devices in host mode.
Bug: 285199434
Test: trigger usb device state changes in device and host mode
Change-Id: Ie5389d051deb28dbb486c2f27319b3cc9e89312f
Better enforces that only one DisplayPort poll thread should be
active at once. If a new call to setup is made from additional
bind uevents before a disconnect occurs, tells the old thread
to shutdown and awaits signaling before a new worker thread spins
up.
Test: manual testing on device
Bug: 286593610
Change-Id: I1707970c500915fd4abb161d0b3a424bbb2bddca
When booting check whether displayport driver has been probed and
signal hpd events as needed. Pin config and orientation needs to
be queried before signalling hpd.
Bug: 282223693
Change-Id: Iddb0921b363e49c41c0f6f635887b4daf4d19561
Monitor typec stack for irq_hpd events and signal irq_hpd when the
irq_hpd counter value read is not the same as the previously cached
value.
Bug: 278307874
Change-Id: Id4a72afcf85550cabbc2f9469bb0ccb92cd02ad2
Do not override UsbDataStatus when already populated.
Compliance warnings such as missing Rp do not populate
UsbDataStatus and the port partner is detected.
Populate UsbDataStatus only when not populated.
Bug: 279251052
Change-Id: Ibe71bdd5c521ba90c124d89bd56af90087c0df18
Set mode, power role and data role when connected to non compliant
port partners.
Bug: 268584498
Change-Id: I6c3e7df09a61e26f3b976a86bd65cb646edd653d
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
(cherry picked from commit 7c2d62aafc219af11252dabf49d84d84b7ccfa57)
Adds vendor code for non-compliant charger feature. Currently
updates service version.
Minor port of commit 96ccf93453583642a15dd96b1e4d6bf0645fc10b
Test: atest VtsAidlUsbTargetTest
Bug: 236322506
Change-Id: Ie1a48b1acaaae9a53f3b9bfebcfee7a2f4814810
(cherry picked from commit 96ccf93453583642a15dd96b1e4d6bf0645fc10b)
Passes usb object reference to thread creation of
mDisplayPortShutdownHelper so that it can properly call DisplayPort
shutdown method instead of calling on NULL reference.
Test: manual test on device
Bug: 278395605
Change-Id: Ie4dabb5e3ae9065f57cc0fbf2593fbe399097472
Write pin assignment, hpd, and orientation from type-c class to
drmdp platform device attributes using epoll when displayport
driver binds to device, and determine whether or not to shut down
epoll on displayport driver change uevents.
Test: manual testing with form factor device
Bug: 260915739
Change-Id: Iec9fc76166481a4611bb2fc023aea044b497f2c0
* changes:
Fix up open bugs from gs201 AIDL migration
Add resetCb
Migrate IUsbGadget implementation to AIDL
usb: limit the current to 1.3A when connect to accessory
1. Remove unused group "wakelock".
2. Correct the right return value on setCurrentUsbFunctions.
Bug: 266694076
Test: Boot to home and function work
Change-Id: If0925a61e481e4deca560dc8dfc1be80a76c148f
(cherry picked from commit 5c7e338667a7f21c27f5789c16a4781dcbbe8755)
Add the resetCb to complete asynchronous
Bug: 267252826
Test: Boot to home and function work
Change-Id: I9d6624cbe15c86c63e28f8f176d7c560aed8446f
(cherry picked from commit f14cbd637085145feff255b192a8031375fcdaa4)
This change migrates IUsbGadget implementation to AIDL.
Bug: 218791946
Test: USB function switch success and AIDL service is running.
Change-Id: I7cc7070d875c26bc42f99aef84d5e5a41606223f
Signed-off-by: Ricky Niu <rickyniu@google.com>
(cherry picked from aosp commit d6d0b7d2ca5066988ee90889dccd00c06d64b694)
For imporve USB stability, limit the current to 1.3A,
when connect to accessory.
Bug: 206635552
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I2c1091aa7111e6242cc949923fbc86f27e54e976
(cherry picked from commit e6cacbcff21d315763943469038c9ca8822a7f37)
Fix up i2c address for typec and enable USB HAL.
Bug: 241871290
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: I87ce763e350bfaec05dbe83ee040eda7d252e7a2