hosted: Fix info.serial if USB device has no serial number #807

This commit is contained in:
Uwe Bonnes 2020-12-12 16:08:39 +01:00 committed by UweBonnes
parent 518529a772
commit f796b774bd
1 changed files with 4 additions and 0 deletions

View File

@ -142,6 +142,8 @@ int find_debuggers(BMP_CL_OPTIONS_t *cl_opts,bmp_info_t *info)
libusb_close(handle);
continue;
}
if (res < 0)
serial[0] = 0;
res = libusb_get_string_descriptor_ascii(
handle, desc.iManufacturer, (uint8_t*)manufacturer,
sizeof(manufacturer));
@ -231,6 +233,8 @@ int find_debuggers(BMP_CL_OPTIONS_t *cl_opts,bmp_info_t *info)
if (!cable->name)
continue;
}
if (!serial[0])
strcpy(serial, "<no serial number>");
if (report) {
DEBUG_WARN("%2d: %s, %s, %s\n", found_debuggers + 1,
serial,