Author: tfaber
Date: Sun May 12 15:23:34 2013
New Revision: 59003
URL:
http://svn.reactos.org/svn/reactos?rev=59003&view=rev
Log:
[HIDCLASS]
- Fix some whitespace
Modified:
trunk/reactos/drivers/hid/hidclass/fdo.c
trunk/reactos/drivers/hid/hidclass/hidclass.c
trunk/reactos/drivers/hid/hidclass/pdo.c
trunk/reactos/drivers/hid/hidclass/precomp.h
Modified: trunk/reactos/drivers/hid/hidclass/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidclass/fdo.c…
==============================================================================
--- trunk/reactos/drivers/hid/hidclass/fdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/hidclass/fdo.c [iso-8859-1] Sun May 12 15:23:34 2013
@@ -7,6 +7,7 @@
* Michael Martin (michael.martin(a)reactos.org)
* Johannes Anderwald (johannes.anderwald(a)reactos.org)
*/
+
#include "precomp.h"
NTSTATUS
@@ -221,7 +222,7 @@
ASSERT(FDODeviceExtension->Common.IsFDO);
//
- // lets allocate irp
+ // let's allocate irp
//
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
if (!Irp)
@@ -262,7 +263,7 @@
}
//
- // lets get device attributes
+ // let's get device attributes
//
IoStack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_HID_GET_DEVICE_ATTRIBUTES;
IoStack->Parameters.DeviceIoControl.OutputBufferLength =
sizeof(HID_DEVICE_ATTRIBUTES);
@@ -290,7 +291,6 @@
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].wReportLength > 0);
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].bReportType ==
HID_REPORT_DESCRIPTOR_TYPE);
-
//
// now allocate space for the report descriptor
//
@@ -359,7 +359,7 @@
}
//
- // lets start the lower device too
+ // let's start the lower device too
//
IoSkipCurrentIrpStackLocation(Irp);
Status = HidClassFDO_DispatchRequestSynchronous(DeviceObject, Irp);
@@ -372,7 +372,7 @@
}
//
- // lets get the descriptors
+ // let's get the descriptors
//
Status = HidClassFDO_GetDescriptors(DeviceObject);
if (!NT_SUCCESS(Status))
@@ -457,7 +457,7 @@
//
// copy device objects
//
- for(Index = 0; Index < FDODeviceExtension->DeviceRelations->Count; Index++)
+ for (Index = 0; Index < FDODeviceExtension->DeviceRelations->Count;
Index++)
{
//
// reference pdo
@@ -573,7 +573,7 @@
// get current irp stack location
//
IoStack = IoGetCurrentIrpStackLocation(Irp);
- switch(IoStack->MinorFunction)
+ switch (IoStack->MinorFunction)
{
case IRP_MN_START_DEVICE:
{
@@ -596,7 +596,7 @@
// set status to success and fall through
//
Irp->IoStatus.Status = STATUS_SUCCESS;
- }
+ }
default:
{
//
Modified: trunk/reactos/drivers/hid/hidclass/hidclass.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidclass/hidcl…
==============================================================================
--- trunk/reactos/drivers/hid/hidclass/hidclass.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/hidclass/hidclass.c [iso-8859-1] Sun May 12 15:23:34 2013
@@ -40,7 +40,6 @@
PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
ULONG DeviceExtensionSize;
PHIDCLASS_DRIVER_EXTENSION DriverExtension;
-
/* increment device number */
InterlockedIncrement((PLONG)&HidClassDeviceNumber);
@@ -313,7 +312,7 @@
//
// now free all irps
//
- while(!IsListEmpty(&IrpContext->IrpCompletedListHead))
+ while (!IsListEmpty(&IrpContext->IrpCompletedListHead))
{
//
// remove head irp
@@ -335,9 +334,6 @@
// release lock
//
KeReleaseSpinLock(&IrpContext->Lock, OldLevel);
-
-
-
//
// remove context
@@ -429,13 +425,15 @@
//
// 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);
//
// 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);
if (CollectionDescription && ReportDescription)
@@ -638,13 +636,15 @@
//
// 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);
//
// 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);
//
@@ -664,7 +664,6 @@
}
-
//
// store report length
//
@@ -712,7 +711,6 @@
return STATUS_SUCCESS;
}
-
NTSTATUS
NTAPI
HidClass_Read(
@@ -757,21 +755,25 @@
if (Context->StopInProgress)
{
- //
- // stop in progress
- //
- DPRINT1("[HIDCLASS] Stop In Progress\n");
- Irp->IoStatus.Status = STATUS_CANCELLED;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_CANCELLED;
-
- }
-
+ //
+ // stop in progress
+ //
+ DPRINT1("[HIDCLASS] Stop In Progress\n");
+ Irp->IoStatus.Status = STATUS_CANCELLED;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_CANCELLED;
+ }
//
// 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))
{
//
@@ -814,7 +816,7 @@
IoMarkIrpPending(Irp);
//
- // lets dispatch the request
+ // let's dispatch the request
//
ASSERT(Context->DeviceExtension);
Status =
Context->DeviceExtension->Common.DriverExtension->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL](Context->DeviceExtension->FDODeviceObject,
NewIrp);
@@ -881,7 +883,7 @@
//
IoStack = IoGetCurrentIrpStackLocation(Irp);
- switch(IoStack->Parameters.DeviceIoControl.IoControlCode)
+ switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_HID_GET_COLLECTION_INFORMATION:
{
@@ -907,7 +909,8 @@
//
// get collection description
//
- CollectionDescription =
HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
PDODeviceExtension->CollectionNumber);
+ CollectionDescription =
HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
+
PDODeviceExtension->CollectionNumber);
ASSERT(CollectionDescription);
//
@@ -932,7 +935,8 @@
//
// get collection description
//
- CollectionDescription =
HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
PDODeviceExtension->CollectionNumber);
+ CollectionDescription =
HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
+
PDODeviceExtension->CollectionNumber);
ASSERT(CollectionDescription);
//
@@ -985,7 +989,6 @@
return STATUS_NOT_IMPLEMENTED;
}
-
NTSTATUS
NTAPI
HidClass_Power(
@@ -1075,7 +1078,7 @@
//
// dispatch request based on major function
//
- switch(IoStack->MajorFunction)
+ switch (IoStack->MajorFunction)
{
case IRP_MJ_CREATE:
return HidClass_Create(DeviceObject, Irp);
@@ -1134,7 +1137,9 @@
DriverExtension->DriverUnload =
MinidriverRegistration->DriverObject->DriverUnload;
/* 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 */
KeInitializeSpinLock(&DriverExtension->Lock);
Modified: trunk/reactos/drivers/hid/hidclass/pdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidclass/pdo.c…
==============================================================================
--- trunk/reactos/drivers/hid/hidclass/pdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/hidclass/pdo.c [iso-8859-1] Sun May 12 15:23:34 2013
@@ -7,6 +7,7 @@
* Michael Martin (michael.martin(a)reactos.org)
* Johannes Anderwald (johannes.anderwald(a)reactos.org)
*/
+
#include "precomp.h"
PHIDP_COLLECTION_DESC
@@ -42,7 +43,7 @@
{
ULONG Index;
- for(Index = 0; Index < DeviceDescription->ReportIDsLength; Index++)
+ for (Index = 0; Index < DeviceDescription->ReportIDsLength; Index++)
{
if (DeviceDescription->ReportIDs[Index].CollectionNumber == CollectionNumber)
{
@@ -151,8 +152,8 @@
//
// get device extension
//
- PDODeviceExtension =
(PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
+ PDODeviceExtension =
(PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
//
// copy current stack location
@@ -196,7 +197,7 @@
if (CollectionDescription->UsagePage == HID_USAGE_PAGE_GENERIC)
{
- switch(CollectionDescription->Usage)
+ switch (CollectionDescription->Usage)
{
case HID_USAGE_GENERIC_POINTER:
case HID_USAGE_GENERIC_MOUSE:
@@ -253,7 +254,7 @@
//
// allocate buffer
//
- Ptr = (LPWSTR)ExAllocatePool(NonPagedPool, (Offset +1)* sizeof(WCHAR));
+ Ptr = (LPWSTR)ExAllocatePool(NonPagedPool, (Offset + 1) * sizeof(WCHAR));
if (!Ptr)
{
//
@@ -287,9 +288,8 @@
//
// get device extension
//
- PDODeviceExtension =
(PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
-
+ PDODeviceExtension =
(PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
//
// allocate buffer
@@ -370,47 +370,47 @@
//
// handle request
//
- switch(IoStack->MinorFunction)
+ switch (IoStack->MinorFunction)
{
case IRP_MN_QUERY_ID:
{
- if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
- {
- //
- // handle query device id
- //
- Status = HidClassPDO_HandleQueryDeviceId(DeviceObject, Irp);
- break;
- }
- else if (IoStack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
- {
- //
- // handle instance id
- //
- Status = HidClassPDO_HandleQueryHardwareId(DeviceObject, Irp);
- break;
- }
- else if (IoStack->Parameters.QueryId.IdType == BusQueryInstanceID)
- {
- //
- // handle instance id
- //
- Status = HidClassPDO_HandleQueryInstanceId(DeviceObject, Irp);
- break;
- }
- else if (IoStack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
- {
- //
- // handle instance id
- //
- Status = HidClassPDO_HandleQueryCompatibleId(DeviceObject, Irp);
- break;
- }
-
- DPRINT1("[HIDCLASS]: IRP_MN_QUERY_ID IdType %x unimplemented\n",
IoStack->Parameters.QueryId.IdType);
- Status = STATUS_NOT_SUPPORTED;
- Irp->IoStatus.Information = 0;
- break;
+ if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
+ {
+ //
+ // handle query device id
+ //
+ Status = HidClassPDO_HandleQueryDeviceId(DeviceObject, Irp);
+ break;
+ }
+ else if (IoStack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
+ {
+ //
+ // handle instance id
+ //
+ Status = HidClassPDO_HandleQueryHardwareId(DeviceObject, Irp);
+ break;
+ }
+ else if (IoStack->Parameters.QueryId.IdType == BusQueryInstanceID)
+ {
+ //
+ // handle instance id
+ //
+ Status = HidClassPDO_HandleQueryInstanceId(DeviceObject, Irp);
+ break;
+ }
+ else if (IoStack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
+ {
+ //
+ // handle instance id
+ //
+ Status = HidClassPDO_HandleQueryCompatibleId(DeviceObject, Irp);
+ break;
+ }
+
+ DPRINT1("[HIDCLASS]: IRP_MN_QUERY_ID IdType %x unimplemented\n",
IoStack->Parameters.QueryId.IdType);
+ Status = STATUS_NOT_SUPPORTED;
+ Irp->IoStatus.Information = 0;
+ break;
}
case IRP_MN_QUERY_CAPABILITIES:
{
@@ -426,7 +426,9 @@
//
// 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;
break;
}
@@ -436,7 +438,7 @@
//
//
BusInformation = (PPNP_BUS_INFORMATION)ExAllocatePool(NonPagedPool,
sizeof(PNP_BUS_INFORMATION));
-
+
//
// fill in result
//
@@ -510,7 +512,10 @@
//
// 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);
if (NT_SUCCESS(Status))
{
@@ -533,22 +538,22 @@
if (PDODeviceExtension->DeviceInterface.Length != 0)
IoSetDeviceInterfaceState(&PDODeviceExtension->DeviceInterface,
FALSE);
- //
- // remove us from the fdo's pdo list
- //
- bFound = FALSE;
- for(Index = 0; Index <
PDODeviceExtension->FDODeviceExtension->DeviceRelations->Count; Index++)
- {
- if
(PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] ==
DeviceObject)
- {
- //
- // remove us
- //
- bFound = TRUE;
-
PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] = NULL;
- break;
- }
- }
+ //
+ // remove us from the fdo's pdo list
+ //
+ bFound = FALSE;
+ for (Index = 0; Index <
PDODeviceExtension->FDODeviceExtension->DeviceRelations->Count; Index++)
+ {
+ if
(PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] ==
DeviceObject)
+ {
+ //
+ // remove us
+ //
+ bFound = TRUE;
+
PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] = NULL;
+ break;
+ }
+ }
/* Complete the IRP */
Irp->IoStatus.Status = STATUS_SUCCESS;
@@ -659,15 +664,21 @@
RtlZeroMemory(DeviceRelations, Length);
//
- // lets create a PDO for top level collection
+ // let's create a PDO for top level collection
//
Index = 0;
do
{
//
- // lets 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);
+ // 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);
if (!NT_SUCCESS(Status))
{
//
@@ -724,10 +735,10 @@
//
// move to next
- //
+ //
Index++;
- }while(Index <
FDODeviceExtension->Common.DeviceDescription.CollectionDescLength);
+ } while(Index <
FDODeviceExtension->Common.DeviceDescription.CollectionDescLength);
//
@@ -738,7 +749,7 @@
//
// failed
//
- for(Index = 0; Index < DeviceRelations->Count; Index++)
+ for (Index = 0; Index < DeviceRelations->Count; Index++)
{
//
// delete device
@@ -762,4 +773,4 @@
// done
//
return STATUS_SUCCESS;
-}
+}
Modified: trunk/reactos/drivers/hid/hidclass/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidclass/preco…
==============================================================================
--- trunk/reactos/drivers/hid/hidclass/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/hidclass/precomp.h [iso-8859-1] Sun May 12 15:23:34 2013
@@ -20,7 +20,7 @@
PDRIVER_UNLOAD DriverUnload;
KSPIN_LOCK Lock;
-}HIDCLASS_DRIVER_EXTENSION, *PHIDCLASS_DRIVER_EXTENSION;
+} HIDCLASS_DRIVER_EXTENSION, *PHIDCLASS_DRIVER_EXTENSION;
typedef struct
{
@@ -49,7 +49,7 @@
//
HID_DEVICE_ATTRIBUTES Attributes;
-}HIDCLASS_COMMON_DEVICE_EXTENSION, *PHIDCLASS_COMMON_DEVICE_EXTENSION;
+} HIDCLASS_COMMON_DEVICE_EXTENSION, *PHIDCLASS_COMMON_DEVICE_EXTENSION;
typedef struct
{
@@ -78,7 +78,7 @@
//
PDEVICE_RELATIONS DeviceRelations;
-}HIDCLASS_FDO_EXTENSION, *PHIDCLASS_FDO_EXTENSION;
+} HIDCLASS_FDO_EXTENSION, *PHIDCLASS_FDO_EXTENSION;
typedef struct
{
@@ -98,7 +98,7 @@
ULONG CollectionNumber;
//
- // device interface
+ // device interface
//
UNICODE_STRING DeviceInterface;
@@ -112,7 +112,7 @@
//
PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
-}HIDCLASS_PDO_DEVICE_EXTENSION, *PHIDCLASS_PDO_DEVICE_EXTENSION;
+} HIDCLASS_PDO_DEVICE_EXTENSION, *PHIDCLASS_PDO_DEVICE_EXTENSION;
typedef struct __HIDCLASS_FILEOP_CONTEXT__
{
@@ -146,7 +146,7 @@
//
KEVENT IrpReadComplete;
-}HIDCLASS_FILEOP_CONTEXT, *PHIDCLASS_FILEOP_CONTEXT;
+} HIDCLASS_FILEOP_CONTEXT, *PHIDCLASS_FILEOP_CONTEXT;
typedef struct
{
@@ -175,7 +175,7 @@
//
PIO_WORKITEM CompletionWorkItem;
-}HIDCLASS_IRP_CONTEXT, *PHIDCLASS_IRP_CONTEXT;
+} HIDCLASS_IRP_CONTEXT, *PHIDCLASS_IRP_CONTEXT;
/* fdo.c */
NTSTATUS