[USBCCGP]

- Fix multiple bugs while selecting configuration
- Silence traces

svn path=/branches/usb-bringup-trunk/; revision=55359
This commit is contained in:
Johannes Anderwald 2012-02-01 01:44:21 +00:00
parent d0cec1a401
commit 78f3a69807
3 changed files with 56 additions and 14 deletions

View file

@ -356,7 +356,7 @@ USBCCGP_SelectInterface(
// //
// allocate urb // allocate urb
// //
Urb = AllocateItem(NonPagedPool, sizeof(struct _URB_SELECT_INTERFACE)); Urb = AllocateItem(NonPagedPool, GET_SELECT_INTERFACE_REQUEST_SIZE(DeviceExtension->InterfaceList[InterfaceIndex].InterfaceDescriptor->bNumEndpoints));
if (!Urb) if (!Urb)
{ {
// //
@ -370,11 +370,6 @@ USBCCGP_SelectInterface(
// //
UsbBuildSelectInterfaceRequest(Urb, GET_SELECT_INTERFACE_REQUEST_SIZE(DeviceExtension->InterfaceList[InterfaceIndex].InterfaceDescriptor->bNumEndpoints), DeviceExtension->ConfigurationHandle, DeviceExtension->InterfaceList[InterfaceIndex].InterfaceDescriptor->bInterfaceNumber, DeviceExtension->InterfaceList[InterfaceIndex].InterfaceDescriptor->bAlternateSetting); UsbBuildSelectInterfaceRequest(Urb, GET_SELECT_INTERFACE_REQUEST_SIZE(DeviceExtension->InterfaceList[InterfaceIndex].InterfaceDescriptor->bNumEndpoints), DeviceExtension->ConfigurationHandle, DeviceExtension->InterfaceList[InterfaceIndex].InterfaceDescriptor->bInterfaceNumber, DeviceExtension->InterfaceList[InterfaceIndex].InterfaceDescriptor->bAlternateSetting);
//
// copy interface information structure back - as offset for SelectConfiguration / SelectInterface request do differ
//
RtlCopyMemory(&Urb->UrbSelectInterface.Interface, DeviceExtension->InterfaceList[InterfaceIndex].Interface, DeviceExtension->InterfaceList[InterfaceIndex].Interface->Length);
// //
// now select the interface // now select the interface
// //

View file

@ -611,11 +611,12 @@ USBCCGP_PDOSelectConfiguration(
{ {
PIO_STACK_LOCATION IoStack; PIO_STACK_LOCATION IoStack;
PPDO_DEVICE_EXTENSION PDODeviceExtension; PPDO_DEVICE_EXTENSION PDODeviceExtension;
PURB Urb; PURB Urb, NewUrb;
PUSBD_INTERFACE_INFORMATION InterfaceInformation; PUSBD_INTERFACE_INFORMATION InterfaceInformation;
ULONG InterfaceInformationCount, Index, InterfaceIndex; ULONG InterfaceInformationCount, Index, InterfaceIndex;
PUSBD_INTERFACE_LIST_ENTRY Entry; PUSBD_INTERFACE_LIST_ENTRY Entry;
ULONG NeedSelect, FoundInterface; ULONG NeedSelect, FoundInterface;
NTSTATUS Status;
// //
// get current stack location // get current stack location
@ -720,7 +721,8 @@ USBCCGP_PDOSelectConfiguration(
NeedSelect = FALSE; NeedSelect = FALSE;
if (Entry->InterfaceDescriptor->bAlternateSetting == InterfaceInformation->AlternateSetting) if (Entry->InterfaceDescriptor->bAlternateSetting == InterfaceInformation->AlternateSetting)
{ {
for(InterfaceIndex = 0; InterfaceIndex < Entry->InterfaceDescriptor->bNumEndpoints; 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)
{ {
@ -744,16 +746,61 @@ USBCCGP_PDOSelectConfiguration(
// //
// interface is already selected // interface is already selected
// //
ASSERT(InterfaceInformation->Length == Entry->Interface->Length); RtlCopyMemory(InterfaceInformation, Entry->Interface, min(InterfaceInformation->Length, Entry->Interface->Length));
RtlCopyMemory(InterfaceInformation, Entry->Interface, Entry->Interface->Length);
} }
else else
{ {
// //
// FIXME select interface // select interface
// //
UNIMPLEMENTED DPRINT1("Selecting InterfaceIndex %lu AlternateSetting %lu NumberOfPipes %lu\n", InterfaceInformation->InterfaceNumber, InterfaceInformation->AlternateSetting, InterfaceInformation->NumberOfPipes);
ASSERT(FALSE); ASSERT(InterfaceInformation->Length == Entry->Interface->Length);
//
// build urb
//
NewUrb = AllocateItem(NonPagedPool, GET_SELECT_INTERFACE_REQUEST_SIZE(InterfaceInformation->NumberOfPipes));
if (!NewUrb)
{
//
// no memory
//
return STATUS_INSUFFICIENT_RESOURCES;
}
//
// now prepare interface urb
//
UsbBuildSelectInterfaceRequest(NewUrb, GET_SELECT_INTERFACE_REQUEST_SIZE(InterfaceInformation->NumberOfPipes), PDODeviceExtension->ConfigurationHandle, InterfaceInformation->InterfaceNumber, InterfaceInformation->AlternateSetting);
//
// now select the interface
//
Status = USBCCGP_SyncUrbRequest(PDODeviceExtension->NextDeviceObject, NewUrb);
DPRINT1("SelectInterface Status %x\n", Status);
//
// did it succeeed
//
if (NT_SUCCESS(Status))
{
//
// update configuration info
//
ASSERT(Entry->Interface->Length == NewUrb->UrbSelectInterface.Interface.Length);
ASSERT(InterfaceInformation->Length == NewUrb->UrbSelectInterface.Interface.Length);
RtlCopyMemory(Entry->Interface, &NewUrb->UrbSelectInterface.Interface, NewUrb->UrbSelectInterface.Interface.Length);
//
// update provided interface information
//
RtlCopyMemory(InterfaceInformation, Entry->Interface, Entry->Interface->Length);
}
//
// free urb
//
FreeItem(NewUrb);
} }
// //

View file

@ -2,7 +2,7 @@
#define USBEHCI_H__ #define USBEHCI_H__
#include <ntddk.h> #include <ntddk.h>
#define YDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#include <initguid.h> #include <initguid.h>
#include <hubbusif.h> #include <hubbusif.h>