Author: janderwald
Date: Sat Dec 8 19:52:10 2012
New Revision: 57826
URL:
http://svn.reactos.org/svn/reactos?rev=57826&view=rev
Log:
[USBCCGP]
- Add debugging function to analyze configuration descriptor
- Remove assert
CORE-6574
Modified:
trunk/reactos/drivers/usb/usbccgp/descriptor.c
Modified: trunk/reactos/drivers/usb/usbccgp/descriptor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/descri…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/descriptor.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/descriptor.c [iso-8859-1] Sat Dec 8 19:52:10 2012
@@ -268,6 +268,41 @@
return STATUS_SUCCESS;
}
+VOID
+DumpFullConfigurationDescriptor(
+ IN PFDO_DEVICE_EXTENSION FDODeviceExtension,
+ IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor)
+{
+ PUSB_COMMON_DESCRIPTOR Descriptor;
+
+ Descriptor = (PUSB_COMMON_DESCRIPTOR)ConfigurationDescriptor;
+
+ DbgPrint("Bogus ConfigurationDescriptor Found\n");
+ DbgPrint("InterfaceCount %x\n",
ConfigurationDescriptor->bNumInterfaces);
+
+ do
+ {
+ if (((ULONG_PTR)Descriptor + Descriptor->bLength) <=
((ULONG_PTR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength))
+ break;
+
+ DbgPrint("Descriptor Type %x Length %lu Offset %lu\n",
Descriptor->bDescriptorType, Descriptor->bLength, ((ULONG_PTR)Descriptor -
(ULONG_PTR)ConfigurationDescriptor));
+
+ // check for invalid descriptors
+ if (!Descriptor->bLength)
+ {
+ DbgPrint("Bogus Descriptor!!!\n");
+ break;
+ }
+
+ // advance to next descriptor
+ Descriptor = (PUSB_COMMON_DESCRIPTOR)((ULONG_PTR)Descriptor +
Descriptor->bLength);
+
+ }while(TRUE);
+
+
+}
+
+
NTSTATUS
NTAPI
USBCCGP_ScanConfigurationDescriptor(
@@ -309,7 +344,6 @@
// parse configuration descriptor
//
InterfaceDescriptor =
USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor,
InterfaceIndex, -1, -1, -1, -1);
- ASSERT(InterfaceDescriptor);
if (InterfaceDescriptor)
{
//
@@ -319,6 +353,17 @@
FDODeviceExtension->InterfaceListCount++;
CurrentPosition = (PVOID)((ULONG_PTR)InterfaceDescriptor +
InterfaceDescriptor->bLength);
}
+ else
+ {
+ DumpFullConfigurationDescriptor(FDODeviceExtension,
ConfigurationDescriptor);
+
+ //
+ // see issue
+ // CORE-6574 Test 3 (USB Web Cam)
+ //
+ if (FDODeviceExtension->DeviceDescriptor &&
FDODeviceExtension->DeviceDescriptor->idVendor == 0x0458 &&
FDODeviceExtension->DeviceDescriptor->idProduct == 0x705f)
+ ASSERT(FALSE);
+ }
//
// move to next interface