[Wine-patches] [eterhack 07/23] usbhub.sys: Add support for URB_FUNCTION_CLASS_*.
Alexander Morozov
=?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Пт Июн 5 13:00:07 MSD 2009
---
dlls/usbhub.sys/usbhub.c | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/dlls/usbhub.sys/usbhub.c b/dlls/usbhub.sys/usbhub.c
index f83bf04..ba77800 100644
--- a/dlls/usbhub.sys/usbhub.c
+++ b/dlls/usbhub.sys/usbhub.c
@@ -280,6 +280,9 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case URB_FUNCTION_VENDOR_DEVICE:
case URB_FUNCTION_VENDOR_INTERFACE:
case URB_FUNCTION_VENDOR_ENDPOINT:
+ case URB_FUNCTION_CLASS_DEVICE:
+ case URB_FUNCTION_CLASS_INTERFACE:
+ case URB_FUNCTION_CLASS_ENDPOINT:
{
libusb_device_handle *husb;
struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST *request =
@@ -287,7 +290,7 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
unsigned char *req_buf = request->TransferBuffer;
ULONG size = request->TransferBufferLength;
- TRACE( "URB_FUNCTION_VENDOR_*\n" );
+ TRACE( "URB_FUNCTION_{VENDOR,CLASS}_*\n" );
if (req_buf == NULL && request->TransferBufferMDL != NULL)
req_buf = request->TransferBufferMDL->MappedSystemVa;
@@ -298,14 +301,19 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
}
if (!libusb_open( inst->dev, &husb ))
{
- UCHAR req_type = request->RequestTypeReservedBits | (2 << 5);
+ UCHAR req_type = request->RequestTypeReservedBits;
unsigned char *buf;
int ret;
- if (urb->u.UrbHeader.Function == URB_FUNCTION_VENDOR_INTERFACE)
- req_type |= 1;
- else if (urb->u.UrbHeader.Function == URB_FUNCTION_VENDOR_ENDPOINT)
- req_type |= 2;
+ switch (urb->u.UrbHeader.Function)
+ {
+ case URB_FUNCTION_VENDOR_DEVICE: req_type |= 0x40; break;
+ case URB_FUNCTION_VENDOR_INTERFACE: req_type |= 0x41; break;
+ case URB_FUNCTION_VENDOR_ENDPOINT: req_type |= 0x42; break;
+ case URB_FUNCTION_CLASS_DEVICE: req_type |= 0x20; break;
+ case URB_FUNCTION_CLASS_INTERFACE: req_type |= 0x21; break;
+ case URB_FUNCTION_CLASS_ENDPOINT: req_type |= 0x22; break;
+ }
buf = HeapAlloc( GetProcessHeap(), 0, size );
if (buf != NULL)
{
@@ -541,6 +549,9 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case URB_FUNCTION_VENDOR_DEVICE:
case URB_FUNCTION_VENDOR_INTERFACE:
case URB_FUNCTION_VENDOR_ENDPOINT:
+ case URB_FUNCTION_CLASS_DEVICE:
+ case URB_FUNCTION_CLASS_INTERFACE:
+ case URB_FUNCTION_CLASS_ENDPOINT:
{
usb_dev_handle *husb;
struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST *request =
@@ -548,7 +559,7 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
unsigned char *req_buf = request->TransferBuffer;
ULONG size = request->TransferBufferLength;
- TRACE( "URB_FUNCTION_VENDOR_*\n" );
+ TRACE( "URB_FUNCTION_{VENDOR,CLASS}_*\n" );
if (req_buf == NULL && request->TransferBufferMDL != NULL)
req_buf = request->TransferBufferMDL->MappedSystemVa;
@@ -560,14 +571,19 @@ static NTSTATUS WINAPI usbhub_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
husb = usb_open( inst->dev );
if (husb)
{
- UCHAR req_type = request->RequestTypeReservedBits | (2 << 5);
+ UCHAR req_type = request->RequestTypeReservedBits;
char *buf;
int ret;
- if (urb->u.UrbHeader.Function == URB_FUNCTION_VENDOR_INTERFACE)
- req_type |= 1;
- else if (urb->u.UrbHeader.Function == URB_FUNCTION_VENDOR_ENDPOINT)
- req_type |= 2;
+ switch (urb->u.UrbHeader.Function)
+ {
+ case URB_FUNCTION_VENDOR_DEVICE: req_type |= 0x40; break;
+ case URB_FUNCTION_VENDOR_INTERFACE: req_type |= 0x41; break;
+ case URB_FUNCTION_VENDOR_ENDPOINT: req_type |= 0x42; break;
+ case URB_FUNCTION_CLASS_DEVICE: req_type |= 0x20; break;
+ case URB_FUNCTION_CLASS_INTERFACE: req_type |= 0x21; break;
+ case URB_FUNCTION_CLASS_ENDPOINT: req_type |= 0x22; break;
+ }
buf = HeapAlloc( GetProcessHeap(), 0, size );
if (buf != NULL)
{
--
1.6.3.1
Подробная информация о списке рассылки Wine-patches