Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add PCI device info to ghwc #209

Merged
merged 1 commit into from
Jan 13, 2021
Merged

add PCI device info to ghwc #209

merged 1 commit into from
Jan 13, 2021

Conversation

jaypipes
Copy link
Owner

Adds a new ghwc pci subcommand that lists PCI devices. Deprecates the
old PCIInfo.Products, PCIInfo.Classes and PCIInfo.Vendors maps because
these are now fully contained in the github.com/jaypipes/pcidb library.

[jaypipes@thelio ghw]$ go run cmd/ghwc/main.go pci
PCI (45 devices)
[jaypipes@thelio ghw]$ go run cmd/ghwc/main.go pci --format yaml | head -n30
pci:
  Devices:
  - address: "0000:00:00.0"
    class:
      id: "06"
      name: Bridge
    product:
      id: "1450"
      name: Family 17h (Models 00h-0fh) Root Complex
    programming_interface:
      id: "00"
      name: unknown
    subclass:
      id: "00"
      name: Host bridge
    subsystem:
      id: "1450"
      name: unknown
    vendor:
      id: "1022"
      name: Advanced Micro Devices, Inc. [AMD]
  - address: "0000:00:00.2"
    class:
      id: "08"
      name: Generic system peripheral
    product:
      id: "1451"
      name: Family 17h (Models 00h-0fh) I/O Memory Management Unit
    programming_interface:
      id: "00"

Issue #207

Adds a new `ghwc pci` subcommand that lists PCI devices. Deprecates the
old PCIInfo.Products, PCIInfo.Classes and PCIInfo.Vendors maps because
these are now fully contained in the github.com/jaypipes/pcidb library.

```
[jaypipes@thelio ghw]$ go run cmd/ghwc/main.go pci
PCI (45 devices)
[jaypipes@thelio ghw]$ go run cmd/ghwc/main.go pci --format yaml | head -n30
pci:
  Devices:
  - address: "0000:00:00.0"
    class:
      id: "06"
      name: Bridge
    product:
      id: "1450"
      name: Family 17h (Models 00h-0fh) Root Complex
    programming_interface:
      id: "00"
      name: unknown
    subclass:
      id: "00"
      name: Host bridge
    subsystem:
      id: "1450"
      name: unknown
    vendor:
      id: "1022"
      name: Advanced Micro Devices, Inc. [AMD]
  - address: "0000:00:00.2"
    class:
      id: "08"
      name: Generic system peripheral
    product:
      id: "1451"
      name: Family 17h (Models 00h-0fh) I/O Memory Management Unit
    programming_interface:
      id: "00"
```

Issue #207
@@ -692,31 +692,29 @@ are exposed on the `ghw.PCIInfo` struct.
The `ghw.PCI()` function returns a `ghw.PCIInfo` struct. The `ghw.PCIInfo`
struct contains a number of fields that may be queried for PCI information:

* `ghw.PCIInfo.Devices` is a slice of pointers to `ghw.PCIDevice` structs that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not clear to me if calling ListDevices() is now deprecated or still fully supported. Both approaches works from client perspective. As API consumer I for myself prefer to have functions as part of the APIs (e.g. calling ListDevices() explicitely to get a fresh list of devices) but this is mostly personal taste.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced ListDevices() with a PCIInfo.Devices slice to make the interface match the other "XXXInfo" structs for consistency purposes. I've gone ahead and deprecated the ListDevices exported function and will unexport it in the v1.0 release (as of yet, I don't have a release date target for v1.0 though) :)

Copy link
Collaborator

@ffromani ffromani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good with a question inside about the API.

@jaypipes jaypipes merged commit 9e8eb33 into master Jan 13, 2021
@jaypipes jaypipes deleted the issue207 branch February 2, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants