
On Fri, Nov 14, 2008 at 02:57:09PM -0500, David Lively wrote:
+ (void)get_int_prop(ctx, udi, "pci.vendor_id", (int *)&d->pci_dev.vendor); + if (get_str_prop(ctx, udi, "pci.vendor", &d->pci_dev.vendor_name) != 0) + (void)get_str_prop(ctx, udi, "info.vendor", &d->pci_dev.vendor_name); + (void)get_int_prop(ctx, udi, "pci.product_id", (int *)&d->pci_dev.product); + if (get_str_prop(ctx, udi, "pci.product", &d->pci_dev.product_name) != 0) + (void)get_str_prop(ctx, udi, "info.product", &d->pci_dev.product_name);
By the way - vendor and product IDs are normally quoted in hex, not decimal - e.g. I'd know my NIC is 8086:10de, not 32902:4318
I guess most other integer values in libvirt XML are decimal, but might be worth adding a hex format for this?
I'd prefer hex for vid/pid as well; I just stuck with decimal since the rest of libvirt does. If this does get changed to output hex, I'd only request that we prefix hex numbers with "0x" so people don't have to remember which attrs are dumped in hex and which in decimal.
I've included the 0x prefix & padded to 4 digits minimum. Looks much nicer now :-) Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|