The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

USB::Descriptor::Configuration - USB Interface Descriptor

SYNOPSIS

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() ] );
    ...

DESCRIPTION

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.

CONSTRUCTOR

$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.

ATTRIBUTES

$interface->attributes

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

$interface->description

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

$interface->interface

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

$interface->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.

$interface->max_current

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

$interface->remote_wakeup

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

$interface->self_powered

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

$interface->value

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().

AUTHOR

Brandon Fosdick, <bfoz at bfoz.net>

BUGS

Please report any bugs or feature requests to bug-usb-descriptor-configuration at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=USB-Descriptor-Configuration. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

    perldoc USB::Descriptor::Configuration

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2011 Brandon Fosdick.

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