[Wine-patches] [eterhack 06/23] usbhub.sys: Add support for URB_FUNCTION_SELECT_INTERFACE.

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Пт Июн 5 13:00:06 MSD 2009


---
 dlls/usbhub.sys/usbhub.c |   54 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/dlls/usbhub.sys/usbhub.c b/dlls/usbhub.sys/usbhub.c
index 277cd4f..f83bf04 100644
--- a/dlls/usbhub.sys/usbhub.c
+++ b/dlls/usbhub.sys/usbhub.c
@@ -129,6 +129,33 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
                 }
             }
             break;
+        case URB_FUNCTION_SELECT_INTERFACE:
+            {
+                struct _URB_SELECT_INTERFACE *request =
+                        &urb->u.UrbSelectInterface;
+                libusb_device_handle *husb;
+
+                TRACE( "URB_FUNCTION_SELECT_INTERFACE\n" );
+
+                if (!libusb_open( inst->dev, &husb ))
+                {
+                    int ret;
+
+                    ret = libusb_claim_interface( husb,
+                            request->Interface.InterfaceNumber );
+                    if (!ret)
+                    {
+                        ret = libusb_set_interface_alt_setting( husb,
+                                request->Interface.InterfaceNumber,
+                                request->Interface.AlternateSetting );
+                        if (!libusb_release_interface( husb,
+                                request->Interface.InterfaceNumber ) && !ret)
+                            status = STATUS_SUCCESS;
+                    }
+                    libusb_close( husb );
+                }
+            }
+            break;
         case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
             {
                 struct _URB_CONTROL_DESCRIPTOR_REQUEST *request =
@@ -366,6 +393,33 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
                 }
             }
             break;
+        case URB_FUNCTION_SELECT_INTERFACE:
+            {
+                struct _URB_SELECT_INTERFACE *request =
+                        &urb->u.UrbSelectInterface;
+                usb_dev_handle *husb;
+
+                TRACE( "URB_FUNCTION_SELECT_INTERFACE\n" );
+
+                husb = usb_open( inst->dev );
+                if (husb)
+                {
+                    int ret;
+
+                    ret = usb_claim_interface( husb,
+                            request->Interface.InterfaceNumber );
+                    if (!ret)
+                    {
+                        ret = usb_set_altinterface( husb,
+                                request->Interface.AlternateSetting );
+                        if (!usb_release_interface( husb,
+                                request->Interface.InterfaceNumber ) && !ret)
+                            status = STATUS_SUCCESS;
+                    }
+                    usb_close( husb );
+                }
+            }
+            break;
         case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
             {
                 struct _URB_CONTROL_DESCRIPTOR_REQUEST *request =
-- 
1.6.3.1



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