mirror of
https://codeberg.org/kiss-community/repo
synced 2024-12-22 15:20:06 -07:00
busybox: Add USB vendor names to lsusb.
Patch written and sent in by xzcvczx.
This commit is contained in:
parent
a59b580b63
commit
6c332ee72d
@ -4,7 +4,8 @@ c35d87f1d04b2b153d33c275c2632e40d388a88f19a9e71727e0bbbff51fe689 busybox-1.32.0
|
||||
0f54301a73af461e8066bc805b48d991cfed513d08a2f036e015b19f97cb424a modprobe-kernel-version.patch
|
||||
68e0c7d5e96902d3b890e89d9b018ae11d53ed3104bfedd624a1485df58b11cb print-unicode.patch
|
||||
f0e17fefc0af6b10205d72b242b6ef7481a58ff07726c62890ebc5893b96a396 install-fix-chown.patch
|
||||
2d0fa808b485cde87b6cc6ff449a441cfdb3e2a845e3b796e9e280e2afa7fd46 .config
|
||||
73be7b16dcff44e88eb48696522794f529beddf9d5a139b8a76cc8685a9f6fc8 lsusb-vendor-product.patch
|
||||
ae6cae539ad78abc4e412389c0e371fc7ea49f5645c632b8eb27efc1a2a09bbe .config
|
||||
6e9c7bccc102d0e8fa062c750c9d00ec6de6aa67d6b4c6f6b0539247798e6c71 .config-suid
|
||||
ebd61afac770d3d9cae5c411f44002496fb18b28cf7b77520072a3909852246e acpid.run
|
||||
814dea14ac612125e97dcc1d619219b2c9dfc14850bf48d858421fb2c98eca12 crond.run
|
||||
|
@ -636,6 +636,7 @@ CONFIG_FEATURE_LAST_FANCY=y
|
||||
CONFIG_LOSETUP=y
|
||||
CONFIG_LSPCI=y
|
||||
CONFIG_LSUSB=y
|
||||
CONFIG_FEATURE_LSUSB_STRINGS=y
|
||||
CONFIG_MDEV=y
|
||||
CONFIG_FEATURE_MDEV_CONF=y
|
||||
CONFIG_FEATURE_MDEV_RENAME=y
|
||||
|
53
core/busybox/patches/lsusb-vendor-product.patch
Normal file
53
core/busybox/patches/lsusb-vendor-product.patch
Normal file
@ -0,0 +1,53 @@
|
||||
diff --git a/util-linux/lsusb.c b/util-linux/lsusb.c
|
||||
index e27aa7f31..b7b7abb99 100644
|
||||
--- a/util-linux/lsusb.c
|
||||
+++ b/util-linux/lsusb.c
|
||||
@@ -15,7 +15,16 @@
|
||||
//config: system and devices connected to them.
|
||||
//config:
|
||||
//config: This version uses sysfs (/sys/bus/usb/devices) only.
|
||||
-
|
||||
+//config:
|
||||
+//config:config FEATURE_LSUSB_STRINGS
|
||||
+//config: bool "Print vendor and product strings if they exist"
|
||||
+//config: default y
|
||||
+//config: depends on LSUSB
|
||||
+//config: help
|
||||
+//config: lsusb is a utility for displaying information about USB busses in the
|
||||
+//config: system and devices connected to them. This option prints out the
|
||||
+//config: vendor and product strings if they are available. This option
|
||||
+//config: replicates a simpler version of util-linux lsusb output.
|
||||
//applet:IF_LSUSB(APPLET_NOEXEC(lsusb, lsusb, BB_DIR_USR_BIN, BB_SUID_DROP, lsusb))
|
||||
|
||||
//kbuild:lib-$(CONFIG_LSUSB) += lsusb.o
|
||||
@@ -37,6 +46,16 @@ static int FAST_FUNC fileAction(
|
||||
int product_vid = 0, product_did = 0;
|
||||
char *uevent_filename = concat_path_file(fileName, "/uevent");
|
||||
|
||||
+#if ENABLE_FEATURE_LSUSB_STRINGS
|
||||
+ ssize_t vlen, plen;
|
||||
+ // max length standard allows, any longer and someones being naughty
|
||||
+ char vendor[256] = { 0 }, product[256] = { 0 };
|
||||
+ vlen = open_read_close(concat_path_file(fileName, "/manufacturer"), vendor, sizeof(vendor));
|
||||
+ vendor[vlen - 1] = '\0';
|
||||
+ plen = open_read_close(concat_path_file(fileName, "/product"), product, sizeof(product));
|
||||
+ product[plen - 1] = '\0';
|
||||
+#endif
|
||||
+
|
||||
parser = config_open2(uevent_filename, fopen_for_read);
|
||||
free(uevent_filename);
|
||||
|
||||
@@ -64,7 +83,12 @@ static int FAST_FUNC fileAction(
|
||||
config_close(parser);
|
||||
|
||||
if (busnum) {
|
||||
- printf("Bus %s Device %s: ID %04x:%04x\n", busnum, devnum, product_vid, product_did);
|
||||
+ printf("Bus %s Device %s: ID %04x:%04x", busnum, devnum, product_vid, product_did);
|
||||
+#if ENABLE_FEATURE_LSUSB_STRINGS
|
||||
+ if(vlen) printf(" %s", vendor);
|
||||
+ if(plen) printf(" %s", product);
|
||||
+#endif
|
||||
+ printf("\n");
|
||||
free(busnum);
|
||||
free(devnum);
|
||||
}
|
@ -4,6 +4,7 @@ patches/fsck-resolve-uuid.patch
|
||||
patches/modprobe-kernel-version.patch
|
||||
patches/print-unicode.patch
|
||||
patches/install-fix-chown.patch
|
||||
patches/lsusb-vendor-product.patch
|
||||
files/.config
|
||||
files/.config-suid
|
||||
files/acpid.run
|
||||
|
@ -1 +1 @@
|
||||
1.32.0 1
|
||||
1.32.0 2
|
||||
|
Loading…
Reference in New Issue
Block a user