2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
USB Port Reset API
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
USB Hardware Abstraction Layer(HAL)API をサポートするためには、デバイス メーカーで対応する USB HAL バージョンを実装する必要があります。USB HAL API を使用するには、システム特権アプリが必要です。
USB HAL は、USB HAL v2.0 を必要とする USB Port Reset API をサポートしており、Android 13 以降を搭載したデバイスで利用できます。この API を使用して、接続したホストを使用する USB 接続をリセットします。
USB HAL とその API の確認
デバイス メーカーは、API をサポートするために、USB HAL を実装する必要があります。
USB HAL のデフォルト実装を確認するには、以下のパスを使用します。
バージョン AIDL(最新):
<aosp>/hardware/interfaces/usb/gadget/1.2/default/
ハードウェア インターフェースのヘッダー ファイルを確認するには、以下のパスを使用します。
バージョン AIDL(最新):
<aosp>/hardware/interfaces/usb/gadget/1.2/IUsbGadget.hal
API を確認するには、以下のパスを使用して AIDL ヘッダー ファイルで API を見つけます。このパスは、この API の Android フレームワーク エントリ ポイントでもあります。
android.hardware.usb
:
<aosp>/core/java/android/hardware/usb
USB HAL の実装
USB HAL API を使用するには、以下を実装します。
正しい USB HAL バージョン。システム UI を実装する必要はありません。
USB Port Reset API の USB AIDL HAL。ターゲット デバイスとホストとの間の USB 接続をリセットします。
USB HAL API のアーキテクチャについて
USB HAL API は android.hardware.usb
パッケージに組み込まれており、USB HAL を利用してデバイスとやり取りします。この API のアーキテクチャについての詳細を以下の図に示します。
USB Port Reset API
下の図は、フレームワーク内の USB Port Reset API のコードフローを示しています。これには、USB HAL の実装も含まれています。
図 1.1 USB Port Reset API コードフローのサンプル
実装の検証
各 USB HAL バージョンと対応する API は、ベンダー テストスイート(VTS)のテストケースに関連付けられています。
USB Port Reset API
USB Port Reset API の VTS テストケースを見つけるには、次にアクセスします。
<aosp>/test/vts-testcase/hal/usb/gadget/V1_2/
USB HAL v1.2 向けの VTS テストケースは、これらのアクションを実行するために使用できるホスト側のテストケースです。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-17 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-17 UTC。"],[],[],null,["# USB Port Reset API\n\nTo support the USB Hardware Abstraction Layer (HAL) API, device manufacturers\nmust implement the corresponding USB HAL version. To use the USB HAL API, a\nsystem-privileged app is required.\n\nThe USB HAL supports the USB Port Reset API, which requires USB HAL v2.0 and is\navailable for devices running Android 13 and higher. Use this API to reset the\nUSB connection with the connected host.\n\nFind the USB HAL and its APIs\n-----------------------------\n\nDevice manufacturers must implement the USB HAL to support the APIs.\n\n1. To find the default implementation of USB HAL, use the following paths:\n\n **Version AIDL (latest):**\n [`\u003caosp\u003e/hardware/interfaces/usb/gadget/1.2/default/`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/usb/gadget/1.2/default/)\n2. To find the hardware interface header file, use the following path:\n\n **Version AIDL (latest):**\n [`\u003caosp\u003e/hardware/interfaces/usb/gadget/1.2/IUsbGadget.hal`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/usb/gadget/1.2/IUsbGadget.hal)\n3. To find the APIs, use the following path to locate the APIs under the\n AIDL header file. This path is also the Android Framework entry point for the API:\n\n `android.hardware.usb`:\n [`\u003caosp\u003e/core/java/android/hardware/usb`](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/android16-release/core/java/android/hardware/usb/IUsbManager.aidl)\n\nImplement the USB HAL\n---------------------\n\nTo work with the USB HAL API, implement the:\n\n1. Correct USB HAL version. No system UI implementation is required.\n\n2. USB AIDL HAL for the USB Port Reset API by resetting the USB connection between the target device and the host.\n\nUnderstand the USB HAL API architecture\n---------------------------------------\n\nThe USB HAL API is built into the `android.hardware.usb` package and leverages the USB HAL to interact with the device. Details about the architecture for the API is provided in the figure below.\n\n### USB Port Reset API\n\nThe following figure illustrates the code flow of the USB Port Reset API in a framework, including the implementation of the USB HAL.\n\n**Figure 1.1** Sample USB Port Reseat API code flow.\n\nValidate your implementation\n----------------------------\n\nEach USB HAL version and its corresponding API is associated with a test case in\nthe Vendor Test Suite (VTS).\n\n### USB Port Reset API\n\nTo find the VTS test case for the USB Port Reset API, go to:\n\n[`\u003caosp\u003e/test/vts-testcase/hal/usb/gadget/V1_2/`](https://android.googlesource.com/platform/test/vts-testcase/hal/+/refs/heads/android16-release/usb/gadget/V1_2)\n\nThe VTS test case for USB HAL v1.2 is a host-side test case you can use to\nperform these actions.\n\n- To invoke the USB Port Reset API, use the `adb shell`\n command (`#svc usb resetUsbPort`).\n\n- Confirm that the device under test (DUT) can disconnect and reconnect."]]