Repository navigation
pci: use the PCI database passed with WithPCIDB - #479
Merged
Merged
Conversation
jaypipes#415 let callers pass their own PCI database, for example a preloaded one or an empty one when only the IDs are needed. The rework of the options in 257865f ("remove pkg/context, overhaul snapshot handling") dropped the lines that handed it to the PCI info, so since then option.WithPCIDB stores the database in the context, nothing reads it, and ghw always loads its own. pci.New now takes the database from the context when one is set. The modifier behind it, config.WithPCIDB, is exported as ghw.WithPCIDB, as the other modifiers are, and the deprecated option.WithPCIDB points to it instead of the removed pkg/context. Tests cover a database passed with the modifier and with the old option, and an empty database, which keeps every ID as the device reports it and leaves every name unknown. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
rucoder
force-pushed
the
fix/pci-custom-pcidb
branch
from
October 22, 2026 11:30
d5dd369 to
07c7bc0
Compare
4 of 7 tasks
rucoder
added a commit
to zededa/ghw
that referenced
this pull request
Oct 23, 2026
jaypipes#415 let callers pass their own PCI database, for example a preloaded one or an empty one when only the IDs are needed. The rework of the options in 257865f ("remove pkg/context, overhaul snapshot handling") dropped the lines that handed it to the PCI info, so since then option.WithPCIDB stores the database in the context, nothing reads it, and ghw always loads its own. pci.New now takes the database from the context when one is set. The modifier behind it, config.WithPCIDB, is exported as ghw.WithPCIDB, as the other modifiers are, and the deprecated option.WithPCIDB points to it instead of the removed pkg/context. Tests cover a database passed with the modifier and with the old option, and an empty database, which keeps every ID as the device reports it and leaves every name unknown. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com> (cherry picked from commit 07c7bc0, jaypipes#479)
rucoder
added a commit
to rucoder/eve
that referenced
this pull request
Oct 23, 2026
zededa/ghw now keeps one branch per release of the upstream jaypipes/ghw: the release, EVE's changes ported onto it, and the module rename last. eve/v0.26.0 is jaypipes v0.26.0 plus those changes; pillar was on the fork's main, which sat on jaypipes v0.21.0. The hardware inventory is unchanged except for what upstream fixed in between: - the CPU entries come in package order rather than Go map order; - on boards without DMI, BIOS, chassis, product and baseboard come from the device tree, and the CPU model from the SoC's compatible string when /proc/cpuinfo names none. The branch also carries upstream's fix for WithPCIDB (jaypipes/ghw#479). Since the fork took upstream's rework of the options, ghw stored the PCI database passed in but never used it. hardware passes an empty one because it needs only the IDs, and ghw loaded the full pci.ids for every inventory instead. It now uses the empty database; the inventory carries only the IDs, so it does not change. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
rene
pushed a commit
to lf-edge/eve
that referenced
this pull request
Oct 27, 2026
zededa/ghw now keeps one branch per release of the upstream jaypipes/ghw: the release, EVE's changes ported onto it, and the module rename last. eve/v0.26.0 is jaypipes v0.26.0 plus those changes; pillar was on the fork's main, which sat on jaypipes v0.21.0. The hardware inventory is unchanged except for what upstream fixed in between: - the CPU entries come in package order rather than Go map order; - on boards without DMI, BIOS, chassis, product and baseboard come from the device tree, and the CPU model from the SoC's compatible string when /proc/cpuinfo names none. The branch also carries upstream's fix for WithPCIDB (jaypipes/ghw#479). Since the fork took upstream's rework of the options, ghw stored the PCI database passed in but never used it. hardware passes an empty one because it needs only the IDs, and ghw loaded the full pci.ids for every inventory instead. It now uses the empty database; the inventory carries only the IDs, so it does not change. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#415 let callers pass their own PCI database with
option.WithPCIDB, for example a preloaded one, or an empty one when only the IDs are needed. The rework of the options in 257865f ("remove pkg/context, overhaul snapshot handling") dropped the lines inpci.Newthat used it. Since then the database is stored in the context, but nothing reads it, and ghw always loads its ownpci.ids.This PR:
pci.Newtake the database from the context when one is set;config.WithPCIDB, asghw.WithPCIDB, like the other modifiers (until now a caller outside ghw had only the deprecated option);option.WithPCIDBatghw.WithPCIDBinstead of the removedpkg/context;ghw.WithPCIDBin the README's PCI section.TestPCICustomPCIDBpasses a database with a custom vendor name, through the modifier and through the old option, and checks a snapshot device's vendor name comes from it. It fails on main for both and passes with the fix.TestPCIEmptyPCIDBcovers callers that need only the IDs: with an empty database every ID stays as the device reports it and every vendor and product name isunknown. On main it fails, because ghw ignores the empty database and fills in names from its ownpci.ids.