1 diff --git a/util-linux/lsusb.c b/util-linux/lsusb.c
2 index e27aa7f31..b7b7abb99 100644
3 --- a/util-linux/lsusb.c
4 +++ b/util-linux/lsusb.c
6 //config: system and devices connected to them.
8 //config: This version uses sysfs (/sys/bus/usb/devices) only.
11 +//config:config FEATURE_LSUSB_STRINGS
12 +//config: bool "Print vendor and product strings if they exist"
14 +//config: depends on LSUSB
16 +//config: lsusb is a utility for displaying information about USB busses in the
17 +//config: system and devices connected to them. This option prints out the
18 +//config: vendor and product strings if they are available. This option
19 +//config: replicates a simpler version of util-linux lsusb output.
20 //applet:IF_LSUSB(APPLET_NOEXEC(lsusb, lsusb, BB_DIR_USR_BIN, BB_SUID_DROP, lsusb))
22 //kbuild:lib-$(CONFIG_LSUSB) += lsusb.o
23 @@ -37,6 +46,16 @@ static int FAST_FUNC fileAction(
24 int product_vid = 0, product_did = 0;
25 char *uevent_filename = concat_path_file(fileName, "/uevent");
27 +#if ENABLE_FEATURE_LSUSB_STRINGS
29 + // max length standard allows, any longer and someones being naughty
30 + char vendor[256] = { 0 }, product[256] = { 0 };
31 + vlen = open_read_close(concat_path_file(fileName, "/manufacturer"), vendor, sizeof(vendor));
32 + vendor[vlen - 1] = '\0';
33 + plen = open_read_close(concat_path_file(fileName, "/product"), product, sizeof(product));
34 + product[plen - 1] = '\0';
37 parser = config_open2(uevent_filename, fopen_for_read);
38 free(uevent_filename);
40 @@ -64,7 +83,12 @@ static int FAST_FUNC fileAction(
44 - printf("Bus %s Device %s: ID %04x:%04x\n", busnum, devnum, product_vid, product_did);
45 + printf("Bus %s Device %s: ID %04x:%04x", busnum, devnum, product_vid, product_did);
46 +#if ENABLE_FEATURE_LSUSB_STRINGS
47 + if(vlen) printf(" %s", vendor);
48 + if(plen) printf(" %s", product);