enableUsbDataSignal: Handle failures in optional sysfs gracefully
* ID and VBUS paths are not present on all devices,
depending on the device dwc3 setup.
* Gadget pull is optional.
Change-Id: I235284ad7bad9fbf34568958fd94e32b2787a1c5
diff --git a/hal/Usb.cpp b/hal/Usb.cpp
index e30eaff..d79cd1c 100644
--- a/hal/Usb.cpp
+++ b/hal/Usb.cpp
@@ -68,18 +68,15 @@
}
if (!WriteStringToFile(mGadgetName, PULLUP_PATH)) {
- ALOGE("Gadget cannot be pulled up");
- result = false;
+ ALOGW("Gadget cannot be pulled up");
}
} else {
if (!WriteStringToFile("1", mDevicePath + ID_PATH)) {
- ALOGE("Not able to turn off host mode");
- result = false;
+ ALOGW("Not able to turn off host mode");
}
if (!WriteStringToFile("0", mDevicePath + VBUS_PATH)) {
- ALOGE("Not able to set Vbus state");
- result = false;
+ ALOGW("Not able to set Vbus state");
}
if (!WriteStringToFile("0", mDevicePath + USB_DATA_PATH)) {
@@ -88,8 +85,7 @@
}
if (!WriteStringToFile("none", PULLUP_PATH)) {
- ALOGE("Gadget cannot be pulled down");
- result = false;
+ ALOGW("Gadget cannot be pulled down");
}
}