USB::HID - USB HID Descriptor generation tools
A set of classes and methods for generating USB HID descriptor sets.
use USB::HID; my $device = USB::HID::Descriptor( product => 'My First Device' ); $device->vendorID(0x1234); $device->productID(0x5678); $device->configurations( [ USB::Descriptor::Configuration->new() ] ); ...
USB::HID provides a means of specifying a USB Human Interface Device's descriptors and then generating descriptor structures suitable for use in the device's firmware. However, USB::HID::Descriptor only generates the bytes that comprise the structures, it does not handle generation of valid source code.
The easiest way to create a new HID descriptor set is to use the USB::HID::Descriptor() factory method. It accepts a hash of arguments that happens to be the same hash expected by USB::Descriptor::Device and returns a reference to a new USB::Descriptor::Device object. Any interface specifications provided to the method will be automatically converted into USB::HID::Descriptor::Interface objects
USB::HID::Descriptor()
use USB::HID; my $device = USB::HID::Descriptor( 'usb_version' => '2.0.0', # Default 'max_packet_size' => 64, # Full speed device 'vendorID' => 0x1234, 'productID' => 0x5678, 'manufacturer' => 'Acme, Inc.', 'product' => 'Giant Catapult', 'serial_number' => '007', 'configurations' => [{ 'description' => 'Configuration 0', 'remote_wakeup' => 1, 'max_current' => 100, # mA 'interfaces' => [{ 'description' => 'Interface 0', 'endpoints' => [{ 'direction' => 'in', 'number' => 1, 'max_packet_size' => 42, }], }], }, );
Constructs and returns a new USB::Descriptor::Device object using the passed options. Each option key is the name of an accessor method of USB::Descriptor::Device. Interface specifications are automatically converted to USB::HID::Descriptor::Interface.
Brandon Fosdick, <bfoz at bfoz.net>
<bfoz at bfoz.net>
Please report any bugs or feature requests to bug-usb-hid at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=USB-HID. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-usb-hid at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc USB::HID
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=USB-HID
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/USB-Descriptor
CPAN Ratings
http://cpanratings.perl.org/d/USB-HID
Search CPAN
http://search.cpan.org/dist/USB-HID/
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.