https://git.reactos.org/?p=reactos.git;a=commitdiff;h=026a12fe396ebdcb4906a…
commit 026a12fe396ebdcb4906a32a71d9d951bae9c835
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Wed Mar 6 09:59:41 2019 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Mon Mar 11 08:54:01 2019 +0100
[USBPORT] Implement interface setting in USBPORT_OpenInterface.
---
drivers/usb/usbport/device.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c
index 8676571985..dbabb3113b 100644
--- a/drivers/usb/usbport/device.c
+++ b/drivers/usb/usbport/device.c
@@ -249,7 +249,7 @@ USBPORT_OpenInterface(IN PURB Urb,
IN PUSBPORT_CONFIGURATION_HANDLE ConfigHandle,
IN PUSBD_INTERFACE_INFORMATION InterfaceInfo,
IN OUT PUSBPORT_INTERFACE_HANDLE *iHandle,
- IN BOOLEAN IsSetInterface)
+ IN BOOLEAN SendSetInterface)
{
PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
PUSBPORT_INTERFACE_HANDLE InterfaceHandle = NULL;
@@ -259,6 +259,7 @@ USBPORT_OpenInterface(IN PURB Urb,
BOOLEAN HasAlternates;
ULONG NumEndpoints;
SIZE_T Length;
+ USB_DEFAULT_PIPE_SETUP_PACKET SetupPacket;
SIZE_T HandleLength;
BOOLEAN IsAllocated = FALSE;
USHORT MaxPacketSize;
@@ -279,9 +280,29 @@ USBPORT_OpenInterface(IN PURB Urb,
Length = FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes) +
NumEndpoints * sizeof(USBD_PIPE_INFORMATION);
- if (HasAlternates && IsSetInterface)
+ if (HasAlternates && SendSetInterface)
{
- DPRINT1("USBPORT_OpenInterface: InterfaceInfo->AlternateSetting
&& IsSetInterface !\n");
+ RtlZeroMemory(&SetupPacket, sizeof(SetupPacket));
+
+ SetupPacket.bmRequestType.Dir = BMREQUEST_HOST_TO_DEVICE;
+ SetupPacket.bmRequestType.Type = BMREQUEST_STANDARD;
+ SetupPacket.bmRequestType.Recipient = BMREQUEST_TO_INTERFACE;
+ SetupPacket.bRequest = USB_REQUEST_SET_INTERFACE;
+ SetupPacket.wValue.W = InterfaceInfo->AlternateSetting;
+ SetupPacket.wIndex.W = InterfaceInfo->InterfaceNumber;
+ SetupPacket.wLength = 0;
+
+ USBPORT_SendSetupPacket(DeviceHandle,
+ FdoDevice,
+ &SetupPacket,
+ NULL,
+ 0,
+ NULL,
+ &USBDStatus);
+ if (!USBD_SUCCESS(USBDStatus))
+ {
+ goto Exit;
+ }
}
if (*iHandle)
@@ -1533,7 +1554,7 @@ USBPORT_HandleSelectInterface(IN PDEVICE_OBJECT FdoDevice,
ConfigurationHandle,
Interface,
&iHandle,
- 1);
+ TRUE);
if (USBDStatus)
{