DO NOT MERGE :Usb Gadget hal implementation for wahoo

Bug: 63669128
Test: Tested USB gadget configurations and verified
that they enumerated.
Change-Id: If0f98697488f6c7cfe335d4c292acebaaba6c20f
This commit is contained in:
Badhri Jagan Sridharan
2018-01-19 06:08:52 -08:00
committed by Badhri Jagan Sridharan
parent 3102a99db4
commit ecfc861e1e
13 changed files with 654 additions and 415 deletions

View File

@@ -18,6 +18,7 @@
#include <hidl/HidlTransportSupport.h>
#include "Usb.h"
#include "UsbGadget.h"
using android::sp;
@@ -27,26 +28,35 @@ using android::hardware::joinRpcThreadpool;
// Generated HIDL files
using android::hardware::usb::V1_1::IUsb;
using android::hardware::usb::gadget::V1_0::IUsbGadget;
using android::hardware::usb::V1_1::implementation::Usb;
using android::hardware::usb::gadget::V1_0::implementation::UsbGadget;
using android::status_t;
using android::OK;
using android::status_t;
int main() {
android::sp<IUsb> service = new Usb();
android::sp<IUsb> service = new Usb();
android::sp<IUsbGadget> service2 = new UsbGadget();
configureRpcThreadpool(1, true /*callerWillJoin*/);
status_t status = service->registerAsService();
configureRpcThreadpool(2, true /*callerWillJoin*/);
status_t status = service->registerAsService();
if (status != OK) {
ALOGE("Cannot register USB HAL service");
return 1;
}
ALOGI("USB HAL Ready.");
joinRpcThreadpool();
// Under noraml cases, execution will not reach this line.
ALOGI("USB HAL failed to join thread pool.");
if (status != OK) {
ALOGE("Cannot register USB HAL service");
return 1;
}
status = service2->registerAsService();
if (status != OK) {
ALOGE("Cannot register USB Gadget HAL service");
return 1;
}
ALOGI("USB HAL Ready.");
joinRpcThreadpool();
// Under noraml cases, execution will not reach this line.
ALOGI("USB HAL failed to join thread pool.");
return 1;
}