blob: 90ad115731cf47596eeac83b05c616dc4f084f54 [file] [log] [blame]
Badhri Jagan Sridharanb9f69ea2021-10-19 13:09:44 -07001/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.usb;
18
19import android.hardware.usb.IUsbCallback;
20import android.hardware.usb.PortRole;
21
22@VintfStability
23oneway interface IUsb {
24 /**
25 * When supportsEnableContaminantPresenceDetection is true,
26 * enableContaminantPresenceDetection enables/disables contaminant
27 * presence detection algorithm. Calling enableContaminantPresenceDetection
28 * when supportsEnableContaminantPresenceDetection is false does
29 * not have any effect.
30 * Change in contantaminant presence status should be notified to the
31 * client via notifyPortStatusChange through PortStatus.
32 *
33 * @param portName name of the port.
34 * @param enable true Enable contaminant presence detection algorithm.
35 * false Disable contaminant presence detection algorithm.
36 * @param transactionId ID to be used when invoking the callback.
37 */
38 void enableContaminantPresenceDetection(in String portName, in boolean enable, long transactionId);
39
40 /**
41 * This function is used to enable/disable USB data controller.
42 *
43 * @param portName Name of the port.
44 * @param enable true Enable USB data signaling.
45 * false Disable USB data signaling.
46 * @param transactionId ID to be used when invoking the callback.
47 *
48 */
49 void enableUsbData(in String portName, boolean enable, long transactionId);
50
51 /**
Badhri Jagan Sridharane7450582021-12-27 03:42:19 -080052 * This function is used to enable USB controller if and when the controller
53 * disabled due to docking event.
54 *
55 * @param portName Name of the port.
56 * @param transactionId ID to be used when invoking the callback.
57 */
58 void enableUsbDataWhileDocked(in String portName, long transactionId);
59
60 /**
Badhri Jagan Sridharanb9f69ea2021-10-19 13:09:44 -070061 * This functions is used to request the hal for the current status
62 * status of the Type-C ports. The result of the query would be sent
63 * through the IUsbCallback object's notifyRoleSwitchStatus
64 * to the caller. This api would would let the caller know of the number
65 * of type-c ports that are present and their connection status through the
66 * PortStatus type.
67 * @param transactionId ID to be used when invoking the callback.
68 */
69 void queryPortStatus(long transactionId);
70
71 /**
72 * This function is used to register a callback function which is
73 * called by the HAL to inform the client of port status updates and
74 * result of the requested operation. Please refer IUsbCallback for
75 * complete description of when each of the IUsbCallback's interface
76 * methods is expected to be called.
77 *
78 * @param callback IUsbCallback object used to convey status to the
79 * userspace.
80 */
81 void setCallback(in IUsbCallback callback);
82
83 /**
84 * This function is used to change the port role of a specific port.
85 * For example, when DR_SWAP or PR_SWAP is supported.
86 * The status of the role switch will be informed through IUsbCallback
87 * object's notifyPortStatusChange method.
88 *
89 * @param portName name of the port for which the role has to be changed
90 * @param role the new port role.
91 * @param transactionId ID to be used when invoking the callback.
92 */
93 void switchRole(in String portName, in PortRole role, long transactionId);
Badhri Jagan Sridharan623f1332021-11-25 09:35:21 -080094
95 /**
96 * This function is used to limit power transfer in and out of the port.
97 * When limited, the port does not charge from the partner port.
98 * Also, the port limits sourcing power to the partner port when the USB
99 * specification allows it to do so.
100 *
101 * @param portName name of the port for which power transfer is being limited.
102 * @param limit true limit power transfer.
103 * false relax limiting power transfer.
104 * @param transactionId ID to be used when invoking the callback.
105 */
106 void limitPowerTransfer(in String portName, boolean limit, long transactionId);
Ricky Niu45131a72021-12-07 20:27:37 +0800107
108 /**
109 * This function is used to reset the port role of a specific port.
110 * For instance, when data transfer through the port fails.
111 *
112 * @param portName name of the port that is being reset
113 * @param transactionId ID to be used when invoking the callback.
114 */
115 void resetUsbPort(in String portName, long transactionId);
Badhri Jagan Sridharanb9f69ea2021-10-19 13:09:44 -0700116}