[LIBUSB][USBCCGP]

- Whitespace and DPRINT fixes

svn path=/trunk/; revision=56668
This commit is contained in:
Thomas Faber 2012-05-28 10:49:44 +00:00
parent a426102b3a
commit 7803f2678f
5 changed files with 155 additions and 163 deletions

View file

@ -56,7 +56,7 @@ USBCCGP_QueryInterface(
// //
// initialize request // initialize request
// //
Stack=IoGetNextIrpStackLocation(Irp); Stack = IoGetNextIrpStackLocation(Irp);
Stack->MajorFunction = IRP_MJ_PNP; Stack->MajorFunction = IRP_MJ_PNP;
Stack->MinorFunction = IRP_MN_QUERY_INTERFACE; Stack->MinorFunction = IRP_MN_QUERY_INTERFACE;
Stack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD); Stack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
@ -69,7 +69,7 @@ USBCCGP_QueryInterface(
// //
// call driver // call driver
// //
Status= IoCallDriver(DeviceObject, Irp); Status = IoCallDriver(DeviceObject, Irp);
// //
// did operation complete // did operation complete
@ -123,7 +123,7 @@ USBCCGP_CustomEnumWithInterface(
DeviceObject, DeviceObject,
FDODeviceExtension->PhysicalDeviceObject); FDODeviceExtension->PhysicalDeviceObject);
DPRINT("USBCCGP_CustomEnumWithInterface Status %x\n", Status); DPRINT("USBCCGP_CustomEnumWithInterface Status %lx\n", Status);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
// //
@ -167,7 +167,7 @@ USBCCGP_CountAssociationDescriptors(
Offset = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength; Offset = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength;
End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength; End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
while(Offset < End) while (Offset < End)
{ {
// //
// get association descriptor // get association descriptor
@ -209,7 +209,7 @@ USBCCGP_GetAssociationDescriptorAtIndex(
Offset = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength; Offset = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength;
End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength; End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
while(Offset < End) while (Offset < End)
{ {
// //
// get association descriptor // get association descriptor
@ -260,7 +260,7 @@ USBCCGP_InitInterfaceListOfFunctionDescriptor(
Offset = (PUCHAR)AssociationDescriptor + AssociationDescriptor->bLength; Offset = (PUCHAR)AssociationDescriptor + AssociationDescriptor->bLength;
End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength; End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
while(Offset < End) while (Offset < End)
{ {
// //
// get association descriptor // get association descriptor
@ -406,7 +406,6 @@ USBCCGP_InitFunctionDescriptor(
FunctionDescriptor->HardwareId.Length = Index * sizeof(WCHAR); FunctionDescriptor->HardwareId.Length = Index * sizeof(WCHAR);
FunctionDescriptor->HardwareId.MaximumLength = (Index + 1) * sizeof(WCHAR); FunctionDescriptor->HardwareId.MaximumLength = (Index + 1) * sizeof(WCHAR);
// //
// now init the compatible id // now init the compatible id
// //
@ -475,7 +474,7 @@ USBCCGP_EnumWithAssociationDescriptor(
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
for(Index = 0; Index < DescriptorCount; Index++) for (Index = 0; Index < DescriptorCount; Index++)
{ {
// //
// init function descriptors // init function descriptors
@ -637,7 +636,7 @@ USBCCGP_LegacyEnum(
// //
// init function descriptors // init function descriptors
// //
for(Index = 0; Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces; Index++) for (Index = 0; Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces; Index++)
{ {
// get interface descriptor // get interface descriptor
InterfaceDescriptor = USBD_ParseConfigurationDescriptorEx(FDODeviceExtension->ConfigurationDescriptor, FDODeviceExtension->ConfigurationDescriptor, Index, 0, -1, -1, -1); InterfaceDescriptor = USBD_ParseConfigurationDescriptorEx(FDODeviceExtension->ConfigurationDescriptor, FDODeviceExtension->ConfigurationDescriptor, Index, 0, -1, -1, -1);
@ -679,7 +678,7 @@ USBCCGP_LegacyEnum(
// //
// failed to init ids // failed to init ids
// //
DPRINT1("[USBCCGP] Failed to init ids with %x\n", Status); DPRINT1("[USBCCGP] Failed to init ids with %lx\n", Status);
return Status; return Status;
} }
@ -722,7 +721,7 @@ USBCCGP_EnumWithAudioLegacy(
// //
// first check if all interfaces belong to the same audio class // first check if all interfaces belong to the same audio class
// //
for(Index = 0; Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces; Index++) for (Index = 0; Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces; Index++)
{ {
// //
// get interface descriptor // get interface descriptor
@ -789,7 +788,7 @@ USBCCGP_EnumWithAudioLegacy(
// //
// failed to allocate descriptor array // failed to allocate descriptor array
// //
DPRINT1("[USBCCGP] Failed to allocate descriptor array %x\n", Status); DPRINT1("[USBCCGP] Failed to allocate descriptor array %lx\n", Status);
return Status; return Status;
} }
@ -802,7 +801,7 @@ USBCCGP_EnumWithAudioLegacy(
// //
// failed to init ids // failed to init ids
// //
DPRINT1("[USBCCGP] Failed to init ids with %x\n", Status); DPRINT1("[USBCCGP] Failed to init ids with %lx\n", Status);
return Status; return Status;
} }

View file

@ -162,7 +162,7 @@ DumpFunctionDescriptor(
DPRINT1("FunctionCount %lu\n", FunctionDescriptorCount); DPRINT1("FunctionCount %lu\n", FunctionDescriptorCount);
for(Index = 0; Index < FunctionDescriptorCount; Index++) for (Index = 0; Index < FunctionDescriptorCount; Index++)
{ {
DPRINT1("Function %lu\n", Index); DPRINT1("Function %lu\n", Index);
DPRINT1("FunctionNumber %lu\n", FunctionDescriptor[Index].FunctionNumber); DPRINT1("FunctionNumber %lu\n", FunctionDescriptor[Index].FunctionNumber);

View file

@ -136,7 +136,7 @@ USBCCGP_PdoAppendInterfaceNumber(
// count length of string // count length of string
// //
String = DeviceId; String = DeviceId;
while(*String) while (*String)
{ {
StringLength = wcslen(String) + 1; StringLength = wcslen(String) + 1;
Length += StringLength; Length += StringLength;
@ -161,7 +161,7 @@ USBCCGP_PdoAppendInterfaceNumber(
// //
*OutString = String; *OutString = String;
while(*DeviceId) while (*DeviceId)
{ {
StringLength = swprintf(String, L"%s&MI_%02x", DeviceId, InterfaceNumber) + 1; StringLength = swprintf(String, L"%s&MI_%02x", DeviceId, InterfaceNumber) + 1;
Length = wcslen(DeviceId) + 1; Length = wcslen(DeviceId) + 1;
@ -225,7 +225,7 @@ USBCCGP_PdoHandleQueryId(
DPRINT("BusQueryDeviceID %S\n", Buffer); DPRINT("BusQueryDeviceID %S\n", Buffer);
ExFreePool((PVOID)Irp->IoStatus.Information); ExFreePool((PVOID)Irp->IoStatus.Information);
Irp->IoStatus .Information = (ULONG_PTR)Buffer; Irp->IoStatus.Information = (ULONG_PTR)Buffer;
} }
else else
{ {
@ -501,7 +501,7 @@ USBCCGP_BuildConfigurationDescriptor(
// //
TotalSize = sizeof(USB_CONFIGURATION_DESCRIPTOR); TotalSize = sizeof(USB_CONFIGURATION_DESCRIPTOR);
for(Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++) for (Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++)
{ {
// //
// get current interface descriptor // get current interface descriptor
@ -555,7 +555,7 @@ USBCCGP_BuildConfigurationDescriptor(
// move to next descriptor // move to next descriptor
// //
InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength); InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength);
}while(TRUE); } while(TRUE);
} }
// //
@ -577,7 +577,7 @@ USBCCGP_BuildConfigurationDescriptor(
RtlCopyMemory(Buffer, ConfigurationDescriptor, sizeof(USB_CONFIGURATION_DESCRIPTOR)); RtlCopyMemory(Buffer, ConfigurationDescriptor, sizeof(USB_CONFIGURATION_DESCRIPTOR));
BufferPtr = (PUCHAR)((ULONG_PTR)Buffer + ConfigurationDescriptor->bLength); BufferPtr = (PUCHAR)((ULONG_PTR)Buffer + ConfigurationDescriptor->bLength);
for(Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++) for (Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++)
{ {
// //
// get current interface descriptor // get current interface descriptor
@ -634,7 +634,7 @@ USBCCGP_BuildConfigurationDescriptor(
// move to next descriptor // move to next descriptor
// //
InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength); InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength);
}while(TRUE); } while(TRUE);
} }
// //
@ -736,7 +736,7 @@ USBCCGP_PDOSelectConfiguration(
// search for the interface in the local interface list // search for the interface in the local interface list
// //
FoundInterface = FALSE; FoundInterface = FALSE;
for(InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; InterfaceIndex++) for (InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; InterfaceIndex++)
{ {
if (PDODeviceExtension->FunctionDescriptor->InterfaceDescriptorList[InterfaceIndex]->bInterfaceNumber == InterfaceInformation->InterfaceNumber) if (PDODeviceExtension->FunctionDescriptor->InterfaceDescriptorList[InterfaceIndex]->bInterfaceNumber == InterfaceInformation->InterfaceNumber)
{ {
@ -760,7 +760,7 @@ USBCCGP_PDOSelectConfiguration(
// now query the total interface list // now query the total interface list
// //
Entry = NULL; Entry = NULL;
for(InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->InterfaceListCount; InterfaceIndex++) for (InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->InterfaceListCount; InterfaceIndex++)
{ {
if (PDODeviceExtension->InterfaceList[InterfaceIndex].Interface->InterfaceNumber == InterfaceInformation->InterfaceNumber) if (PDODeviceExtension->InterfaceList[InterfaceIndex].Interface->InterfaceNumber == InterfaceInformation->InterfaceNumber)
{ {
@ -786,7 +786,6 @@ USBCCGP_PDOSelectConfiguration(
NeedSelect = FALSE; NeedSelect = FALSE;
if (Entry->InterfaceDescriptor->bAlternateSetting == InterfaceInformation->AlternateSetting) if (Entry->InterfaceDescriptor->bAlternateSetting == InterfaceInformation->AlternateSetting)
{ {
for(InterfaceIndex = 0; InterfaceIndex < InterfaceInformation->NumberOfPipes; InterfaceIndex++) for(InterfaceIndex = 0; InterfaceIndex < InterfaceInformation->NumberOfPipes; InterfaceIndex++)
{ {
if (InterfaceInformation->Pipes[InterfaceIndex].MaximumTransferSize != Entry->Interface->Pipes[InterfaceIndex].MaximumTransferSize) if (InterfaceInformation->Pipes[InterfaceIndex].MaximumTransferSize != Entry->Interface->Pipes[InterfaceIndex].MaximumTransferSize)
@ -894,7 +893,7 @@ USBCCGP_PDOSelectConfiguration(
FreeItem(NewUrb); FreeItem(NewUrb);
} }
}while(Length); } while(Length);
// //
// store configuration handle // store configuration handle
@ -950,7 +949,7 @@ PDO_HandleInternalDeviceControl(
} }
else if (Urb->UrbHeader.Function == URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE) else if (Urb->UrbHeader.Function == URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE)
{ {
if(Urb->UrbControlDescriptorRequest.DescriptorType == USB_DEVICE_DESCRIPTOR_TYPE) if (Urb->UrbControlDescriptorRequest.DescriptorType == USB_DEVICE_DESCRIPTOR_TYPE)
{ {
// //
// is the buffer big enough // is the buffer big enough
@ -1047,8 +1046,6 @@ PDO_HandleInternalDeviceControl(
return Status; return Status;
} }
DPRINT1("IOCTL %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode); DPRINT1("IOCTL %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
DPRINT1("InputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.InputBufferLength); DPRINT1("InputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.InputBufferLength);
DPRINT1("OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength); DPRINT1("OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
@ -1085,5 +1082,4 @@ PDO_Dispatch(
IoCompleteRequest(Irp, IO_NO_INCREMENT); IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status; return Status;
} }
} }

View file

@ -965,7 +965,7 @@ CHubController::HandleClassOther(
Status = m_Hardware->ClearPortStatus(PortId, C_PORT_CONNECTION); Status = m_Hardware->ClearPortStatus(PortId, C_PORT_CONNECTION);
break; break;
case C_PORT_RESET: case C_PORT_RESET:
Status= m_Hardware->ClearPortStatus(PortId, C_PORT_RESET); Status = m_Hardware->ClearPortStatus(PortId, C_PORT_RESET);
break; break;
default: default:
DPRINT("[USBLIB] Unknown Value for Clear Feature %x \n", Urb->UrbControlVendorClassRequest.Value); DPRINT("[USBLIB] Unknown Value for Clear Feature %x \n", Urb->UrbControlVendorClassRequest.Value);
@ -1219,7 +1219,6 @@ CHubController::HandleGetStatusFromDevice(
CtrlSetup.wLength = (USHORT)Urb->UrbControlGetStatusRequest.TransferBufferLength; CtrlSetup.wLength = (USHORT)Urb->UrbControlGetStatusRequest.TransferBufferLength;
CtrlSetup.bmRequestType.B = 0x80; CtrlSetup.bmRequestType.B = 0x80;
if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_INTERFACE) if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_INTERFACE)
{ {
// //

View file

@ -380,7 +380,7 @@ CUSBDevice::SetDeviceAddress(
RtlZeroMemory(m_ConfigurationDescriptors, sizeof(USB_CONFIGURATION) * m_DeviceDescriptor.bNumConfigurations); RtlZeroMemory(m_ConfigurationDescriptors, sizeof(USB_CONFIGURATION) * m_DeviceDescriptor.bNumConfigurations);
// retrieve the configuration descriptors // retrieve the configuration descriptors
for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) for (Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++)
{ {
// retrieve configuration descriptors from device // retrieve configuration descriptors from device
Status = CreateConfigurationDescriptor(Index); Status = CreateConfigurationDescriptor(Index);
@ -1029,7 +1029,7 @@ CUSBDevice::SelectConfiguration(
if (ConfigurationDescriptor) if (ConfigurationDescriptor)
{ {
// find configuration index // find configuration index
for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) for (Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++)
{ {
if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->bConfigurationValue == ConfigurationDescriptor->bConfigurationValue) if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->bConfigurationValue == ConfigurationDescriptor->bConfigurationValue)
{ {
@ -1041,7 +1041,7 @@ CUSBDevice::SelectConfiguration(
if (!Found) if (!Found)
{ {
DPRINT1("[USBLIB] invalid configuration value %lu\n", ConfigurationDescriptor->bConfigurationValue); DPRINT1("[USBLIB] invalid configuration value %u\n", ConfigurationDescriptor->bConfigurationValue);
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
} }
@ -1063,13 +1063,13 @@ CUSBDevice::SelectConfiguration(
if (!ConfigurationDescriptor) if (!ConfigurationDescriptor)
{ {
// unconfigure request // unconfigure request
DPRINT1("CUSBDevice::SelectConfiguration Unconfigure Request Status %x\n", Status); DPRINT1("CUSBDevice::SelectConfiguration Unconfigure Request Status %lx\n", Status);
m_ConfigurationIndex = 0; m_ConfigurationIndex = 0;
return Status; return Status;
} }
// informal debug print // informal debug print
DPRINT1("CUSBDevice::SelectConfiguration New Configuration %x Old Configuration %x Result %x\n", ConfigurationIndex, m_ConfigurationIndex, Status); DPRINT1("CUSBDevice::SelectConfiguration New Configuration %x Old Configuration %x Result %lx\n", ConfigurationIndex, m_ConfigurationIndex, Status);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
// //
@ -1079,7 +1079,7 @@ CUSBDevice::SelectConfiguration(
} }
// destroy old interface info // destroy old interface info
while(!IsListEmpty(&m_ConfigurationDescriptors[m_ConfigurationIndex].InterfaceList)) while (!IsListEmpty(&m_ConfigurationDescriptors[m_ConfigurationIndex].InterfaceList))
{ {
// remove entry // remove entry
Entry = RemoveHeadList(&m_ConfigurationDescriptors[m_ConfigurationIndex].InterfaceList); Entry = RemoveHeadList(&m_ConfigurationDescriptors[m_ConfigurationIndex].InterfaceList);
@ -1180,7 +1180,7 @@ CUSBDevice::SelectInterface(
Status = CommitSetupPacket(&CtrlSetup, NULL, 0, NULL); Status = CommitSetupPacket(&CtrlSetup, NULL, 0, NULL);
// informal debug print // informal debug print
DPRINT1("CUSBDevice::SelectInterface AlternateSetting %x InterfaceNumber %x Status %x\n", InterfaceInfo->AlternateSetting, InterfaceInfo->InterfaceNumber, Status); DPRINT1("CUSBDevice::SelectInterface AlternateSetting %x InterfaceNumber %x Status %lx\n", InterfaceInfo->AlternateSetting, InterfaceInfo->InterfaceNumber, Status);
#if 0 #if 0
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -1191,11 +1191,10 @@ CUSBDevice::SelectInterface(
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
// find interface // find interface
Found = FALSE; Found = FALSE;
Entry = m_ConfigurationDescriptors[ConfigurationIndex].InterfaceList.Flink; Entry = m_ConfigurationDescriptors[ConfigurationIndex].InterfaceList.Flink;
while(Entry != &m_ConfigurationDescriptors[ConfigurationIndex].InterfaceList) while (Entry != &m_ConfigurationDescriptors[ConfigurationIndex].InterfaceList)
{ {
// grab interface descriptor // grab interface descriptor
UsbInterface = (PUSB_INTERFACE)CONTAINING_RECORD(Entry, USB_INTERFACE, ListEntry); UsbInterface = (PUSB_INTERFACE)CONTAINING_RECORD(Entry, USB_INTERFACE, ListEntry);
@ -1241,7 +1240,7 @@ CUSBDevice::SelectInterface(
InterfaceInfo->NumberOfPipes = UsbInterface->InterfaceDescriptor->bNumEndpoints; InterfaceInfo->NumberOfPipes = UsbInterface->InterfaceDescriptor->bNumEndpoints;
// copy pipe handles // copy pipe handles
for(PipeIndex = 0; PipeIndex < UsbInterface->InterfaceDescriptor->bNumEndpoints; PipeIndex++) for (PipeIndex = 0; PipeIndex < UsbInterface->InterfaceDescriptor->bNumEndpoints; PipeIndex++)
{ {
// copy pipe handle // copy pipe handle
DPRINT1("PipeIndex %lu\n", PipeIndex); DPRINT1("PipeIndex %lu\n", PipeIndex);
@ -1250,7 +1249,7 @@ CUSBDevice::SelectInterface(
DPRINT1("MaximumPacketSize %d\n", InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize); DPRINT1("MaximumPacketSize %d\n", InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize);
DPRINT1("MaximumTransferSize %d\n", InterfaceInfo->Pipes[PipeIndex].MaximumTransferSize); DPRINT1("MaximumTransferSize %d\n", InterfaceInfo->Pipes[PipeIndex].MaximumTransferSize);
DPRINT1("PipeFlags %d\n", InterfaceInfo->Pipes[PipeIndex].PipeFlags); DPRINT1("PipeFlags %d\n", InterfaceInfo->Pipes[PipeIndex].PipeFlags);
DPRINT1("PipeType %dd\n", InterfaceInfo->Pipes[PipeIndex].PipeType); DPRINT1("PipeType %d\n", InterfaceInfo->Pipes[PipeIndex].PipeType);
DPRINT1("UsbEndPoint %x\n", InterfaceInfo->Pipes[PipeIndex].EndpointAddress); DPRINT1("UsbEndPoint %x\n", InterfaceInfo->Pipes[PipeIndex].EndpointAddress);
// sanity checks // sanity checks
@ -1264,7 +1263,6 @@ CUSBDevice::SelectInterface(
UsbInterface->EndPoints[PipeIndex].DataToggle = FALSE; UsbInterface->EndPoints[PipeIndex].DataToggle = FALSE;
} }
// //
// done // done
// //