[HIDCLASS]

- Implement HidClass_Power
[USBCCGP]
- Remove superflous spaces
- Implement IRP_MJ_SYSTEM_CONTROL
- Fix bug in IRP_MJ_POWER handler
- Add driver unload routine
[USBEHCI,USBOHCI, USBUHCI]
- Support Win2k3 usbhub.sys, which uses null device handle for the root usb hub
- Based on a patch by Thomas Faber

svn path=/trunk/; revision=59080
This commit is contained in:
Johannes Anderwald 2013-05-24 17:36:14 +00:00
parent e29102f914
commit a2085a332c
7 changed files with 65 additions and 14 deletions

View file

@ -971,8 +971,21 @@ HidClass_Power(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
UNIMPLEMENTED
return STATUS_NOT_IMPLEMENTED;
PHIDCLASS_COMMON_DEVICE_EXTENSION CommonDeviceExtension;
CommonDeviceExtension = DeviceObject->DeviceExtension;
if (CommonDeviceExtension->IsFDO)
{
IoCopyCurrentIrpStackLocationToNext(Irp);
return HidClassFDO_DispatchRequest(DeviceObject, Irp);
}
else
{
Irp->IoStatus.Status = STATUS_SUCCESS;
PoStartNextPowerIrp(Irp);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
}
NTSTATUS

View file

@ -185,6 +185,11 @@ HidClassFDO_PnP(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
HidClassFDO_DispatchRequest(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
HidClassFDO_DispatchRequestSynchronous(
IN PDEVICE_OBJECT DeviceObject,

View file

@ -97,7 +97,7 @@ FDO_QueryCapabilities(
NTSTATUS
FDO_DeviceRelations(
PDEVICE_OBJECT DeviceObject,
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
ULONG DeviceCount = 0;
@ -238,7 +238,7 @@ FDO_CreateChildPdo(
NTSTATUS
FDO_StartDevice(
PDEVICE_OBJECT DeviceObject,
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
NTSTATUS Status;
@ -565,7 +565,7 @@ FDO_HandleInternalDeviceControl(
/* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_RESET_PORT ||
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_RESET_PORT ||
IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_CYCLE_PORT)
{
/* Handle reset / cycle ports */
@ -585,13 +585,34 @@ FDO_HandleInternalDeviceControl(
return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
}
NTSTATUS
FDO_HandleSystemControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PFDO_DEVICE_EXTENSION FDODeviceExtension;
/* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
/* Forward and forget request */
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
}
NTSTATUS
FDO_Dispatch(
PDEVICE_OBJECT DeviceObject,
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
NTSTATUS Status;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
/* Get device extension */
FDODeviceExtension = DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
/* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@ -600,8 +621,14 @@ FDO_Dispatch(
{
case IRP_MJ_PNP:
return FDO_HandlePnp(DeviceObject, Irp);
case IRP_MJ_INTERNAL_DEVICE_CONTROL:
case IRP_MJ_INTERNAL_DEVICE_CONTROL:
return FDO_HandleInternalDeviceControl(DeviceObject, Irp);
case IRP_MJ_POWER:
PoStartNextPowerIrp(Irp);
IoSkipCurrentIrpStackLocation(Irp);
return PoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
case IRP_MJ_SYSTEM_CONTROL:
return FDO_HandleSystemControl(DeviceObject, Irp);
default:
DPRINT1("FDO_Dispatch Function %x not implemented\n", IoStack->MajorFunction);
ASSERT(FALSE);

View file

@ -1076,6 +1076,11 @@ PDO_Dispatch(
return PDO_HandlePnp(DeviceObject, Irp);
case IRP_MJ_INTERNAL_DEVICE_CONTROL:
return PDO_HandleInternalDeviceControl(DeviceObject, Irp);
case IRP_MJ_POWER:
PoStartNextPowerIrp(Irp);
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
default:
DPRINT1("PDO_Dispatch Function %x not implemented\n", IoStack->MajorFunction);
Status = Irp->IoStatus.Status;

View file

@ -160,7 +160,8 @@ DriverEntry(
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = USBCCGP_Dispatch;
DriverObject->MajorFunction[IRP_MJ_POWER] = USBCCGP_Dispatch;
DriverObject->MajorFunction[IRP_MJ_PNP] = USBCCGP_Dispatch;
DriverObject->DriverUnload = USBCCGP_Unload;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = USBCCGP_Dispatch;
DriverObject->DriverUnload = USBCCGP_Unload;
/* FIMXE query GenericCompositeUSBDeviceString */

View file

@ -757,7 +757,7 @@ HidParser_GetScaledUsageValueWithReport(
}
else
{
// HACK: logical boundaries are absolute values
// logical boundaries are absolute values
return HIDPARSER_STATUS_BAD_LOG_PHY_VALUES;
}

View file

@ -839,7 +839,7 @@ CHubController::HandleBulkOrInterruptTransfer(
//
// Is the Request for the root hub
//
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) || Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
ASSERT(m_PendingSCEIrp == NULL);
if (QueryStatusChageEndpoint(Irp))
@ -1189,7 +1189,7 @@ CHubController::HandleGetStatusFromDevice(
DeviceStatus = (PUSHORT)Urb->UrbControlGetStatusRequest.TransferBuffer;
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) || Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// FIXME need more flags ?
@ -1319,7 +1319,7 @@ CHubController::HandleClassDevice(
case USB_DEVICE_CLASS_RESERVED: // FALL THROUGH
case USB_DEVICE_CLASS_HUB:
{
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) || Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// sanity checks
@ -1525,7 +1525,7 @@ CHubController::HandleGetDescriptor(
PC_ASSERT(Urb->UrbControlDescriptorRequest.TransferBufferLength >= sizeof(USB_DEVICE_DESCRIPTOR));
PC_ASSERT(Urb->UrbControlDescriptorRequest.TransferBuffer);
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) || Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// copy root hub device descriptor
@ -1578,7 +1578,7 @@ CHubController::HandleGetDescriptor(
BufferLength = Urb->UrbControlDescriptorRequest.TransferBufferLength;
Buffer = (PUCHAR) Urb->UrbControlDescriptorRequest.TransferBuffer;
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) || Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// request is for the root bus controller