[HIDCLASS]

- Fix some whitespace

svn path=/trunk/; revision=59003
This commit is contained in:
Thomas Faber 2013-05-12 15:23:34 +00:00
parent e0936866ae
commit df2001250f
4 changed files with 131 additions and 115 deletions

View file

@ -7,6 +7,7 @@
* Michael Martin (michael.martin@reactos.org) * Michael Martin (michael.martin@reactos.org)
* Johannes Anderwald (johannes.anderwald@reactos.org) * Johannes Anderwald (johannes.anderwald@reactos.org)
*/ */
#include "precomp.h" #include "precomp.h"
NTSTATUS NTSTATUS
@ -221,7 +222,7 @@ HidClassFDO_GetDescriptors(
ASSERT(FDODeviceExtension->Common.IsFDO); ASSERT(FDODeviceExtension->Common.IsFDO);
// //
// lets allocate irp // let's allocate irp
// //
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
if (!Irp) if (!Irp)
@ -262,7 +263,7 @@ HidClassFDO_GetDescriptors(
} }
// //
// lets get device attributes // let's get device attributes
// //
IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_GET_DEVICE_ATTRIBUTES; IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_GET_DEVICE_ATTRIBUTES;
IoStack->Parameters.DeviceIoControl.OutputBufferLength = sizeof(HID_DEVICE_ATTRIBUTES); IoStack->Parameters.DeviceIoControl.OutputBufferLength = sizeof(HID_DEVICE_ATTRIBUTES);
@ -290,7 +291,6 @@ HidClassFDO_GetDescriptors(
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].wReportLength > 0); ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].wReportLength > 0);
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].bReportType == HID_REPORT_DESCRIPTOR_TYPE); ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].bReportType == HID_REPORT_DESCRIPTOR_TYPE);
// //
// now allocate space for the report descriptor // now allocate space for the report descriptor
// //
@ -359,7 +359,7 @@ HidClassFDO_StartDevice(
} }
// //
// lets start the lower device too // let's start the lower device too
// //
IoSkipCurrentIrpStackLocation(Irp); IoSkipCurrentIrpStackLocation(Irp);
Status = HidClassFDO_DispatchRequestSynchronous(DeviceObject, Irp); Status = HidClassFDO_DispatchRequestSynchronous(DeviceObject, Irp);
@ -372,7 +372,7 @@ HidClassFDO_StartDevice(
} }
// //
// lets get the descriptors // let's get the descriptors
// //
Status = HidClassFDO_GetDescriptors(DeviceObject); Status = HidClassFDO_GetDescriptors(DeviceObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))

View file

