diff options
author | uvok cheetah | 2024-09-14 17:17:47 +0200 |
---|---|---|
committer | uvok cheetah | 2024-09-14 17:17:47 +0200 |
commit | 03c3aa0e25a4be5ead49c0863ccf4ffd7fa088c3 (patch) | |
tree | 2de83fdf05a4572e5bcc5c4c990783bf66aeb373 | |
parent | 11e932aac9ace081b86e4a1d22ba98567450f5cf (diff) |
Add lsusb patch
-rw-r--r-- | patches/busybox/0010-lsusb-show-goddamn-descriptors.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/patches/busybox/0010-lsusb-show-goddamn-descriptors.patch b/patches/busybox/0010-lsusb-show-goddamn-descriptors.patch new file mode 100644 index 0000000..193cc4f --- /dev/null +++ b/patches/busybox/0010-lsusb-show-goddamn-descriptors.patch @@ -0,0 +1,56 @@ +uvok cheetah, 2024 + +Add some more useful info to lsusb output. +Index: busybox-1.36.1/util-linux/lsusb.c +=================================================================== +--- busybox-1.36.1.orig/util-linux/lsusb.c ++++ busybox-1.36.1/util-linux/lsusb.c +@@ -33,6 +33,10 @@ static int FAST_FUNC fileAction(struct r + char *busnum = NULL, *devnum = NULL; + int product_vid = 0, product_did = 0; + char *uevent_filename = concat_path_file(fileName, "/uevent"); ++ char *manu_filename = concat_path_file(fileName, "/manufacturer"); ++ char *product_filename = concat_path_file(fileName, "/product"); ++ char manu_buf[32] = { 0 }; ++ char product_buf[32] = { 0 }; + + parser = config_open2(uevent_filename, fopen_for_read); + free(uevent_filename); +@@ -58,10 +62,37 @@ static int FAST_FUNC fileAction(struct r + continue; + } + } ++ ++ { ++ struct stat manu_stat; ++ int manu_ret = stat(manu_filename, &manu_stat); ++ if (manu_ret == 0 && manu_stat.st_size != 0) ++ { ++ FILE* manu_file = fopen(manu_filename, "r"); ++ fread(manu_buf, 1, MIN(manu_stat.st_size, sizeof(manu_buf)), manu_file); ++ fclose(manu_file); ++ } ++ } ++ { ++ struct stat product_stat; ++ int product_ret = stat(product_filename, &product_stat); ++ if (product_ret == 0 && product_stat.st_size != 0) ++ { ++ FILE* product_file = fopen(product_filename, "r"); ++ fread(product_buf, 1, MIN(product_stat.st_size, sizeof(product_buf)), product_file); ++ fclose(product_file); ++ } ++ } ++ + config_close(parser); + + if (busnum) { + printf("Bus %s Device %s: ID %04x:%04x\n", busnum, devnum, product_vid, product_did); ++ // These already include the newline? ++ if (*manu_buf) ++ printf("\tManufacturer: %s", manu_buf); ++ if (*product_buf) ++ printf("\tProduct: %s", product_buf); + free(busnum); + free(devnum); + } |