mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-01-27 18:19:03 +00:00
USB: HIDL: check the status of registerAsService
registerAsService call could fail. Hence check the return value. Bug: 36704362 Change-Id: I46dcd74dbee6aba72cf344f10854e5d4b1b6de18
This commit is contained in:
@@ -27,12 +27,24 @@ using android::hardware::joinRpcThreadpool;
|
||||
using android::hardware::usb::V1_0::IUsb;
|
||||
using android::hardware::usb::V1_0::implementation::Usb;
|
||||
|
||||
using android::status_t;
|
||||
using android::OK;
|
||||
|
||||
int main() {
|
||||
android::sp<IUsb> service = new Usb();
|
||||
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
service->registerAsService();
|
||||
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.");
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user