← Back to team overview

checkbox-dev team mailing list archive

Re: Using libpci to resolve device names

 



W dniu 23.04.2015 o 21:25, Daniel Manrique pisze:
On Thu, Apr 23, 2015 at 3:17 PM, Zygmunt Krynicki
<zygmunt.krynicki@xxxxxxxxxxxxx> wrote:
Hey

A while ago I talked to Pierre about a bug where we would not see
product name for a certain PCI graphics card. We looked, read, and
searched and realized how the PCI database works. We thought about
adding a local database or about doing something better than just not
working at all.

Just to confirm, the recent hack so that if there's no product name we
show the PCI ID, was that helpful at all?

There is an entry for the vendor:device but there's no entry for vendor:device subsystem:subvendor. There was no entry in the upstream repository.

The bug number would be useful to see more detail about this :)

Sorry, I was too lazy to look it up. It is https://bugs.launchpad.net/plainbox-provider-checkbox/+bug/1343089

The canonical way to look up those names is through libpci. Since
libpci is written in C and has a simple API I thought about making
some bindings so that we can use that in checkbox.

And so I did, this is an example program that does vendor or device
name lookup [1, 2, 3]. Note that currently it only works on Python 3.4
as I used the enum module (it doesn't work on Ubuntu 12.04).

One interesting observation is the ability to query the central server
when a given identifier cannot be found in a local database. You can
use that by setting pci.flag_network = True (or call the pci-lookup
script with --network argument at the end).

Without more data on the bug I can only speculate, but if this
happened on a SUT, the solution that looks up stuff on the central
server may not work (tm) if the network is down for some reason. In
this case you'll still get no product name, which can be an issue if
you're running tests locally. If this is about something else, then
perhaps I'm wrong :)

There are many possibilities. Libpci can generate phony device names, mixed names, can use a local cache, can lookup data over network, etc. It's quite flexible.

Personally, I think we should just use the network lookup feature in HEXR. This would remove any reason to update PCI database periodically as it would always be up-to-date.

Please tell me what you think.

I think this is awesome! and should be quite useful.

I looked at the API and we can use it to enumerate devices. We can use various constants to filter devices (perhaps better than checkbox-support currently does). Have a look at this list

http://libpci.readthedocs.org/en/latest/usage.html#module-libpci._macros

Thanks
ZK


Follow ups

References