public void S3_EUSB_OperateIo_GetPortStatus()
{
LogComment("S3_EUSB_OperateIo_GetPortStatus");
LogComment("1. Creates the control virtual channel, exchanges capabilities then notifies that the channel is created.");
context.ControlChannel = CreateVirtualChannel();
LogComment("2. Receives an add virtual channel request.");
rdpeusbAdapter.ExpectAddVirtualChannel(context.ControlChannel);
LogComment("3. Creates a new virtual channel for the device.");
DynamicVirtualChannel channel = CreateVirtualChannel();
LogComment("4. Receives an add device request.");
EusbDeviceContext device = rdpeusbAdapter.ExpectAddDevice(channel);
LogComment("5. Registers a callback to provide the Request Completion Interface to the client.");
uint interfaceId = IdGenerator.NewId();
rdpeusbAdapter.RegisterCallback(device, 1, interfaceId);
LogComment("6. Sends an IOCTL_INTERNAL_USB_GET_PORT_STATUS request.");
uint requestId = IdGenerator.NewId();
const uint outputSize = 4;
rdpeusbAdapter.IoControl(device, UsbIoControlCode.IOCTL_INTERNAL_USB_GET_PORT_STATUS, null, outputSize, requestId);
LogComment("7. Receives a completion message.");
EusbPdu pdu = rdpeusbAdapter.ExpectCompletion(device.VirtualChannel);
// TODO: The result should be checked.
Site.Assert.IsNotNull(pdu, "Must receive a completion message.");
LogComment("8. Sends retract device request and the channel for the device is expected to be closed.");
rdpeusbAdapter.RetractDevice(device, USB_RETRACT_REASON.UsbRetractReason_BlockedByPolicy);
}