diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl index ef45f8be3a..b5c0b5c253 100644 --- a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl @@ -37,5 +37,5 @@ interface IUsbGadget { oneway void setCurrentUsbFunctions(in long functions, in android.hardware.usb.gadget.IUsbGadgetCallback callback, in long timeoutMs, long transactionId); oneway void getCurrentUsbFunctions(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); oneway void getUsbSpeed(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); - oneway void reset(); + oneway void reset(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); } diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl index 9de68de72d..b2b0e5ad58 100644 --- a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -37,4 +37,5 @@ interface IUsbGadgetCallback { oneway void setCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); oneway void getCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); oneway void getUsbSpeedCb(in android.hardware.usb.gadget.UsbSpeed speed, long transactionId); + oneway void resetCb(in android.hardware.usb.gadget.Status status, long transactionId); } diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl index 9c3f0d476f..a0c61ae923 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl @@ -59,6 +59,10 @@ oneway interface IUsbGadget { * This function is used to reset USB gadget driver. * Performs USB data connection reset. The connection will disconnect and * reconnect. + * + * @param callback IUsbGadgetCallback::resetCb used to propagate + * the result of requesting resetUsbGadget. + * @param transactionId ID to be used when invoking the callback. */ - void reset(); + void reset(in IUsbGadgetCallback callback, long transactionId); } diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl index b4945a0c0e..cd9a662beb 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -59,4 +59,12 @@ oneway interface IUsbGadgetCallback { * @param transactionId ID to be used when invoking the callback. */ void getUsbSpeedCb(in UsbSpeed speed, long transactionId); + + /** + * Callback function used to propagate the result of requesting + * resetUsbGadget. + * @param status SUCCESS if current request succeeded. FAILURE otherwise. + * @param transactionId current transactionId sent during reset request. + */ + void resetCb(in Status status, long transactionId); } diff --git a/usb/gadget/aidl/default/UsbGadget.cpp b/usb/gadget/aidl/default/UsbGadget.cpp index 4a406528f7..72d59c132f 100644 --- a/usb/gadget/aidl/default/UsbGadget.cpp +++ b/usb/gadget/aidl/default/UsbGadget.cpp @@ -144,7 +144,10 @@ Status UsbGadget::tearDownGadget() { return Status::SUCCESS; } -ScopedAStatus UsbGadget::reset() { +ScopedAStatus UsbGadget::reset(const shared_ptr &callback, + int64_t in_transactionId) { + if (callback) + callback->resetCb(Status::SUCCESS, in_transactionId); return ScopedAStatus::ok(); } diff --git a/usb/gadget/aidl/default/UsbGadget.h b/usb/gadget/aidl/default/UsbGadget.h index adcfcfa7ca..5eaaa48550 100644 --- a/usb/gadget/aidl/default/UsbGadget.h +++ b/usb/gadget/aidl/default/UsbGadget.h @@ -96,7 +96,8 @@ struct UsbGadget : public BnUsbGadget { ScopedAStatus getCurrentUsbFunctions(const shared_ptr &callback, int64_t in_transactionId) override; - ScopedAStatus reset() override; + ScopedAStatus reset(const shared_ptr &callback, + int64_t in_transactionId) override; ScopedAStatus getUsbSpeed(const shared_ptr &callback, int64_t in_transactionId) override;