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,39 @@ 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); + manu_buf[sizeof(manu_buf) - 1] = '\0'; + } + } + { + 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); + product_buf[sizeof(product_buf) - 1] = '\0'; + } + } + 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); }