From 226c0e19acf4d198b745f650d1b0af18c29ba531 Mon Sep 17 00:00:00 2001 From: Dima Buzdyk Date: Fri, 14 Jun 2024 16:36:42 +0500 Subject: [PATCH] lsusb: config space dump with multiple PCIe controllers Fix config space dump (-x option) on machines with mulptiple PCIe controllers. In this case device IDs will be named '0001:00:00.0' and so on. --- toys/other/lsusb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/toys/other/lsusb.c b/toys/other/lsusb.c index 6bbfe0df..7642b094 100644 --- a/toys/other/lsusb.c +++ b/toys/other/lsusb.c @@ -234,9 +234,7 @@ static int list_pci(struct dirtree *new) FILE *fp; int b, col = 0, max = (TT.x >= 4) ? 4096 : ((TT.x >= 3) ? 256 : 64); - // TODO: where does the "0000:" come from? - snprintf(toybuf, sizeof(toybuf), "/sys/bus/pci/devices/0000:%s/config", - new->name+5); + snprintf(toybuf, sizeof(toybuf), "/sys/bus/pci/devices/%s/config", new->name); fp = xfopen(toybuf, "r"); while ((b = fgetc(fp)) != EOF) { if ((col % 16) == 0) printf("%02x: ", col & 0xf0); -- 2.39.2