Brandon Fosdick > USB-Descriptor-4 > USB::Descriptor::Configuration



Annotate this POD

View/Report Bugs
Module Version: 2   Source  


USB::Descriptor::Configuration - USB Interface Descriptor


An object representation of a USB configuration descriptor.

    use USB::Descriptor::Configuration;

    my $configuration = USB::Descriptor::Configuration->new( description => 'My First Configuration' );
    $configuration->max_current(100);   # Max current in mA
    $configuration->self_powered(1);    # Self-powered device
    $configuration->interfaces( [ USB::Descriptor::Interface->new() ] );


USB::Descriptor::Configuration represents a USB configuration descriptor. When added to the descriptor tree of a USB::Descriptor::Device object it can be used to generate the data structures needed to compile the firmware for a USB device.


$configuration = USB::Descriptor::Configuration->new(description=>$description, ...);

Constructs and returns a new USB::Descriptor::Configuration object using the passed options. Each option key is the name of an accessor method.

Arrayification ^

$configuration->bytes (or @{$configuration} )

Returns an array of bytes containing all of the fields in the configuration descriptor fields as well as all of the child interface descriptors.



Direct access to the bmAttributes value. Don't use this unless you know what you're doing.


Get/Set the configuration's description string. A string descriptor index (iConfiguration) will be automatically assigned when arrayified by USB::Descriptor::Configuration.


A convenience method that wraps a single hash reference in an array and passes it to interfaces().


Get/Set the array of USB::Descriptor::Interface objects. All of the interfaces in the passed array will be arrayified when the configuration object is arrayified by USB::Descriptor::Device.


Get/Set the configuration's max current draw in milliamps (bMaxPower). Defaults to 0.


Get/Set the configuration's remote wakeup attribute (bmAttributes).


Get/Set the configuration's self-powered attribute (bmAttributes).


Get/Set the configuration's configuration value (bConfigurationValue).

If no value is specified, and the configuration has been added to a USB::Descriptor::Device, a value will be automatically assigned by USB::Descriptor::Device->bytes().


Brandon Fosdick, <bfoz at>


Please report any bugs or feature requests to bug-usb-descriptor-configuration at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc USB::Descriptor::Configuration

You can also look for information at:



Copyright 2011 Brandon Fosdick.

This program is released under the terms of the BSD License.

syntax highlighting: