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

Download:
USB-Descriptor-4.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1   Source  

NAME ^

USB::HID - USB HID Descriptor generation tools

SYNOPSIS ^

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

DESCRIPTION ^

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

    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,
                }],
            }],
        },
    );

CLASS METHODS ^

$device = USB::HID::Descriptor(vendorID=>$vendorID, ...);

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.

AUTHOR ^

Brandon Fosdick, <bfoz at bfoz.net>

BUGS ^

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.

SUPPORT ^

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

    perldoc USB::HID

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.

syntax highlighting: