From 1b708d368f29e6053064c9cf6949ab6ebdbb7ac5 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 11 Dec 2015 19:07:01 -0800 Subject: Share the new adb USB diagnostic code with fastboot. Bug: http://b/26134129 Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba --- fastboot/fastboot.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'fastboot/fastboot.cpp') 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 #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; -- cgit v1.2.3