exynos9610: Rename USB HAL suffix to exynos9610
[GitHub/moto-9609/android_device_motorola_exynos9610-common.git] / hidl / usb / service.cpp
index b4db24144795aa1a84ad2570acfb3802fe3797ff..0fbb3b19af9e6a1ba1373f8c61e0db37e9909d9e 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#define LOG_TAG "android.hardware.usb@1.1-service.exynos9610"
+
 #include <hidl/HidlTransportSupport.h>
 #include "Usb.h"
 
@@ -24,17 +26,27 @@ using android::hardware::configureRpcThreadpool;
 using android::hardware::joinRpcThreadpool;
 
 // Generated HIDL files
-using android::hardware::usb::V1_0::IUsb;
-using android::hardware::usb::V1_0::implementation::Usb;
+using android::hardware::usb::V1_1::IUsb;
+using android::hardware::usb::V1_1::implementation::Usb;
 
-int main() {
-    const char instance[] = "usb_hal";
+using android::status_t;
+using android::OK;
 
+int main() {
     android::sp<IUsb> service = new Usb();
 
     configureRpcThreadpool(1, true /*callerWillJoin*/);
-    service->registerAsService(instance);
+    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;
+
 }