[Wine-patches] [eterhack 03/23] usbhub.sys: Add support for URB_FUNCTION_GET_STATUS_FROM_DEVICE.

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


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

diff --git a/dlls/usbhub.sys/usbhub.c b/dlls/usbhub.sys/usbhub.c
index fce8c7c..2c5d936 100644
--- a/dlls/usbhub.sys/usbhub.c
+++ b/dlls/usbhub.sys/usbhub.c
@@ -222,6 +222,34 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
                 }
             }
             break;
+        case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
+            {
+                struct _URB_CONTROL_GET_STATUS_REQUEST *request =
+                        &urb->u.UrbControlGetStatusRequest;
+                void *buf = request->TransferBuffer;
+                libusb_device_handle *husb;
+                int ret;
+
+                TRACE( "URB_FUNCTION_GET_STATUS_FROM_DEVICE\n" );
+
+                if (buf == NULL && request->TransferBufferMDL != NULL)
+                    buf = request->TransferBufferMDL->MappedSystemVa;
+                if (buf == NULL || request->TransferBufferLength < sizeof(USHORT))
+                {
+                    status = STATUS_INVALID_PARAMETER;
+                    break;
+                }
+                if (!libusb_open( inst->dev, &husb ))
+                {
+                    ret = libusb_control_transfer( husb, 1 << 7,
+                            LIBUSB_REQUEST_GET_STATUS, 0, request->Index, buf,
+                            sizeof(USHORT), 1000 );
+                    libusb_close( husb );
+                    if (ret < 0) break;
+                    status = STATUS_SUCCESS;
+                }
+            }
+            break;
         case URB_FUNCTION_VENDOR_DEVICE:
         case URB_FUNCTION_VENDOR_INTERFACE:
         case URB_FUNCTION_VENDOR_ENDPOINT:
@@ -421,6 +449,36 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
                 }
             }
             break;
+        case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
+            {
+                struct _URB_CONTROL_GET_STATUS_REQUEST *request =
+                        &urb->u.UrbControlGetStatusRequest;
+                void *buf = request->TransferBuffer;
+                usb_dev_handle *husb;
+                int ret;
+
+                TRACE( "URB_FUNCTION_GET_STATUS_FROM_DEVICE\n" );
+
+                if (buf == NULL && request->TransferBufferMDL != NULL)
+                    buf = request->TransferBufferMDL->MappedSystemVa;
+                if (buf == NULL || request->TransferBufferLength < sizeof(USHORT))
+                {
+                    status = STATUS_INVALID_PARAMETER;
+                    break;
+                }
+                husb = usb_open( inst->dev );
+                if (husb)
+                {
+                    ret = usb_control_msg( husb, 1 << 7, USB_REQ_GET_STATUS, 0,
+                            request->Index, buf, sizeof(USHORT), 1000 );
+                    if (ret < 0)
+                        ERR( "%s\n", usb_strerror() );
+                    else
+                        status = STATUS_SUCCESS;
+                    usb_close( husb );
+                }
+            }
+            break;
         case URB_FUNCTION_VENDOR_DEVICE:
         case URB_FUNCTION_VENDOR_INTERFACE:
         case URB_FUNCTION_VENDOR_ENDPOINT:
-- 
1.6.3.1



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