aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-22 13:14:46 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-22 13:14:46 +0200
commite41b08fc6261f5386e28e01cda2ae410d883e367 (patch)
tree849602958a433c00627532a05f8494458dcdd16d
parent8a80f70a8afb2f6831b150a69cdf8f566deefe66 (diff)
downloadusbutils-e41b08fc6261f5386e28e01cda2ae410d883e367.tar.gz
lsusb-t: if a driver is not bound to an interface, report "[none]"
For the output of 'lsusb -t' if a driver is not bound to an interface, the result looks odd. Fix that up by printing out "[none]" instead. This changes the output of a line that previous looked like: |__ Port 004: Dev 006, If 0, Class=[unknown], Driver=, 12M to be: |__ Port 004: Dev 006, If 0, Class=[unknown], Driver=[none], 12M Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--lsusb-t.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lsusb-t.c b/lsusb-t.c
index b119414..966da7d 100644
--- a/lsusb-t.c
+++ b/lsusb-t.c
@@ -357,6 +357,8 @@ static void add_usb_interface(const char *d_name)
p = strrchr(driver, '/');
if (p)
snprintf(e->driver, sizeof(e->driver), "%s", p + 1);
+ } else {
+ snprintf(e->driver, sizeof(e->driver), "[none]");
}
} else
printf("Can not read driver link for '%s': %d\n", d_name, l);