mirror of
https://github.com/reactos/reactos.git
synced 2025-04-29 01:48:42 +00:00
[LIBUSB][USBCCGP]
- Whitespace and DPRINT fixes svn path=/trunk/; revision=56668
This commit is contained in:
parent
a426102b3a
commit
7803f2678f
5 changed files with 155 additions and 163 deletions
|
@ -56,7 +56,7 @@ USBCCGP_QueryInterface(
|
|||
//
|
||||
// initialize request
|
||||
//
|
||||
Stack=IoGetNextIrpStackLocation(Irp);
|
||||
Stack = IoGetNextIrpStackLocation(Irp);
|
||||
Stack->MajorFunction = IRP_MJ_PNP;
|
||||
Stack->MinorFunction = IRP_MN_QUERY_INTERFACE;
|
||||
Stack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
|
||||
|
@ -69,7 +69,7 @@ USBCCGP_QueryInterface(
|
|||
//
|
||||
// call driver
|
||||
//
|
||||
Status= IoCallDriver(DeviceObject, Irp);
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
//
|
||||
// did operation complete
|
||||
|
@ -116,14 +116,14 @@ USBCCGP_CustomEnumWithInterface(
|
|||
//
|
||||
// invoke callback
|
||||
//
|
||||
Status = FDODeviceExtension->BusInterface.StartDeviceCallback(FDODeviceExtension->DeviceDescriptor,
|
||||
FDODeviceExtension->ConfigurationDescriptor,
|
||||
Status = FDODeviceExtension->BusInterface.StartDeviceCallback(FDODeviceExtension->DeviceDescriptor,
|
||||
FDODeviceExtension->ConfigurationDescriptor,
|
||||
&FunctionDescriptorBuffer,
|
||||
&FunctionDescriptorBufferLength,
|
||||
DeviceObject,
|
||||
FDODeviceExtension->PhysicalDeviceObject);
|
||||
|
||||
DPRINT("USBCCGP_CustomEnumWithInterface Status %x\n", Status);
|
||||
DPRINT("USBCCGP_CustomEnumWithInterface Status %lx\n", Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
//
|
||||
|
@ -167,7 +167,7 @@ USBCCGP_CountAssociationDescriptors(
|
|||
Offset = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength;
|
||||
End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
|
||||
|
||||
while(Offset < End)
|
||||
while (Offset < End)
|
||||
{
|
||||
//
|
||||
// get association descriptor
|
||||
|
@ -209,7 +209,7 @@ USBCCGP_GetAssociationDescriptorAtIndex(
|
|||
Offset = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength;
|
||||
End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
|
||||
|
||||
while(Offset < End)
|
||||
while (Offset < End)
|
||||
{
|
||||
//
|
||||
// get association descriptor
|
||||
|
@ -260,7 +260,7 @@ USBCCGP_InitInterfaceListOfFunctionDescriptor(
|
|||
Offset = (PUCHAR)AssociationDescriptor + AssociationDescriptor->bLength;
|
||||
End = (PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
|
||||
|
||||
while(Offset < End)
|
||||
while (Offset < End)
|
||||
{
|
||||
//
|
||||
// get association descriptor
|
||||
|
@ -358,8 +358,8 @@ USBCCGP_InitFunctionDescriptor(
|
|||
// get interface description
|
||||
//
|
||||
Status = USBCCGP_GetStringDescriptor(FDODeviceExtension->NextDeviceObject,
|
||||
100 * sizeof(WCHAR),
|
||||
Descriptor->iFunction,
|
||||
100 * sizeof(WCHAR),
|
||||
Descriptor->iFunction,
|
||||
0x0409, //FIXME
|
||||
(PVOID*)&DescriptionBuffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -406,7 +406,6 @@ USBCCGP_InitFunctionDescriptor(
|
|||
FunctionDescriptor->HardwareId.Length = Index * sizeof(WCHAR);
|
||||
FunctionDescriptor->HardwareId.MaximumLength = (Index + 1) * sizeof(WCHAR);
|
||||
|
||||
|
||||
//
|
||||
// now init the compatible id
|
||||
//
|
||||
|
@ -475,7 +474,7 @@ USBCCGP_EnumWithAssociationDescriptor(
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
for(Index = 0; Index < DescriptorCount; Index++)
|
||||
for (Index = 0; Index < DescriptorCount; Index++)
|
||||
{
|
||||
//
|
||||
// init function descriptors
|
||||
|
@ -552,8 +551,8 @@ USBCCG_InitIdsWithInterfaceDescriptor(
|
|||
FDODeviceExtension->DeviceDescriptor->bcdDevice,
|
||||
FunctionIndex) + 1;
|
||||
Index += swprintf(&Buffer[Index], L"USB\\VID_%04x&PID_%04x&MI_%02x", FDODeviceExtension->DeviceDescriptor->idVendor,
|
||||
FDODeviceExtension->DeviceDescriptor->idProduct,
|
||||
FunctionIndex) + 1;
|
||||
FDODeviceExtension->DeviceDescriptor->idProduct,
|
||||
FunctionIndex) + 1;
|
||||
|
||||
// allocate result buffer
|
||||
DescriptionBuffer = AllocateItem(NonPagedPool, (Index + 1) * sizeof(WCHAR));
|
||||
|
@ -637,7 +636,7 @@ USBCCGP_LegacyEnum(
|
|||
//
|
||||
// init function descriptors
|
||||
//
|
||||
for(Index = 0; Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces; Index++)
|
||||
for (Index = 0; Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces; Index++)
|
||||
{
|
||||
// get interface descriptor
|
||||
InterfaceDescriptor = USBD_ParseConfigurationDescriptorEx(FDODeviceExtension->ConfigurationDescriptor, FDODeviceExtension->ConfigurationDescriptor, Index, 0, -1, -1, -1);
|
||||
|
@ -679,7 +678,7 @@ USBCCGP_LegacyEnum(
|
|||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -722,7 +721,7 @@ USBCCGP_EnumWithAudioLegacy(
|
|||
//
|
||||
// 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
|
||||
|
@ -789,7 +788,7 @@ USBCCGP_EnumWithAudioLegacy(
|
|||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -802,7 +801,7 @@ USBCCGP_EnumWithAudioLegacy(
|
|||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ NTSTATUS
|
|||
NTAPI
|
||||
USBSTOR_SyncForwardIrpCompletionRoutine(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
if (Irp->PendingReturned)
|
||||
|
@ -162,7 +162,7 @@ DumpFunctionDescriptor(
|
|||
|
||||
|
||||
DPRINT1("FunctionCount %lu\n", FunctionDescriptorCount);
|
||||
for(Index = 0; Index < FunctionDescriptorCount; Index++)
|
||||
for (Index = 0; Index < FunctionDescriptorCount; Index++)
|
||||
{
|
||||
DPRINT1("Function %lu\n", Index);
|
||||
DPRINT1("FunctionNumber %lu\n", FunctionDescriptor[Index].FunctionNumber);
|
||||
|
|
|
@ -136,7 +136,7 @@ USBCCGP_PdoAppendInterfaceNumber(
|
|||
// count length of string
|
||||
//
|
||||
String = DeviceId;
|
||||
while(*String)
|
||||
while (*String)
|
||||
{
|
||||
StringLength = wcslen(String) + 1;
|
||||
Length += StringLength;
|
||||
|
@ -161,7 +161,7 @@ USBCCGP_PdoAppendInterfaceNumber(
|
|||
//
|
||||
*OutString = String;
|
||||
|
||||
while(*DeviceId)
|
||||
while (*DeviceId)
|
||||
{
|
||||
StringLength = swprintf(String, L"%s&MI_%02x", DeviceId, InterfaceNumber) + 1;
|
||||
Length = wcslen(DeviceId) + 1;
|
||||
|
@ -225,7 +225,7 @@ USBCCGP_PdoHandleQueryId(
|
|||
DPRINT("BusQueryDeviceID %S\n", Buffer);
|
||||
|
||||
ExFreePool((PVOID)Irp->IoStatus.Information);
|
||||
Irp->IoStatus .Information = (ULONG_PTR)Buffer;
|
||||
Irp->IoStatus.Information = (ULONG_PTR)Buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -334,76 +334,76 @@ PDO_HandlePnp(
|
|||
|
||||
switch(IoStack->MinorFunction)
|
||||
{
|
||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||
{
|
||||
//
|
||||
// handle device relations
|
||||
//
|
||||
Status = USBCCGP_PdoHandleDeviceRelations(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_DEVICE_TEXT:
|
||||
{
|
||||
//
|
||||
// handle query device text
|
||||
//
|
||||
Status = USBCCGP_PdoHandleQueryDeviceText(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_ID:
|
||||
{
|
||||
//
|
||||
// handle request
|
||||
//
|
||||
Status = USBCCGP_PdoHandleQueryId(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_REMOVE_DEVICE:
|
||||
{
|
||||
//
|
||||
// remove us from the fdo's pdo list
|
||||
//
|
||||
bFound = FALSE;
|
||||
for(Index = 0; Index < PDODeviceExtension->FDODeviceExtension->FunctionDescriptorCount; Index++)
|
||||
{
|
||||
if (PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] == DeviceObject)
|
||||
{
|
||||
//
|
||||
// remove us
|
||||
//
|
||||
PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] = NULL;
|
||||
bFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||
{
|
||||
//
|
||||
// handle device relations
|
||||
//
|
||||
Status = USBCCGP_PdoHandleDeviceRelations(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_DEVICE_TEXT:
|
||||
{
|
||||
//
|
||||
// handle query device text
|
||||
//
|
||||
Status = USBCCGP_PdoHandleQueryDeviceText(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_ID:
|
||||
{
|
||||
//
|
||||
// handle request
|
||||
//
|
||||
Status = USBCCGP_PdoHandleQueryId(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_REMOVE_DEVICE:
|
||||
{
|
||||
//
|
||||
// remove us from the fdo's pdo list
|
||||
//
|
||||
bFound = FALSE;
|
||||
for(Index = 0; Index < PDODeviceExtension->FDODeviceExtension->FunctionDescriptorCount; Index++)
|
||||
{
|
||||
if (PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] == DeviceObject)
|
||||
{
|
||||
//
|
||||
// remove us
|
||||
//
|
||||
PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] = NULL;
|
||||
bFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Complete the IRP
|
||||
//
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
//
|
||||
// Complete the IRP
|
||||
//
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
if (bFound)
|
||||
{
|
||||
//
|
||||
// Delete the device object
|
||||
//
|
||||
IoDeleteDevice(DeviceObject);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
case IRP_MN_QUERY_CAPABILITIES:
|
||||
{
|
||||
//
|
||||
// copy device capabilities
|
||||
//
|
||||
RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities, &PDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
|
||||
if (bFound)
|
||||
{
|
||||
//
|
||||
// Delete the device object
|
||||
//
|
||||
IoDeleteDevice(DeviceObject);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
case IRP_MN_QUERY_CAPABILITIES:
|
||||
{
|
||||
//
|
||||
// copy device capabilities
|
||||
//
|
||||
RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities, &PDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
|
||||
|
||||
/* Complete the IRP */
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
/* Complete the IRP */
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
case IRP_MN_QUERY_REMOVE_DEVICE:
|
||||
case IRP_MN_QUERY_STOP_DEVICE:
|
||||
{
|
||||
|
@ -413,24 +413,24 @@ PDO_HandlePnp(
|
|||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IRP_MN_START_DEVICE:
|
||||
{
|
||||
//
|
||||
// no-op for PDO
|
||||
//
|
||||
DPRINT("[USBCCGP] PDO IRP_MN_START\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_INTERFACE:
|
||||
{
|
||||
//
|
||||
// forward to lower device object
|
||||
//
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(PDODeviceExtension->NextDeviceObject, Irp);
|
||||
}
|
||||
default:
|
||||
case IRP_MN_START_DEVICE:
|
||||
{
|
||||
//
|
||||
// no-op for PDO
|
||||
//
|
||||
DPRINT("[USBCCGP] PDO IRP_MN_START\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_INTERFACE:
|
||||
{
|
||||
//
|
||||
// forward to lower device object
|
||||
//
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(PDODeviceExtension->NextDeviceObject, Irp);
|
||||
}
|
||||
default:
|
||||
{
|
||||
//
|
||||
// do nothing
|
||||
|
@ -465,7 +465,7 @@ PDO_HandlePnp(
|
|||
|
||||
NTSTATUS
|
||||
USBCCGP_BuildConfigurationDescriptor(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
|
@ -501,7 +501,7 @@ USBCCGP_BuildConfigurationDescriptor(
|
|||
//
|
||||
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
|
||||
|
@ -555,7 +555,7 @@ USBCCGP_BuildConfigurationDescriptor(
|
|||
// move to next descriptor
|
||||
//
|
||||
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));
|
||||
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
|
||||
|
@ -634,7 +634,7 @@ USBCCGP_BuildConfigurationDescriptor(
|
|||
// move to next descriptor
|
||||
//
|
||||
InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength);
|
||||
}while(TRUE);
|
||||
} while(TRUE);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -674,7 +674,7 @@ USBCCGP_BuildConfigurationDescriptor(
|
|||
|
||||
NTSTATUS
|
||||
USBCCGP_PDOSelectConfiguration(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
|
@ -736,7 +736,7 @@ USBCCGP_PDOSelectConfiguration(
|
|||
// search for the interface in the local interface list
|
||||
//
|
||||
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)
|
||||
{
|
||||
|
@ -760,7 +760,7 @@ USBCCGP_PDOSelectConfiguration(
|
|||
// now query the total interface list
|
||||
//
|
||||
Entry = NULL;
|
||||
for(InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->InterfaceListCount; InterfaceIndex++)
|
||||
for (InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->InterfaceListCount; InterfaceIndex++)
|
||||
{
|
||||
if (PDODeviceExtension->InterfaceList[InterfaceIndex].Interface->InterfaceNumber == InterfaceInformation->InterfaceNumber)
|
||||
{
|
||||
|
@ -786,7 +786,6 @@ USBCCGP_PDOSelectConfiguration(
|
|||
NeedSelect = FALSE;
|
||||
if (Entry->InterfaceDescriptor->bAlternateSetting == InterfaceInformation->AlternateSetting)
|
||||
{
|
||||
|
||||
for(InterfaceIndex = 0; InterfaceIndex < InterfaceInformation->NumberOfPipes; InterfaceIndex++)
|
||||
{
|
||||
if (InterfaceInformation->Pipes[InterfaceIndex].MaximumTransferSize != Entry->Interface->Pipes[InterfaceIndex].MaximumTransferSize)
|
||||
|
@ -894,7 +893,7 @@ USBCCGP_PDOSelectConfiguration(
|
|||
FreeItem(NewUrb);
|
||||
}
|
||||
|
||||
}while(Length);
|
||||
} while(Length);
|
||||
|
||||
//
|
||||
// store configuration handle
|
||||
|
@ -911,7 +910,7 @@ USBCCGP_PDOSelectConfiguration(
|
|||
|
||||
NTSTATUS
|
||||
PDO_HandleInternalDeviceControl(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
|
@ -950,7 +949,7 @@ PDO_HandleInternalDeviceControl(
|
|||
}
|
||||
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
|
||||
|
@ -1047,8 +1046,6 @@ PDO_HandleInternalDeviceControl(
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DPRINT1("IOCTL %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
|
||||
DPRINT1("InputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.InputBufferLength);
|
||||
DPRINT1("OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
|
||||
|
@ -1064,7 +1061,7 @@ PDO_HandleInternalDeviceControl(
|
|||
|
||||
NTSTATUS
|
||||
PDO_Dispatch(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
|
@ -1085,5 +1082,4 @@ PDO_Dispatch(
|
|||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -965,7 +965,7 @@ CHubController::HandleClassOther(
|
|||
Status = m_Hardware->ClearPortStatus(PortId, C_PORT_CONNECTION);
|
||||
break;
|
||||
case C_PORT_RESET:
|
||||
Status= m_Hardware->ClearPortStatus(PortId, C_PORT_RESET);
|
||||
Status = m_Hardware->ClearPortStatus(PortId, C_PORT_RESET);
|
||||
break;
|
||||
default:
|
||||
DPRINT("[USBLIB] Unknown Value for Clear Feature %x \n", Urb->UrbControlVendorClassRequest.Value);
|
||||
|
@ -1209,31 +1209,30 @@ CHubController::HandleGetStatusFromDevice(
|
|||
UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle);
|
||||
|
||||
|
||||
//
|
||||
// generate setup packet
|
||||
//
|
||||
CtrlSetup.bRequest = USB_REQUEST_GET_STATUS;
|
||||
CtrlSetup.wValue.LowByte = 0;
|
||||
CtrlSetup.wValue.HiByte = 0;
|
||||
CtrlSetup.wIndex.W = Urb->UrbControlGetStatusRequest.Index;
|
||||
CtrlSetup.wLength = (USHORT)Urb->UrbControlGetStatusRequest.TransferBufferLength;
|
||||
CtrlSetup.bmRequestType.B = 0x80;
|
||||
//
|
||||
// generate setup packet
|
||||
//
|
||||
CtrlSetup.bRequest = USB_REQUEST_GET_STATUS;
|
||||
CtrlSetup.wValue.LowByte = 0;
|
||||
CtrlSetup.wValue.HiByte = 0;
|
||||
CtrlSetup.wIndex.W = Urb->UrbControlGetStatusRequest.Index;
|
||||
CtrlSetup.wLength = (USHORT)Urb->UrbControlGetStatusRequest.TransferBufferLength;
|
||||
CtrlSetup.bmRequestType.B = 0x80;
|
||||
|
||||
|
||||
if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_INTERFACE)
|
||||
{
|
||||
//
|
||||
// add interface type
|
||||
//
|
||||
CtrlSetup.bmRequestType.B |= 0x01;
|
||||
}
|
||||
else if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_ENDPOINT)
|
||||
{
|
||||
//
|
||||
// add interface type
|
||||
//
|
||||
CtrlSetup.bmRequestType.B |= 0x02;
|
||||
}
|
||||
if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_INTERFACE)
|
||||
{
|
||||
//
|
||||
// add interface type
|
||||
//
|
||||
CtrlSetup.bmRequestType.B |= 0x01;
|
||||
}
|
||||
else if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_ENDPOINT)
|
||||
{
|
||||
//
|
||||
// add interface type
|
||||
//
|
||||
CtrlSetup.bmRequestType.B |= 0x02;
|
||||
}
|
||||
|
||||
//
|
||||
// submit setup packet
|
||||
|
|
|
@ -380,7 +380,7 @@ CUSBDevice::SetDeviceAddress(
|
|||
RtlZeroMemory(m_ConfigurationDescriptors, sizeof(USB_CONFIGURATION) * m_DeviceDescriptor.bNumConfigurations);
|
||||
|
||||
// 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
|
||||
Status = CreateConfigurationDescriptor(Index);
|
||||
|
@ -1029,7 +1029,7 @@ CUSBDevice::SelectConfiguration(
|
|||
if (ConfigurationDescriptor)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
|
@ -1041,7 +1041,7 @@ CUSBDevice::SelectConfiguration(
|
|||
|
||||
if (!Found)
|
||||
{
|
||||
DPRINT1("[USBLIB] invalid configuration value %lu\n", ConfigurationDescriptor->bConfigurationValue);
|
||||
DPRINT1("[USBLIB] invalid configuration value %u\n", ConfigurationDescriptor->bConfigurationValue);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -1063,13 +1063,13 @@ CUSBDevice::SelectConfiguration(
|
|||
if (!ConfigurationDescriptor)
|
||||
{
|
||||
// unconfigure request
|
||||
DPRINT1("CUSBDevice::SelectConfiguration Unconfigure Request Status %x\n", Status);
|
||||
DPRINT1("CUSBDevice::SelectConfiguration Unconfigure Request Status %lx\n", Status);
|
||||
m_ConfigurationIndex = 0;
|
||||
return Status;
|
||||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
//
|
||||
|
@ -1079,7 +1079,7 @@ CUSBDevice::SelectConfiguration(
|
|||
}
|
||||
|
||||
// destroy old interface info
|
||||
while(!IsListEmpty(&m_ConfigurationDescriptors[m_ConfigurationIndex].InterfaceList))
|
||||
while (!IsListEmpty(&m_ConfigurationDescriptors[m_ConfigurationIndex].InterfaceList))
|
||||
{
|
||||
// remove entry
|
||||
Entry = RemoveHeadList(&m_ConfigurationDescriptors[m_ConfigurationIndex].InterfaceList);
|
||||
|
@ -1180,9 +1180,9 @@ CUSBDevice::SelectInterface(
|
|||
Status = CommitSetupPacket(&CtrlSetup, NULL, 0, NULL);
|
||||
|
||||
// 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 (!NT_SUCCESS(Status))
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
// failed to select interface
|
||||
return Status;
|
||||
|
@ -1191,11 +1191,10 @@ CUSBDevice::SelectInterface(
|
|||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
// find interface
|
||||
Found = FALSE;
|
||||
Entry = m_ConfigurationDescriptors[ConfigurationIndex].InterfaceList.Flink;
|
||||
while(Entry != &m_ConfigurationDescriptors[ConfigurationIndex].InterfaceList)
|
||||
while (Entry != &m_ConfigurationDescriptors[ConfigurationIndex].InterfaceList)
|
||||
{
|
||||
// grab interface descriptor
|
||||
UsbInterface = (PUSB_INTERFACE)CONTAINING_RECORD(Entry, USB_INTERFACE, ListEntry);
|
||||
|
@ -1241,7 +1240,7 @@ CUSBDevice::SelectInterface(
|
|||
InterfaceInfo->NumberOfPipes = UsbInterface->InterfaceDescriptor->bNumEndpoints;
|
||||
|
||||
// copy pipe handles
|
||||
for(PipeIndex = 0; PipeIndex < UsbInterface->InterfaceDescriptor->bNumEndpoints; PipeIndex++)
|
||||
for (PipeIndex = 0; PipeIndex < UsbInterface->InterfaceDescriptor->bNumEndpoints; PipeIndex++)
|
||||
{
|
||||
// copy pipe handle
|
||||
DPRINT1("PipeIndex %lu\n", PipeIndex);
|
||||
|
@ -1250,7 +1249,7 @@ CUSBDevice::SelectInterface(
|
|||
DPRINT1("MaximumPacketSize %d\n", InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize);
|
||||
DPRINT1("MaximumTransferSize %d\n", InterfaceInfo->Pipes[PipeIndex].MaximumTransferSize);
|
||||
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);
|
||||
|
||||
// sanity checks
|
||||
|
@ -1264,7 +1263,6 @@ CUSBDevice::SelectInterface(
|
|||
UsbInterface->EndPoints[PipeIndex].DataToggle = FALSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// done
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue