Prefer pciids database from ports if present

Given the pciids database on ports is updated more often than the one in base
prefer this version if present, otherwise read the one from base.

MFC after:	1 week
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D3391
This commit is contained in:
Baptiste Daroussin 2015-09-06 20:05:29 +00:00
parent 949b0d9970
commit 1ed2002089
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287522
3 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,4 @@
/* $FreeBSD$ */
#define _PATH_DEVPCI "/dev/pci"
#define _PATH_PCIVDB "/usr/share/misc/pci_vendors"
#define _PATH_LPCIVDB "/usr/local/share/pciids/pci.ids"

View file

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 20, 2014
.Dd September 06, 2015
.Dt PCICONF 8
.Os
.Sh NAME
@ -281,7 +281,9 @@ indicates a halfword (two-byte) operation.
The default is to read or
write a longword (four bytes).
.Sh ENVIRONMENT
The PCI vendor/device information database is normally read from
PCI vendor and device information is read from
.Pa /usr/local/share/pciids/pci.ids .
If that file is not present, it is read from
.Pa /usr/share/misc/pci_vendors .
This path can be overridden by setting the environment variable
.Ev PCICONF_VENDOR_DATABASE .

View file

@ -549,9 +549,12 @@ load_vendors(void)
*/
TAILQ_INIT(&pci_vendors);
if ((dbf = getenv("PCICONF_VENDOR_DATABASE")) == NULL)
dbf = _PATH_LPCIVDB;
if ((db = fopen(dbf, "r")) == NULL) {
dbf = _PATH_PCIVDB;
if ((db = fopen(dbf, "r")) == NULL)
return(1);
if ((db = fopen(dbf, "r")) == NULL)
return(1);
}
cv = NULL;
cd = NULL;
error = 0;