Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88a4d874 authored by Badhri Jagan Sridharan's avatar Badhri Jagan Sridharan Committed by Badhri Jagan Sridharan
Browse files

USB: HIDL: check the status of registerAsService

registerAsService call could fail. Hence check the return value.

Bug: 36704362
Test: Manually checked to see if usb hal service is running.
Change-Id: I46dcd74dbee6aba72cf344f10854e5d4b1b6de18
parent 90b4baef
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -27,13 +27,21 @@ using android::hardware::joinRpcThreadpool;
using android::hardware::usb::V1_0::IUsb;
using android::hardware::usb::V1_0::IUsb;
using android::hardware::usb::V1_0::implementation::Usb;
using android::hardware::usb::V1_0::implementation::Usb;


using android::status_t;
using android::OK;

int main() {
int main() {


    android::sp<IUsb> service = new Usb();
    android::sp<IUsb> service = new Usb();


    configureRpcThreadpool(1, true /*callerWillJoin*/);
    configureRpcThreadpool(1, true /*callerWillJoin*/);
    service->registerAsService();
    status_t status = service->registerAsService();


    if (status == OK) {
        ALOGI("USB HAL Ready.");
        ALOGI("USB HAL Ready.");
        joinRpcThreadpool();
        joinRpcThreadpool();
    }
    }

    ALOGE("Cannot register USB HAL service");
    return 1;
}