USB::Descriptor::Device - USB Device Descriptor
An object representation of a USB device descriptor.
use USB::Descriptor::Device; my $device = USB::Descriptor::Device->new( product => 'My First Device' ); $device->vendorID(0x1234); $device->productID(0x5678); $device->configurations( [ USB::Descriptor::Configuration->new() ] ); ...
USB::Descriptor::Device represents a USB device descriptor. After creating and configuring an instanace of USB::Descriptor::Device, arrayification (or $device->bytes) yeilds an array of all of the values that comprise the fields of a USB Device Descriptor structure given the configured settings. The resulting array can then be used to generate the structures (in Assembly or C or...) necessary for building the firmware of the described device.
$device->bytes
After adding one or more USB::Descriptor::Configuration objects to an instance of USB::Descriptor::Device, it can be used to generate USB Configuration Descriptors. Arrayifying each child descriptor in the configurations array yields the appropriate descriptor bytes, including interfaces and endpoints.
Strings specificed for the device descriptor (manufacturer, product or serial number) as well as the strings for child descriptors (configuration, interface, etc) will be automatically indexed by USB::Descriptor::Device and the proper indexes embedded in the appropriate descriptors during arrayification.
After arrayifying the USB::Descriptor::Device and all child USB::Descriptor::Configurations, the generated set of strings can be retrieved (in index order) by calling the 'strings' method.
Constructs and returns a new USB::Descriptor::Device object using the passed options. Each option key is the name of an accessor method.
Returns an array of bytes containing all of the fields in the device descriptor fields, but not including configuration descriptors.
Direct access to the bcdDevice value. Don't use this unless you know what you're doing.
Direct access to the bcdUSB value. Don't use this unless you know what you're doing.
Get/Set the device class code (bDeviceClass).
A convenience method that wraps a single hash reference in an array and passes it to configurations().
configurations()
Get/Set the array of USB::Descriptor::Configuration objects.
Get/Set the device's manufacturer string. A string descriptor index (iManufacturer) will be automatically assigned during arrayification.
Get/Set the maximum packet size for endpoint 0 (bMaxPacketSize). Valid values are 8, 16, 32, 64. Defaults to 8.
Get/Set the device's product string. A string descriptor index (iProduct) will be automatically assigned during arrayification.
Get/Set the device's Product ID (idProduct).
Get/Set the device's protocol (bDeviceProtocol).
Get/Set the device's serial number string. A string descriptor index (iSerialNumber) will be automatically assigned during arrayification.
Returns an array of strings in index order from the string descriptor set.
Get/Set the device's SubClass (bDeviceSubClass).
Get/Set the supported USB version (bcdUSB). The version is specified as a dotted string. eg. '1.2.3'. Defaults to '2.0.0'.
Get/Set the device's Vendor ID (idVendor).
Get/Set the device's version number (bcdDevice). The version is specified as a dotted string. eg. '1.2.3'.
Brandon Fosdick, <bfoz at bfoz.net>
<bfoz at bfoz.net>
Please report any bugs or feature requests to bug-usb-descriptor-device at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=USB-Descriptor-Device. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-usb-descriptor-device at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc USB::Descriptor::Device
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=USB-Descriptor-Device
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/USB-Descriptor-Device
CPAN Ratings
http://cpanratings.perl.org/d/USB-Descriptor-Device
Search CPAN
http://search.cpan.org/dist/USB-Descriptor-Device/
Copyright 2011 Brandon Fosdick.
This program is released under the terms of the BSD License.
To install USB::Descriptor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm USB::Descriptor
CPAN shell
perl -MCPAN -e shell install USB::Descriptor
For more information on module installation, please visit the detailed CPAN module installation guide.