Share the new adb USB diagnostic code with fastboot.
Bug: http://b/26134129
Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
diff --git a/transport.cpp b/transport.cpp
index d4f60ec..6020ad5 100644
--- a/transport.cpp
+++ b/transport.cpp
@@ -35,6 +35,7 @@
#include "adb.h"
#include "adb_utils.h"
+#include "diagnose_usb.h"
static void transport_unref(atransport *t);
@@ -674,11 +675,9 @@
adb_mutex_lock(&transport_lock);
for (const auto& t : transport_list) {
if (t->connection_state == kCsNoPerm) {
+#if ADB_HOST
*error_out = UsbNoPermissionsLongHelpText();
- // If we couldn't figure out a reasonable help message default to something generic.
- if (error_out->empty()) {
- *error_out = "insufficient permissions for device";
- }
+#endif
continue;
}
@@ -759,10 +758,7 @@
case kCsDevice: return "device";
case kCsHost: return "host";
case kCsRecovery: return "recovery";
- case kCsNoPerm: {
- std::string message = UsbNoPermissionsShortHelpText();
- return message.empty() ? "no permissions" : message;
- }
+ case kCsNoPerm: return UsbNoPermissionsShortHelpText();
case kCsSideload: return "sideload";
case kCsUnauthorized: return "unauthorized";
default: return "unknown";