public void BVT_EUSB_OperateIo_TransferIn()
{
LogComment("BVT_EUSB_OperateIo_TransferIn");
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 TS_URB_CONTROL_DESCRIPTOR_REQUEST passing the buffer size as the size of " +
"USB_STRING_DESCRIPTOR a transfer in request.");
uint requestId = IdGenerator.NewId();
TS_URB_CONTROL_DESCRIPTOR_REQUEST des = new UrbBuilder(
URB_FUNCTIONID.URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE,
requestId,
0).BuildStringDescriptorRequest(1);
rdpeusbAdapter.TransferInRequest(device, des, USB_STRING_DESCRIPTOR.DefaultSize);
LogComment("7. Receives a completion message to retrieve the descriptor size specified as the " +
"member bLength in the USB_STRING_DESCRIPTOR.");
EusbPdu pdu = rdpeusbAdapter.ExpectCompletion(device.VirtualChannel);
ReqCapturer.VerifyUrbCompletion((EusbUrbCompletionPdu)pdu, des, interfaceId);
USB_STRING_DESCRIPTOR res = ParseStringDescriptor(pdu);
LogComment("8. Sends TS_URB_CONTROL_DESCRIPTOR_REQUEST with the buffer size as bLength.");
rdpeusbAdapter.TransferInRequest(device, des, res.bLength);
LogComment("9. Receives and parses the descriptor result.");
pdu = rdpeusbAdapter.ExpectCompletion(device.VirtualChannel);
ReqCapturer.VerifyUrbCompletion((EusbUrbCompletionPdu)pdu, des, interfaceId);
res = ParseStringDescriptor(pdu);
LogComment("The device string descriptor is '{0}'.", res.bString);
LogComment("10. Sends retract device request and the channel for the device is expected to be closed.");
rdpeusbAdapter.RetractDevice(device, USB_RETRACT_REASON.UsbRetractReason_BlockedByPolicy);
}