summaryrefslogtreecommitdiffstats
path: root/fastboot/fastboot.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-12-11 19:07:01 -0800
committerElliott Hughes <enh@google.com>2015-12-14 10:50:21 -0800
commit1b708d368f29e6053064c9cf6949ab6ebdbb7ac5 (patch)
tree3fc838c8c455c0f612ebafd3592d0aa551853221 /fastboot/fastboot.cpp
parent796ea6a65d790fba1a9d77cfcaf453825936a146 (diff)
downloadcore-1b708d368f29e6053064c9cf6949ab6ebdbb7ac5.tar.gz
core-1b708d368f29e6053064c9cf6949ab6ebdbb7ac5.tar.bz2
core-1b708d368f29e6053064c9cf6949ab6ebdbb7ac5.zip
Share the new adb USB diagnostic code with fastboot.
Bug: http://b/26134129 Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r--fastboot/fastboot.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 1ab943605..5b663668e 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -53,6 +53,7 @@
#include <android-base/parseint.h>
#include "bootimg_utils.h"
+#include "diagnose_usb.h"
#include "fastboot.h"
#include "fs.h"
#include "transport.h"
@@ -204,21 +205,21 @@ static int match_fastboot(usb_ifc_info* info) {
static int list_devices_callback(usb_ifc_info* info) {
if (match_fastboot_with_serial(info, nullptr) == 0) {
- const char* serial = info->serial_number;
+ std::string serial = info->serial_number;
if (!info->writable) {
- serial = "no permissions"; // like "adb devices"
+ serial = UsbNoPermissionsShortHelpText();
}
if (!serial[0]) {
serial = "????????????";
}
// output compatible with "adb devices"
if (!long_listing) {
- printf("%s\tfastboot\n", serial);
- } else if (strcmp("", info->device_path) == 0) {
- printf("%-22s fastboot\n", serial);
+ printf("%s\tfastboot", serial.c_str());
} else {
- printf("%-22s fastboot %s\n", serial, info->device_path);
+ printf("%-22s fastboot", serial.c_str());
+ if (strlen(info->device_path) > 0) printf(" %s", info->device_path);
}
+ putchar('\n');
}
return -1;