From 550345e5f6bb536770b5d712182eb6db73f83ea1 Mon Sep 17 00:00:00 2001 From: Jesse Michael Date: Mon, 20 Jan 2020 12:46:22 -0800 Subject: Fix format string for parsing /sys/bus/pci/devices/ entries (#13) --- simulator/HAL.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'simulator/HAL.cpp') diff --git a/simulator/HAL.cpp b/simulator/HAL.cpp index 2342840..e6febb7 100644 --- a/simulator/HAL.cpp +++ b/simulator/HAL.cpp @@ -142,7 +142,7 @@ bool is_pci_function(const char *pci_path, int wanted_function) int bus = 0; int slot = 0; int function = 0; - if (4 == sscanf(pci_path, "%d:%d:%d.%d\n", &sys, &bus, &slot, &function)) + if (4 == sscanf(pci_path, "%x:%x:%x.%d\n", &sys, &bus, &slot, &function)) { if (wanted_function == function) { @@ -223,6 +223,7 @@ bool initHAL(const char *pci_path, int wanted_function) pci_path = located_pci_path; if(!located_pci_path) { + fprintf(stderr, "Unable to find supported PCI device\n"); return false; } } -- cgit v1.2.1