]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/proc.c
Released as 3.5.4
[pciutils.git] / lib / proc.c
index e9ca24d019f40f93bcc40fd0136dd4caa921fafb..cb9d08d17768dd1379849ca505d58ebe33067fae 100644 (file)
@@ -130,6 +130,15 @@ proc_setup(struct pci_dev *d, int rw)
        a->error("File name too long");
       a->fd_rw = a->writeable || rw;
       a->fd = open(buf, a->fd_rw ? O_RDWR : O_RDONLY);
+      if (a->fd < 0)
+       {
+         e = snprintf(buf, sizeof(buf), "%s/%04x:%02x/%02x.%d",
+                      pci_get_param(a, "proc.path"),
+                      d->domain, d->bus, d->dev, d->func);
+         if (e < 0 || e >= (int) sizeof(buf))
+           a->error("File name too long");
+         a->fd = open(buf, a->fd_rw ? O_RDWR : O_RDONLY);
+       }
       if (a->fd < 0)
        a->warning("Cannot open %s", buf);
       a->cached_dev = d;