Set the Configuration Descriptors

A short document that describes how to set the configuration descriptors.

Introduction

The configuration descriptor contains values required by the class drivers. The settings are:

  • number of interfaces in the configuration,

  • maximum power taken by the device,

  • is remote wakeup enabled.

Note: that the number of interfaces in the configuration must be set, all the other settings are optional.

The size of the data to be copied may be obtained by using GetConfigurationDescriptorSize().
TInt desc_size = 0;
gPort.GetConfigurationDescriptorSize(desc_size);

The size should normally be KUsbDescSize_Config as defined in <usb.h>

Setting configuration descriptors

Set the configuration descriptor using RDevUsbcScClient::SetConfigurationDescriptor().

TBuf8<desc_size> descriptor;

// Invert Remote-Wakup support
descriptor[KConfDesc_AttribOffset] = (descriptor[KConfDesc_AttribOffset] ^ KUsbDevAttr_RemoteWakeup);

// Change the reported max power to 200mA (2 * 0x64)
descriptor[KConfDesc_MaxPowerOffset] = 0x64;
r = gPort.SetConfigurationDescriptor(descriptor);

Additional values may be set using the RDevUsbcScClient class. These values can be set, retrieved and removed:

  • Manufacturer,

  • Product,

  • Serial numbers.

After you have set the configuration descriptors you should Set the Interface Descriptors.