[Wine-patches] [eterhack 02/23] usbhub.sys: Add support for USB_STRING_DESCRIPTOR_TYPE.
Alexander Morozov
=?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Пт Июн 5 13:00:02 MSD 2009
---
dlls/usbhub.sys/usbhub.c | 59 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/dlls/usbhub.sys/usbhub.c b/dlls/usbhub.sys/usbhub.c
index 04e00ad..fce8c7c 100644
--- a/dlls/usbhub.sys/usbhub.c
+++ b/dlls/usbhub.sys/usbhub.c
@@ -77,7 +77,7 @@ struct PdoExtension
#ifdef HAVE_LIBUSB
-static void add_data( char **dst, ULONG *dst_size, const void *src, ULONG src_size )
+static void add_data( unsigned char **dst, ULONG *dst_size, const void *src, ULONG src_size )
{
int copy;
@@ -134,13 +134,18 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
struct _URB_CONTROL_DESCRIPTOR_REQUEST *request =
&urb->u.UrbControlDescriptorRequest;
ULONG size = request->TransferBufferLength;
- char *buf = request->TransferBuffer;
+ unsigned char *buf = request->TransferBuffer;
TRACE( "URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE\n" );
+ if (!size)
+ {
+ status = STATUS_SUCCESS;
+ break;
+ }
if (buf == NULL && request->TransferBufferMDL != NULL)
buf = request->TransferBufferMDL->MappedSystemVa;
- if (buf == NULL && size)
+ if (buf == NULL)
{
status = STATUS_INVALID_PARAMETER;
break;
@@ -199,9 +204,21 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
status = STATUS_SUCCESS;
}
break;
- default:
- FIXME( "unsupported descriptor type %x\n",
- request->DescriptorType );
+ case USB_STRING_DESCRIPTOR_TYPE:
+ TRACE( "USB_STRING_DESCRIPTOR_TYPE\n" );
+ {
+ libusb_device_handle *husb;
+ int ret;
+
+ if (!libusb_open( inst->dev, &husb ))
+ {
+ ret = libusb_get_string_descriptor( husb, request->Index,
+ request->LanguageId, buf, size );
+ libusb_close( husb );
+ if (ret < 0) break;
+ status = STATUS_SUCCESS;
+ }
+ }
}
}
break;
@@ -321,13 +338,18 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
struct _URB_CONTROL_DESCRIPTOR_REQUEST *request =
&urb->u.UrbControlDescriptorRequest;
ULONG size = request->TransferBufferLength;
- char *buf = request->TransferBuffer;
+ unsigned char *buf = request->TransferBuffer;
TRACE( "URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE\n" );
+ if (!size)
+ {
+ status = STATUS_SUCCESS;
+ break;
+ }
if (buf == NULL && request->TransferBufferMDL != NULL)
buf = request->TransferBufferMDL->MappedSystemVa;
- if (buf == NULL && size)
+ if (buf == NULL)
{
status = STATUS_INVALID_PARAMETER;
break;
@@ -378,9 +400,24 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
status = STATUS_SUCCESS;
}
break;
- default:
- FIXME( "unsupported descriptor type %x\n",
- request->DescriptorType );
+ case USB_STRING_DESCRIPTOR_TYPE:
+ TRACE( "USB_STRING_DESCRIPTOR_TYPE\n" );
+ {
+ usb_dev_handle *husb;
+ int ret;
+
+ husb = usb_open( inst->dev );
+ if (husb)
+ {
+ ret = usb_get_string( husb, request->Index,
+ request->LanguageId, (void *)buf, size );
+ if (ret < 0)
+ ERR( "%s\n", usb_strerror() );
+ else
+ status = STATUS_SUCCESS;
+ usb_close( husb );
+ }
+ }
}
}
break;
--
1.6.3.1
Подробная информация о списке рассылки Wine-patches