by tonyw » Fri Mar 23, 2012 1:01 pm
The supported way would be to use expansion.library calls. But expansion.lib only works on PCI devices AFAIK, it might not deal with all USB controllers.
Here is a way of finding out if a given vendor/device exists (not quite what you wanted but it might help).
ExpansionBase = IExec->OpenLibrary ("expansion.library", 53L);
IExpansion = (struct ExpansionIFace *)(IExec->GetInterface ((struct Library *)ExpansionBase, "main", 1, NULL));
IPCI = (struct PCIIFace *)(IExec->GetInterface ((struct Library *)ExpansionBase, "pci", 1, NULL));
pcidev = IPCI->FindDeviceTags (FDT_VendorID, VendorID,
FDT_DeviceID, DeviceID,
// FDT_Index, N,
TAG_DONE);
pcidev is non-NULL if the search was successful. You can also add a counter N in the tags, to return the Nth entry.
Having pcidev, you can read the Config registers; the first two 16-bit words are the Vendor and DeviceID. If you already have pcidev (or some equivalent), you may be able to look up the config registers using that. The worst that can happen is that it will crash or give a machine check exception.
cheers
tony