Fix IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs for root USB hubs.

The vendor and device IDs are not filled in Cromwell code, so ask directly the PCI device to retrieve the information

svn path=/trunk/; revision=17981
This commit is contained in:
Hervé Poussineau 2005-09-22 11:20:52 +00:00
parent 752fed43fb
commit 4a4df71398

View file

@ -104,18 +104,55 @@ UsbMpPdoQueryId(
{
CHAR Buffer[2][40];
PCHAR RootHubName;
USHORT Vendor, Product, Revision;
PCI_COMMON_CONFIG PciData;
ULONG BusNumber, SlotNumber;
ULONG ret;
PDEVICE_OBJECT Pdo;
DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
Vendor = DeviceExtension->pdev->vendor;
Product = DeviceExtension->pdev->device;
Revision = 0; /* FIXME */
Pdo = DeviceExtension->PhysicalDeviceObject;
Status = IoGetDeviceProperty(
Pdo,
DevicePropertyBusNumber,
sizeof(ULONG),
&BusNumber,
&ret);
if (!NT_SUCCESS(Status))
{
DPRINT("USBMP: IoGetDeviceProperty() failed with status 0x%08lx\n", Status);
break;
}
Status = IoGetDeviceProperty(
Pdo,
DevicePropertyAddress,
sizeof(ULONG),
&SlotNumber,
&ret);
if (!NT_SUCCESS(Status))
{
DPRINT("USBMP: IoGetDeviceProperty() failed with status 0x%08lx\n", Status);
break;
}
ret = HalGetBusDataByOffset(PCIConfiguration,
BusNumber,
SlotNumber,
&PciData,
0,
PCI_COMMON_HDR_LENGTH);
if (ret != PCI_COMMON_HDR_LENGTH)
{
DPRINT("USBMP: HalGetBusDataByOffset() failed (ret = %ld)\n", ret);
Status = STATUS_IO_DEVICE_ERROR;
break;
}
sprintf(Buffer[0], "USB\\VID%04X&PID%04X&REV%04X",
Vendor, Product, Revision);
PciData.VendorID, PciData.DeviceID, PciData.RevisionID);
sprintf(Buffer[1], "USB\\VID%04X&PID%04X",
Vendor, Product);
PciData.VendorID, PciData.DeviceID);
if (roothub->speed == USB_SPEED_LOW || roothub->speed == USB_SPEED_FULL)
RootHubName = "USB\\ROOT_HUB"; /* USB 1.1 */
else