Author: janderwald
Date: Wed Feb 1 01:44:21 2012
New Revision: 55359
URL:
http://svn.reactos.org/svn/reactos?rev=55359&view=rev
Log:
[USBCCGP]
- Fix multiple bugs while selecting configuration
- Silence traces
Modified:
branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c
branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c
branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c [iso-8859-1] Wed Feb 1
01:44:21 2012
@@ -356,7 +356,7 @@
//
// 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)
{
//
@@ -369,11 +369,6 @@
// now prepare interface urb
//
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
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c [iso-8859-1] Wed Feb 1 01:44:21
2012
@@ -611,11 +611,12 @@
{
PIO_STACK_LOCATION IoStack;
PPDO_DEVICE_EXTENSION PDODeviceExtension;
- PURB Urb;
+ PURB Urb, NewUrb;
PUSBD_INTERFACE_INFORMATION InterfaceInformation;
ULONG InterfaceInformationCount, Index, InterfaceIndex;
PUSBD_INTERFACE_LIST_ENTRY Entry;
ULONG NeedSelect, FoundInterface;
+ NTSTATUS Status;
//
// get current stack location
@@ -720,7 +721,8 @@
NeedSelect = FALSE;
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)
{
@@ -744,16 +746,61 @@
//
// interface is already selected
//
+ RtlCopyMemory(InterfaceInformation, Entry->Interface,
min(InterfaceInformation->Length, Entry->Interface->Length));
+ }
+ else
+ {
+ //
+ // select interface
+ //
+ DPRINT1("Selecting InterfaceIndex %lu AlternateSetting %lu NumberOfPipes
%lu\n", InterfaceInformation->InterfaceNumber,
InterfaceInformation->AlternateSetting, InterfaceInformation->NumberOfPipes);
ASSERT(InterfaceInformation->Length == Entry->Interface->Length);
- RtlCopyMemory(InterfaceInformation, Entry->Interface,
Entry->Interface->Length);
- }
- else
- {
- //
- // FIXME select interface
- //
- UNIMPLEMENTED
- ASSERT(FALSE);
+
+ //
+ // 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);
}
//
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] Wed Feb 1
01:44:21 2012
@@ -2,7 +2,7 @@
#define USBEHCI_H__
#include <ntddk.h>
-#define YDEBUG
+#define NDEBUG
#include <debug.h>
#include <initguid.h>
#include <hubbusif.h>