[USBPORT] Implement interface setting in USBPORT_OpenInterface.

This commit is contained in:
Thomas Faber 2019-03-06 09:59:41 +01:00
parent ac20ab031c
commit 026a12fe39
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -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)
{