Package ch.ntb.usb

Class Usb_Config_Descriptor

java.lang.Object
ch.ntb.usb.Usb_Descriptor
ch.ntb.usb.Usb_Config_Descriptor

public class Usb_Config_Descriptor extends Usb_Descriptor
Represents the descriptor of a USB configuration.
A USB device can have several different configuration.

The length of the configuration descriptor is Usb_Descriptor.USB_DT_CONFIG_SIZE and the type is Usb_Descriptor.USB_DT_CONFIG.
  • Field Details

    • USB_MAXCONFIG

      public static final int USB_MAXCONFIG
      Maximum number of configurations per device
      See Also:
  • Constructor Details

    • Usb_Config_Descriptor

      public Usb_Config_Descriptor()
  • Method Details

    • getBConfigurationValue

      public byte getBConfigurationValue()
      Returns the value to use as an argument to select this configuration (LibusbJava.usb_set_configuration(long, int)).
      Returns:
      the value to use as an argument to select this configuration
    • getBmAttributes

      public byte getBmAttributes()
      Returns the power parameters for this configuration.

      Bit 7: Reserved, set to 1 (USB 1.0 Bus Powered)
      Bit 6: Self Powered
      Bit 5: Remote Wakeup
      Bit 4..0: Reserved, set to 0
      Returns:
      the power parameters for this configuration
    • getBNumInterfaces

      public byte getBNumInterfaces()
      Returns the number of interfaces.
      Returns:
      the number of interfaces
    • getExtra

      public byte[] getExtra()
      Returns the data of extra descriptor(s) if available.
      Returns:
      null or a byte array with the extra descriptor data
    • getExtralen

      public int getExtralen()
      Returns the number of bytes of the extra descriptor.
      Returns:
      the number of bytes of the extra descriptor
    • getIConfiguration

      public byte getIConfiguration()
      Returns the index of the String descriptor describing this configuration.
      Returns:
      the index of the String descriptor
    • getInterface

      public Usb_Interface[] getInterface()
      Returns the USB interface descriptors.
      Returns:
      the USB interface descriptors
    • getMaxPower

      public byte getMaxPower()
      Returns the maximum power consumption in 2mA units.
      Returns:
      the maximum power consumption in 2mA units
    • getWTotalLength

      public short getWTotalLength()
      Returns the total length in bytes of all descriptors.
      When the configuration descriptor is read, it returns the entire configuration hierarchy which includes all related interface and endpoint descriptors. The wTotalLength field reflects the number of bytes in the hierarchy.
      Returns:
      the total length in bytes of all descriptors
    • toString

      public String toString()
      Overrides:
      toString in class Object