How to scan for PCI devices? (fwd)

=?ISO-8859-1?Q?I=F1aky_P=E9rez_Gonz=E1lez?= (inaky@peloncho.fis.ucm.es)
Fri, 4 Jul 1997 00:00:23 +0200 (MET DST)


Hi

I'm having a so-stupid-problem (tm) that I'm ashamed of asking
about it, but I can't find my way through so ... if you can help
me, you'll win A BIG NICE smile from me :) (and will be able of
counting with my eternal gratitude):

So, it's quite silly, as I told. You got this damn USB controller
on the motherboard, an UHCI one, no problem, PCI class id 0x0c03, bus
0, device 0, function 2, and another one, a CMD add-on board, an
OHCI one, PCI class id 0x0c03, bus 0, device 8, function 0 (0x0c03 is
the USB class and subclass codes for USB host controllers).

Then I start to scan for pci classes 0x0c03, with the following
code:

#define USB_CLASS 0x0c03

while ((bioscode = pcibios_find_class (USB_CLASS, index,
&bus, &function))
== PCIBIOS_SUCCESSFUL)
{
index++;
usb_hosts++;
}

(all the vars are declared as they should be, etc ...)

I suppossed that when I found the first controller of the class, that
one would be index number 0, the following, index number 1, and so on
... isn't it? But when I run this code, it detects the first one quite
right, and then freezes for a while (when using the index set to one)
until it returns PCI_DEVICE_NOT_FOUND. Why?

Okay, I thought, the card may be screwed up, but it is not, at
it shows fine on the /proc/pci entries, so it is detected
properly. The problem is me, who's driving even nuttier than before.

Can U help me?

TIA

-- 

Linux-USB is in development! http://www2.teknoland.es/~inaky

Inaky Perez Gonzalez -- PGP pubkey fingerprint - inaky@peloncho.fis.ucm.es 2:341/5.31 -- 8E 34 3A 62 64 99 E2 44 - http://peloncho.fis.ucm.es/~inaky -- AD 7B 30 D9 DD FF 3E 4C - ----------------------------------------------------------------- The loneliness of the long distance runner .....