fastboot: Remove '\n' from interface name on linux
If the device provides an interface string, we should remove the newline from the read file that is added from by the linux kernel. Bug: 324320178 Test: Ran the same command with my local changes vs not ``` bash$ ./fastboot devices -l 5f42ad5ad259c90cf14ea222791b6aaa fastboot usb:7-3 bash$ fastboot devices -l 5f42ad5ad259c90cf14ea222791b6aaa fastboot usb:7-3 ``` Change-Id: Ida3316fdba8e35f0c66784f83455a4d82e90ba1c
This commit is contained in:
parent
c72c9a6d3c
commit
28f4807dd3
1 changed files with 3 additions and 0 deletions
|
|
@ -269,6 +269,9 @@ static int filter_usb_device(char* sysfs_name,
|
|||
auto path = android::base::StringPrintf("/sys/bus/usb/devices/%s/%s:1.%d/interface",
|
||||
sysfs_name, sysfs_name, ifc->bInterfaceNumber);
|
||||
if (android::base::ReadFileToString(path, &interface)) {
|
||||
if (!interface.empty() && interface.back() == '\n') {
|
||||
interface.pop_back();
|
||||
}
|
||||
snprintf(info.interface, sizeof(info.interface), "%s", interface.c_str());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue