Author: tfaber Date: Sun May 12 16:59:26 2013 New Revision: 59006
URL: http://svn.reactos.org/svn/reactos?rev=59006&view=rev Log: [HIDUSB] - The usual... fix some whitespace
Modified: trunk/reactos/drivers/hid/hidusb/hidusb.c trunk/reactos/drivers/hid/hidusb/hidusb.h
Modified: trunk/reactos/drivers/hid/hidusb/hidusb.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidusb/hidusb.c... ============================================================================== --- trunk/reactos/drivers/hid/hidusb/hidusb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/hid/hidusb/hidusb.c [iso-8859-1] Sun May 12 16:59:26 2013 @@ -16,21 +16,21 @@ { ULONG Index;
- // - // sanity check - // - ASSERT(InterfaceInformation->NumberOfPipes); - - for(Index = 0; Index < InterfaceInformation->NumberOfPipes; Index++) - { - //DPRINT1("[HIDUSB] EndpointAddress %x PipeType %x PipeHandle %x\n", InterfaceInformation->Pipes[Index].EndpointAddress, InterfaceInformation->Pipes[Index].PipeType, InterfaceInformation->Pipes[Index].PipeHandle); - if (InterfaceInformation->Pipes[Index].PipeType == UsbdPipeTypeInterrupt && (InterfaceInformation->Pipes[Index].EndpointAddress & USB_ENDPOINT_DIRECTION_MASK)) - { - // - // found handle - // - return &InterfaceInformation->Pipes[Index]; - } + // + // sanity check + // + ASSERT(InterfaceInformation->NumberOfPipes); + + for (Index = 0; Index < InterfaceInformation->NumberOfPipes; Index++) + { + //DPRINT1("[HIDUSB] EndpointAddress %x PipeType %x PipeHandle %x\n", InterfaceInformation->Pipes[Index].EndpointAddress, InterfaceInformation->Pipes[Index].PipeType, InterfaceInformation->Pipes[Index].PipeHandle); + if (InterfaceInformation->Pipes[Index].PipeType == UsbdPipeTypeInterrupt && (InterfaceInformation->Pipes[Index].EndpointAddress & USB_ENDPOINT_DIRECTION_MASK)) + { + // + // found handle + // + return &InterfaceInformation->Pipes[Index]; + } }
// @@ -69,7 +69,15 @@ // // build irp // - Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_GET_PORT_STATUS, DeviceExtension->NextDeviceObject, NULL, 0, NULL, 0, TRUE, &Event, &IoStatus); + Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_GET_PORT_STATUS, + DeviceExtension->NextDeviceObject, + NULL, + 0, + NULL, + 0, + TRUE, + &Event, + &IoStatus); if (!Irp) { // @@ -88,23 +96,23 @@ // IoStack->Parameters.Others.Argument1 = (PVOID)PortStatus;
- // - // call driver - // - Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp); - if (Status == STATUS_PENDING) - { - // - // wait for completion - // - KeWaitForSingleObject(&Event, Executive, KernelMode, 0, NULL); - return IoStatus.Status; - } - - // - // done - // - return Status; + // + // call driver + // + Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp); + if (Status == STATUS_PENDING) + { + // + // wait for completion + // + KeWaitForSingleObject(&Event, Executive, KernelMode, 0, NULL); + return IoStatus.Status; + } + + // + // done + // + return Status; }
NTSTATUS @@ -249,7 +257,15 @@ // // build irp // - Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_RESET_PORT, DeviceExtension->NextDeviceObject, NULL, 0, NULL, 0, TRUE, &Event, &IoStatusBlock); + Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_RESET_PORT, + DeviceExtension->NextDeviceObject, + NULL, + 0, + NULL, + 0, + TRUE, + &Event, + &IoStatusBlock); if (!Irp) { // @@ -646,7 +662,14 @@ // FIXME: support old hid version // BufferLength = HidDeviceExtension->HidDescriptor->DescriptorList[0].wReportLength; - Status = Hid_GetDescriptor(DeviceObject, URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), &Report, &BufferLength, HidDeviceExtension->HidDescriptor->DescriptorList[0].bReportType, 0, HidDeviceExtension->InterfaceInfo->InterfaceNumber); + Status = Hid_GetDescriptor(DeviceObject, + URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE, + sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), + &Report, + &BufferLength, + HidDeviceExtension->HidDescriptor->DescriptorList[0].bReportType, + 0, + HidDeviceExtension->InterfaceInfo->InterfaceNumber); if (!NT_SUCCESS(Status)) { // @@ -654,7 +677,14 @@ // try with old hid version // BufferLength = HidDeviceExtension->HidDescriptor->DescriptorList[0].wReportLength; - Status = Hid_GetDescriptor(DeviceObject, URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), &Report, &BufferLength, HidDeviceExtension->HidDescriptor->DescriptorList[0].bReportType, 0, 0 /* FIXME*/); + Status = Hid_GetDescriptor(DeviceObject, + URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT, + sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), + &Report, + &BufferLength, + HidDeviceExtension->HidDescriptor->DescriptorList[0].bReportType, + 0, + 0 /* FIXME*/); if (!NT_SUCCESS(Status)) { DPRINT("[HIDUSB] failed to get report descriptor with %x\n", Status); @@ -715,7 +745,7 @@ // IoStack = IoGetCurrentIrpStackLocation(Irp);
- switch(IoStack->Parameters.DeviceIoControl.IoControlCode) + switch (IoStack->Parameters.DeviceIoControl.IoControlCode) { case IOCTL_HID_GET_DEVICE_ATTRIBUTES: { @@ -926,7 +956,6 @@ return STATUS_MORE_PROCESSING_REQUIRED; }
- NTSTATUS Hid_DispatchUrb( IN PDEVICE_OBJECT DeviceObject, @@ -951,11 +980,18 @@ DeviceExtension = (PHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension; HidDeviceExtension = (PHID_USB_DEVICE_EXTENSION)DeviceExtension->MiniDeviceExtension;
- // // build irp // - Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_SUBMIT_URB, DeviceExtension->NextDeviceObject, NULL, 0, NULL, 0, TRUE, &Event, &IoStatus); + Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_SUBMIT_URB, + DeviceExtension->NextDeviceObject, + NULL, + 0, + NULL, + 0, + TRUE, + &Event, + &IoStatus); if (!Irp) { // @@ -1021,7 +1057,7 @@ IN USHORT UrbLength, IN OUT PVOID *UrbBuffer, IN OUT PULONG UrbBufferLength, - IN UCHAR DescriptorType, + IN UCHAR DescriptorType, IN UCHAR Index, IN USHORT LanguageIndex) { @@ -1079,7 +1115,7 @@ // // set urb function // - Urb->UrbHeader.Function = UrbFunction; + Urb->UrbHeader.Function = UrbFunction;
// // dispatch urb @@ -1278,7 +1314,7 @@ // format urb // UsbBuildVendorRequest(Urb, - URB_FUNCTION_CLASS_INTERFACE, + URB_FUNCTION_CLASS_INTERFACE, sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST), 0, 0, @@ -1333,7 +1369,6 @@ return; }
- // // allocate urb // @@ -1355,7 +1390,7 @@ // format urb // UsbBuildVendorRequest(Urb, - URB_FUNCTION_CLASS_INTERFACE, + URB_FUNCTION_CLASS_INTERFACE, sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST), USBD_TRANSFER_DIRECTION_IN, 0, @@ -1414,7 +1449,14 @@ // get device descriptor // DescriptorLength = sizeof(USB_DEVICE_DESCRIPTOR); - Status = Hid_GetDescriptor(DeviceObject, URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), (PVOID*)&HidDeviceExtension->DeviceDescriptor, &DescriptorLength, USB_DEVICE_DESCRIPTOR_TYPE, 0, 0); + Status = Hid_GetDescriptor(DeviceObject, + URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE, + sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), + (PVOID *)&HidDeviceExtension->DeviceDescriptor, + &DescriptorLength, + USB_DEVICE_DESCRIPTOR_TYPE, + 0, + 0); if (!NT_SUCCESS(Status)) { // @@ -1428,7 +1470,14 @@ // now get the configuration descriptor // DescriptorLength = sizeof(USB_CONFIGURATION_DESCRIPTOR); - Status = Hid_GetDescriptor(DeviceObject, URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), (PVOID*)&HidDeviceExtension->ConfigurationDescriptor, &DescriptorLength, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 0); + Status = Hid_GetDescriptor(DeviceObject, + URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE, + sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), + (PVOID *)&HidDeviceExtension->ConfigurationDescriptor, + &DescriptorLength, + USB_CONFIGURATION_DESCRIPTOR_TYPE, + 0, + 0); if (!NT_SUCCESS(Status)) { // @@ -1459,7 +1508,14 @@ // // get full configuration descriptor // - Status = Hid_GetDescriptor(DeviceObject, URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), (PVOID*)&HidDeviceExtension->ConfigurationDescriptor, &DescriptorLength, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 0); + Status = Hid_GetDescriptor(DeviceObject, + URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE, + sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST), + (PVOID *)&HidDeviceExtension->ConfigurationDescriptor, + &DescriptorLength, + USB_CONFIGURATION_DESCRIPTOR_TYPE, + 0, + 0); if (!NT_SUCCESS(Status)) { // @@ -1577,7 +1633,7 @@ // // handle requests based on request type // - switch(IoStack->MinorFunction) + switch (IoStack->MinorFunction) { case IRP_MN_REMOVE_DEVICE: { @@ -1586,7 +1642,7 @@ // IoSkipCurrentIrpStackLocation(Irp); Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp); - + // // free resources //
Modified: trunk/reactos/drivers/hid/hidusb/hidusb.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidusb/hidusb.h... ============================================================================== --- trunk/reactos/drivers/hid/hidusb/hidusb.h [iso-8859-1] (original) +++ trunk/reactos/drivers/hid/hidusb/hidusb.h [iso-8859-1] Sun May 12 16:59:26 2013 @@ -46,7 +46,7 @@ // PHID_DESCRIPTOR HidDescriptor;
-}HID_USB_DEVICE_EXTENSION, *PHID_USB_DEVICE_EXTENSION; +} HID_USB_DEVICE_EXTENSION, *PHID_USB_DEVICE_EXTENSION;
typedef struct { @@ -65,7 +65,7 @@ // PDEVICE_OBJECT DeviceObject;
-}HID_USB_RESET_CONTEXT, *PHID_USB_RESET_CONTEXT; +} HID_USB_RESET_CONTEXT, *PHID_USB_RESET_CONTEXT;
NTSTATUS @@ -75,7 +75,7 @@ IN USHORT UrbLength, IN OUT PVOID *UrbBuffer, IN OUT PULONG UrbBufferLength, - IN UCHAR DescriptorType, + IN UCHAR DescriptorType, IN UCHAR Index, IN USHORT LanguageIndex);
@@ -86,4 +86,3 @@
#define USB_SET_IDLE_REQUEST 0xA #define USB_GET_PROTOCOL_REQUEST 0x3 -