[Wine-devel] usbd.sys: Fix USBD_CreateConfigurationRequestEx

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Чт Июл 31 17:28:29 MSD 2008


Функция изменена в соответствии с тестами. Старая реализация могла 
зациклиться, к тому же оказалось, что она делает много лишнего.
----------- следующая часть -----------
From 0f239e3bcfcf4177aacf0863524670c9167ab9f4 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Thu, 31 Jul 2008 17:23:25 +0400
Subject: [PATCH] usbd.sys: Fix USBD_CreateConfigurationRequestEx

---
 dlls/usbd.sys/usbd.c |   35 ++++-------------------------------
 1 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/dlls/usbd.sys/usbd.c b/dlls/usbd.sys/usbd.c
index 5ac37a8..f35e7fe 100644
--- a/dlls/usbd.sys/usbd.c
+++ b/dlls/usbd.sys/usbd.c
@@ -31,23 +31,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(usbd);
 
-static int find_descriptor( PUSB_CONFIGURATION_DESCRIPTOR conf,
-        void **from, UCHAR type )
-{
-    USB_COMMON_DESCRIPTOR *desc = *from;
-
-    while ((char *)desc < (char *)conf + conf->wTotalLength)
-    {
-        if (desc->bDescriptorType == type)
-        {
-            *from = desc;
-            return 1;
-        }
-        desc = (USB_COMMON_DESCRIPTOR *)((char *)desc + desc->bLength);
-    }
-    return 0;
-}
-
 PURB WINAPI USBD_CreateConfigurationRequestEx(
         PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
         PUSBD_INTERFACE_LIST_ENTRY InterfaceList )
@@ -58,7 +41,6 @@ PURB WINAPI USBD_CreateConfigurationRequestEx(
     struct _URB_SELECT_CONFIGURATION *sel_conf;
     USBD_INTERFACE_INFORMATION *if_info;
     USB_INTERFACE_DESCRIPTOR *if_desc;
-    USB_ENDPOINT_DESCRIPTOR *ep_desc;
     USBD_INTERFACE_LIST_ENTRY *entry;
 
     TRACE( "%p, %p\n", ConfigurationDescriptor, InterfaceList );
@@ -89,22 +71,13 @@ PURB WINAPI USBD_CreateConfigurationRequestEx(
         if_desc = entry->InterfaceDescriptor;
         entry->Interface = if_info;
         if_info->InterfaceNumber = if_desc->bInterfaceNumber;
-        if_info->Class = if_desc->bInterfaceClass;
-        if_info->SubClass = if_desc->bInterfaceSubClass;
-        if_info->Protocol = if_desc->bInterfaceProtocol;
         if_info->NumberOfPipes = if_desc->bNumEndpoints;
-        ep_desc = (USB_ENDPOINT_DESCRIPTOR *)(if_desc + 1);
-        k = 0;
-        while (find_descriptor( ConfigurationDescriptor, (void **)&ep_desc,
-                USB_ENDPOINT_DESCRIPTOR_TYPE ))
-        {
-            if_info->Pipes[k].MaximumPacketSize = ep_desc->wMaxPacketSize;
-            if_info->Pipes[k].EndpointAddress = ep_desc->bEndpointAddress;
-            if_info->Pipes[k].Interval = ep_desc->bInterval;
-            ++k;
-        }
+        for (k = 0; k < if_info->NumberOfPipes; ++k)
+            if_info->Pipes[k].MaximumTransferSize = 4096;
         if_info->Length = sizeof(USBD_INTERFACE_INFORMATION) +
                 (k - 1) * sizeof(USBD_PIPE_INFORMATION);
+        if_info = (USBD_INTERFACE_INFORMATION *)((char *)if_info +
+                if_info->Length);
         ++entry;
     }
 
-- 
1.5.4.5.GIT



Подробная информация о списке рассылки Wine-devel