Hello! > Aha. That makes sense; I suspect most PCI devices don't allow the OS to > write that field ;-) I didn't like the 'read it byte-by-byte' part of > the patch, so I changed it to pci_get_word(). > > Martin, now that we have a reason, what do you think to this patch?
Applied :) (Available in the GIT repository and also as a -pre2.) > --- pciutils-2.2.1/lib/generic.c.devicetype 2004-08-13 16:15:23.000000000 > -0400 > +++ pciutils-2.2.1/lib/generic.c 2005-12-13 17:02:12.000000000 -0500 > @@ -46,7 +46,8 @@ > d->func = t->func; > d->vendor_id = vd & 0xffff; > d->device_id = vd >> 16U; > - d->known_fields = PCI_FILL_IDENT; > + d->device_class = pci_read_word(t, PCI_CLASS_DEVICE); > + d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS; Except for this bit -- why should we read it if nobody requested? > --- pciutils-2.2.1/lib/example.c.devicetype 2000-03-09 03:38:33.000000000 > -0500 > +++ pciutils-2.2.1/lib/example.c 2005-12-13 17:02:12.000000000 -0500 > @@ -21,7 +21,7 @@ > pci_scan_bus(pacc); /* We want to get the list of devices */ > for(dev=pacc->devices; dev; dev=dev->next) /* Iterate over all devices */ > { > - pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES); /* Fill in > header info we need */ > + pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS); > /* Fill in header info we need */ > c = pci_read_word(dev, PCI_CLASS_DEVICE); /* Read config register > directly */ This doesn't make much sense, I've tried to come with a better example. Have a nice fortnight -- Martin `MJ' Mares <[EMAIL PROTECTED]> http://atrey.karlin.mff.cuni.cz/~mj/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth IBM = Inside Black Magic -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]