mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 07:41:51 +00:00
[USBPORT] Add support for transaction translators in USBPORT_CreateDevice().
This commit is contained in:
parent
3fcbd7744c
commit
c92f591144
1 changed files with 50 additions and 5 deletions
|
@ -893,6 +893,9 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
|
||||||
IN USHORT PortStatus,
|
IN USHORT PortStatus,
|
||||||
IN USHORT Port)
|
IN USHORT Port)
|
||||||
{
|
{
|
||||||
|
PUSBPORT_DEVICE_HANDLE TtDeviceHandle = NULL;
|
||||||
|
PUSB2_TT_EXTENSION TtExtension = NULL;
|
||||||
|
USHORT port;
|
||||||
PUSBPORT_DEVICE_HANDLE DeviceHandle;
|
PUSBPORT_DEVICE_HANDLE DeviceHandle;
|
||||||
PUSBPORT_PIPE_HANDLE PipeHandle;
|
PUSBPORT_PIPE_HANDLE PipeHandle;
|
||||||
BOOL IsOpenedPipe;
|
BOOL IsOpenedPipe;
|
||||||
|
@ -902,7 +905,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
|
||||||
SIZE_T DescriptorMinSize;
|
SIZE_T DescriptorMinSize;
|
||||||
UCHAR MaxPacketSize;
|
UCHAR MaxPacketSize;
|
||||||
PUSBPORT_DEVICE_EXTENSION FdoExtension;
|
PUSBPORT_DEVICE_EXTENSION FdoExtension;
|
||||||
|
PUSBPORT_REGISTRATION_PACKET Packet;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("USBPORT_CreateDevice: PortStatus - %p, Port - %x\n",
|
DPRINT("USBPORT_CreateDevice: PortStatus - %p, Port - %x\n",
|
||||||
|
@ -910,6 +913,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
|
||||||
Port);
|
Port);
|
||||||
|
|
||||||
FdoExtension = FdoDevice->DeviceExtension;
|
FdoExtension = FdoDevice->DeviceExtension;
|
||||||
|
Packet = &FdoExtension->MiniPortInterface->Packet;
|
||||||
|
|
||||||
KeWaitForSingleObject(&FdoExtension->DeviceSemaphore,
|
KeWaitForSingleObject(&FdoExtension->DeviceSemaphore,
|
||||||
Executive,
|
Executive,
|
||||||
|
@ -928,11 +932,21 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
|
||||||
return STATUS_DEVICE_NOT_CONNECTED;
|
return STATUS_DEVICE_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FdoExtension->MiniPortInterface->Packet.MiniPortFlags & USB_MINIPORT_FLAGS_USB2 &&
|
port = Port;
|
||||||
|
|
||||||
|
if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2 &&
|
||||||
!(PortStatus & USB_PORT_STATUS_HIGH_SPEED))
|
!(PortStatus & USB_PORT_STATUS_HIGH_SPEED))
|
||||||
{
|
{
|
||||||
DPRINT1("USBPORT_CreateDevice: USB1 device connected to USB2 port. FIXME: Transaction Translator.\n");
|
DPRINT1("USBPORT_CreateDevice: USB1 device connected to USB2 port\n");
|
||||||
DbgBreakPoint();
|
|
||||||
|
TtExtension = USBPORT_GetTt(FdoDevice,
|
||||||
|
HubDeviceHandle,
|
||||||
|
&port,
|
||||||
|
&TtDeviceHandle);
|
||||||
|
|
||||||
|
DPRINT("USBPORT_CreateDevice: TtDeviceHandle - %p, port - %x\n",
|
||||||
|
TtDeviceHandle,
|
||||||
|
port);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
|
KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
|
||||||
|
@ -954,6 +968,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
|
||||||
|
|
||||||
*pUsbdDeviceHandle = NULL;
|
*pUsbdDeviceHandle = NULL;
|
||||||
|
|
||||||
|
DeviceHandle->TtExtension = TtExtension;
|
||||||
DeviceHandle->PortNumber = Port;
|
DeviceHandle->PortNumber = Port;
|
||||||
DeviceHandle->HubDeviceHandle = HubDeviceHandle;
|
DeviceHandle->HubDeviceHandle = HubDeviceHandle;
|
||||||
|
|
||||||
|
@ -993,6 +1008,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeListHead(&DeviceHandle->PipeHandleList);
|
InitializeListHead(&DeviceHandle->PipeHandleList);
|
||||||
|
InitializeListHead(&DeviceHandle->TtList);
|
||||||
|
|
||||||
Status = USBPORT_OpenPipe(FdoDevice,
|
Status = USBPORT_OpenPipe(FdoDevice,
|
||||||
DeviceHandle,
|
DeviceHandle,
|
||||||
|
@ -1089,7 +1105,36 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
|
||||||
|
|
||||||
ErrorExit:
|
ErrorExit:
|
||||||
|
|
||||||
// FIXME: if Transaction Translator
|
if (TtExtension && TtDeviceHandle)
|
||||||
|
{
|
||||||
|
SetupPacket.bmRequestType.Recipient = BMREQUEST_TO_OTHER;
|
||||||
|
SetupPacket.bmRequestType.Reserved = 0;
|
||||||
|
SetupPacket.bmRequestType.Type = BMREQUEST_CLASS;
|
||||||
|
SetupPacket.bmRequestType.Dir = BMREQUEST_HOST_TO_DEVICE;
|
||||||
|
|
||||||
|
/* Table 11-15. Hub Class Requests */
|
||||||
|
if (TtDeviceHandle == HubDeviceHandle)
|
||||||
|
{
|
||||||
|
SetupPacket.bRequest = USB_REQUEST_RESET_TT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetupPacket.bRequest = USB_REQUEST_CLEAR_TT_BUFFER;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupPacket.wValue.LowByte = 0;
|
||||||
|
SetupPacket.wValue.HiByte = 0;
|
||||||
|
SetupPacket.wIndex.W = port;
|
||||||
|
SetupPacket.wLength = 0;
|
||||||
|
|
||||||
|
USBPORT_SendSetupPacket(TtDeviceHandle,
|
||||||
|
FdoDevice,
|
||||||
|
&SetupPacket,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
Status = STATUS_DEVICE_DATA_ERROR;
|
Status = STATUS_DEVICE_DATA_ERROR;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue