Badhri Jagan Sridharan | b9f69ea | 2021-10-19 13:09:44 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.hardware.usb; |
| 18 | |
| 19 | import android.hardware.usb.IUsbCallback; |
| 20 | import android.hardware.usb.PortRole; |
| 21 | |
| 22 | @VintfStability |
| 23 | oneway 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 Sridharan | e745058 | 2021-12-27 03:42:19 -0800 | [diff] [blame] | 52 | * 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 Sridharan | b9f69ea | 2021-10-19 13:09:44 -0700 | [diff] [blame] | 61 | * 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 Sridharan | 623f133 | 2021-11-25 09:35:21 -0800 | [diff] [blame] | 94 | |
| 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 Niu | 45131a7 | 2021-12-07 20:27:37 +0800 | [diff] [blame] | 107 | |
| 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 Sridharan | b9f69ea | 2021-10-19 13:09:44 -0700 | [diff] [blame] | 116 | } |