27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main
yerine android-latest-release
kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
USB Port Reset API
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
USB Donanım Soyutlama Katmanı (HAL) API'yi desteklemek için cihaz üreticilerinin ilgili USB HAL sürümünü uygulaması gerekir. USB HAL API'yi kullanmak için sistem ayrıcalıklı bir uygulama gerekir.
USB HAL, USB Bağlantı Noktası Sıfırlama API'sini destekler. Bu API, USB HAL v2.0 sürümünü gerektirir ve Android 13 ve sonraki sürümleri çalıştıran cihazlarda kullanılabilir. Bağlı ana makineyle USB bağlantısını sıfırlamak için bu API'yi kullanın.
USB HAL'i ve API'lerini bulma
Cihaz üreticileri, API'leri desteklemek için USB HAL'i uygulamalıdır.
USB HAL'in varsayılan uygulamasını bulmak için aşağıdaki yolları kullanın:
Version AIDL (latest):
<aosp>/hardware/interfaces/usb/gadget/1.2/default/
Donanım arayüzü üstbilgi dosyasını bulmak için aşağıdaki yolu kullanın:
Version AIDL (latest):
<aosp>/hardware/interfaces/usb/gadget/1.2/IUsbGadget.hal
API'leri bulmak için AIDL başlık dosyası altında aşağıdaki yolu kullanın. Bu yol, API'nin Android Framework giriş noktasıdır:
android.hardware.usb
:
<aosp>/core/java/android/hardware/usb
USB HAL'sini uygulama
USB HAL API ile çalışmak için şunları uygulayın:
Doğru USB HAL sürümü. Sistem kullanıcı arayüzü uygulaması gerekmez.
Hedef cihaz ile ana makine arasındaki USB bağlantısını sıfırlayarak USB Bağlantı Noktası Sıfırlama API'si için USB AIDL HAL.
USB HAL API mimarisini anlama
USB HAL API, android.hardware.usb
paketine yerleştirilmiştir ve cihazla etkileşim kurmak için USB HAL'den yararlanır. API'nin mimarisiyle ilgili ayrıntılar aşağıdaki şekilde verilmiştir.
USB Port Reset API
Aşağıdaki şekilde, USB HAL'in uygulanması da dahil olmak üzere bir çerçevedeki USB Bağlantı Noktası Sıfırlama API'sinin kod akışı gösterilmektedir.
Şekil 1.1 USB Bağlantı Noktasını Yeniden Takma API'si örnek kod akışı.
Uygulamanızı doğrulama
Her USB HAL sürümü ve ilgili API, Satıcı Testi Paketi'ndeki (VTS) bir test senaryosuyla ilişkilendirilir.
USB Port Reset API
USB Port Reset API için VTS test vakasını bulmak üzere şu adrese gidin:
<aosp>/test/vts-testcase/hal/usb/gadget/V1_2/
USB HAL v1.2 için VTS test senaryosu, bu işlemleri gerçekleştirmek üzere kullanabileceğiniz ana makine tarafı bir test senaryosudur.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 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."]]