@ -41,7 +41,6 @@ HidClassAddDevice(
ULONG DeviceExtensionSize; ULONG DeviceExtensionSize;
PHIDCLASS_DRIVER_EXTENSION DriverExtension; PHIDCLASS_DRIVER_EXTENSION DriverExtension;
/* increment device number */ /* increment device number */
InterlockedIncrement((PLONG)&HidClassDeviceNumber); InterlockedIncrement((PLONG)&HidClassDeviceNumber);
@ -336,9 +335,6 @@ HidClass_Close(
// //
KeReleaseSpinLock(&IrpContext->Lock, OldLevel); KeReleaseSpinLock(&IrpContext->Lock, OldLevel);
// //
// remove context // remove context
// //
@ -429,13 +425,15 @@ HidClass_ReadCompleteIrp(
// //
// get collection description // get collection description
// //
CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber); CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
IrpContext->FileOp->DeviceExtension->CollectionNumber);
ASSERT(CollectionDescription); ASSERT(CollectionDescription);
// //
// get report description // get report description
// //
ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber); ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
IrpContext->FileOp->DeviceExtension->CollectionNumber);
ASSERT(ReportDescription); ASSERT(ReportDescription);
if (CollectionDescription && ReportDescription) if (CollectionDescription && ReportDescription)
@ -638,13 +636,15 @@ HidClass_BuildIrp(
// //
// get collection description // get collection description
// //
CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber); CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
IrpContext->FileOp->DeviceExtension->CollectionNumber);
ASSERT(CollectionDescription); ASSERT(CollectionDescription);
// //
// get report description // get report description
// //
ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber); ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
IrpContext->FileOp->DeviceExtension->CollectionNumber);
ASSERT(ReportDescription); ASSERT(ReportDescription);
// //
@ -664,7 +664,6 @@ HidClass_BuildIrp(
} }
// //
// store report length // store report length
// //
@ -712,7 +711,6 @@ HidClass_BuildIrp(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
NTSTATUS NTSTATUS
NTAPI NTAPI
HidClass_Read( HidClass_Read(
@ -764,14 +762,18 @@ HidClass_Read(
Irp->IoStatus.Status = STATUS_CANCELLED; Irp->IoStatus.Status = STATUS_CANCELLED;
IoCompleteRequest(Irp, IO_NO_INCREMENT); IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_CANCELLED; return STATUS_CANCELLED;
} }
// //
// build irp request // build irp request
// //
Status = HidClass_BuildIrp(DeviceObject, Irp, Context, IOCTL_HID_READ_REPORT, IoStack->Parameters.Read.Length, &NewIrp, &NewIrpContext); Status = HidClass_BuildIrp(DeviceObject,
Irp,
Context,
IOCTL_HID_READ_REPORT,
IoStack->Parameters.Read.Length,
&NewIrp,
&NewIrpContext);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
// //
@ -814,7 +816,7 @@ HidClass_Read(
IoMarkIrpPending(Irp); IoMarkIrpPending(Irp);
// //
// lets dispatch the request // let's dispatch the request
// //
ASSERT(Context->DeviceExtension); ASSERT(Context->DeviceExtension);
Status = Context->DeviceExtension->Common.DriverExtension->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL](Context->DeviceExtension->FDODeviceObject, NewIrp); Status = Context->DeviceExtension->Common.DriverExtension->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL](Context->DeviceExtension->FDODeviceObject, NewIrp);
@ -907,7 +909,8 @@ HidClass_DeviceControl(
// //
// get collection description // get collection description
// //
CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription, PDODeviceExtension->CollectionNumber); CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
PDODeviceExtension->CollectionNumber);
ASSERT(CollectionDescription); ASSERT(CollectionDescription);
// //
@ -932,7 +935,8 @@ HidClass_DeviceControl(
// //
// get collection description // get collection description
// //
CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription, PDODeviceExtension->CollectionNumber); CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
PDODeviceExtension->CollectionNumber);
ASSERT(CollectionDescription); ASSERT(CollectionDescription);
// //
@ -985,7 +989,6 @@ HidClass_InternalDeviceControl(
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }
NTSTATUS NTSTATUS
NTAPI NTAPI
HidClass_Power( HidClass_Power(
@ -1134,7 +1137,9 @@ HidRegisterMinidriver(
DriverExtension->DriverUnload = MinidriverRegistration->DriverObject->DriverUnload; DriverExtension->DriverUnload = MinidriverRegistration->DriverObject->DriverUnload;
/* copy driver dispatch routines */ /* copy driver dispatch routines */
RtlCopyMemory(DriverExtension->MajorFunction, MinidriverRegistration->DriverObject->MajorFunction, sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION+1)); RtlCopyMemory(DriverExtension->MajorFunction,
MinidriverRegistration->DriverObject->MajorFunction,
sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION+1));
/* initialize lock */ /* initialize lock */
KeInitializeSpinLock(&DriverExtension->Lock); KeInitializeSpinLock(&DriverExtension->Lock);

View file

@ -7,6 +7,7 @@
* Michael Martin (michael.martin@reactos.org) * Michael Martin (michael.martin@reactos.org)
* Johannes Anderwald (johannes.anderwald@reactos.org) * Johannes Anderwald (johannes.anderwald@reactos.org)
*/ */
#include "precomp.h" #include "precomp.h"
PHIDP_COLLECTION_DESC PHIDP_COLLECTION_DESC
@ -290,7 +291,6 @@ HidClassPDO_HandleQueryInstanceId(
PDODeviceExtension = (PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; PDODeviceExtension = (PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(PDODeviceExtension->Common.IsFDO == FALSE); ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
// //
// allocate buffer // allocate buffer
// //
@ -426,7 +426,9 @@ HidClassPDO_PnP(
// //
// copy capabilities // copy capabilities
// //
RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities, &PDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES)); RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
&PDODeviceExtension->Capabilities,
sizeof(DEVICE_CAPABILITIES));
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
break; break;
} }
@ -510,7 +512,10 @@ HidClassPDO_PnP(
// //
// now register the device interface // now register the device interface
// //
Status = IoRegisterDeviceInterface(PDODeviceExtension->Common.HidDeviceExtension.PhysicalDeviceObject, &GUID_DEVINTERFACE_HID, NULL, &PDODeviceExtension->DeviceInterface); Status = IoRegisterDeviceInterface(PDODeviceExtension->Common.HidDeviceExtension.PhysicalDeviceObject,
&GUID_DEVINTERFACE_HID,
NULL,
&PDODeviceExtension->DeviceInterface);
DPRINT("[HIDCLASS] IoRegisterDeviceInterfaceState Status %x\n", Status); DPRINT("[HIDCLASS] IoRegisterDeviceInterfaceState Status %x\n", Status);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
@ -659,15 +664,21 @@ HidClassPDO_CreatePDO(
RtlZeroMemory(DeviceRelations, Length); RtlZeroMemory(DeviceRelations, Length);
// //
// lets create a PDO for top level collection // let's create a PDO for top level collection
// //
Index = 0; Index = 0;
do do
{ {
// //
// lets create the device object // let's create the device object
// //
Status = IoCreateDevice(FDODeviceExtension->Common.DriverExtension->DriverObject, sizeof(HIDCLASS_PDO_DEVICE_EXTENSION), NULL, FILE_DEVICE_UNKNOWN, FILE_AUTOGENERATED_DEVICE_NAME, FALSE, &PDODeviceObject); Status = IoCreateDevice(FDODeviceExtension->Common.DriverExtension->DriverObject,
sizeof(HIDCLASS_PDO_DEVICE_EXTENSION),
NULL,
FILE_DEVICE_UNKNOWN,
FILE_AUTOGENERATED_DEVICE_NAME,
FALSE,
&PDODeviceObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
// //