void AndroidUsbDeviceObject::OnGetUsbDeviceDescriptorCtl(WDFREQUEST request,
                                                         size_t output_buf_len) {
  ASSERT_IRQL_LOW_OR_DISPATCH();

  // Check the buffer first
  if (output_buf_len >= sizeof(USB_DEVICE_DESCRIPTOR)) {
    // Get the output buffer
    NTSTATUS status;
    void* ret_info = OutAddress(request, &status);
    ASSERT(NT_SUCCESS(status) && (NULL != ret_info));
    if (NT_SUCCESS(status)) {
      // Copy requested info into output buffer and complete request
      RtlCopyMemory(ret_info,
                    usb_device_descriptor(),
                    sizeof(USB_DEVICE_DESCRIPTOR));

      WdfRequestCompleteWithInformation(request,
                                        STATUS_SUCCESS,
                                        sizeof(USB_DEVICE_DESCRIPTOR));
    } else {
      WdfRequestComplete(request, status);
    }
  } else {
    WdfRequestCompleteWithInformation(request,
                                      STATUS_BUFFER_TOO_SMALL,
                                      sizeof(USB_DEVICE_DESCRIPTOR));
  }
}
bool AdbInterfaceObject::GetUsbDeviceDescriptor(USB_DEVICE_DESCRIPTOR* desc) {
  if (!IsOpened()) {
    SetLastError(ERROR_INVALID_HANDLE);
    return false;
  }

  CopyMemory(desc, usb_device_descriptor(), sizeof(USB_DEVICE_DESCRIPTOR));

  return true;
}
//************************************************************************
// this function is called by upper level code to register callback
// functions.
//************************************************************************
void	cdcacm_register(cdcacm_reset_cbfn reset)
{
	int i;

	for (i = 0; i < NRX; i++)
	{
		rx_length[i] = 0;
	}

	reset_cbfn = reset;

	usb_register(cdcacm_reset, cdcacm_control_transfer, cdcacm_bulk_transfer);

	assert(check(cdcacm_device_descriptor, sizeof (cdcacm_device_descriptor)) == 1);
	usb_device_descriptor(cdcacm_device_descriptor, sizeof (cdcacm_device_descriptor));

	assert(check(cdcacm_configuration_descriptor, sizeof (cdcacm_configuration_descriptor)) == 10);
	usb_configuration_descriptor(cdcacm_configuration_descriptor, sizeof (cdcacm_configuration_descriptor));

	assert(check(cdcacm_string_descriptor, sizeof (cdcacm_string_descriptor)) == 3);
	usb_string_descriptor(cdcacm_string_descriptor, sizeof (cdcacm_string_descriptor));
}