Linux::Input::Joystick

Linux::Input::Joystick is a joystick-specific interface for Linux 2.2
Download

Linux::Input::Joystick Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • John BEPPU
  • Publisher web site:
  • http://search.cpan.org/~beppu/

Linux::Input::Joystick Tags


Linux::Input::Joystick Description

Linux::Input::Joystick is a joystick-specific interface for Linux 2.2 Linux::Input::Joystick is a joystick-specific interface for Linux 2.2 SYNOPSISUsage use YAML; my $js = Linux::Input::Joystick->new('/dev/input/js0'); while (1) { my @event = $js->poll(0.01); print Dump($_) foreach (@event); }This is a subclass of Linux::Input that implements the joystick event interface that versions of Linux from 2.2 onward support. It differs from the normal event interface in that it uses a slightly different C struct to return event information.This subclass inherits all of Linux::Input's methods, but differs from it in the following ways:Class MethodsnewThis method takes a $filename and returns a Linux::Input::Joystick object on success.Example: my $js = Linux::Input::Joystick->new('/dev/input/js1');event_bytesThis method returns the size of the joystick event structure (which is always 8) no matter what platform you run this on.Object MethodspollThis method takes a $timeout as a parameter and returns an list of @events after that timeout has elapsed. The hashrefs inside @events have the following key/value pairs.time This is the time in microseconds that this event happened.type This is the type of event.number This number represents a more specific instance of type. For example, if type is 1 (meaning button event), then number might be 5 (meaning button 5 moved).value This number specifies what happened. Keeping the previous example in mind, if the value received is 1, that means the button was pressed. However, if it's 0, that means the button was released.For more information on what values to expect in this hashref, go look at /usr/include/linux/joystick.h Requirements: · Perl


Linux::Input::Joystick Related Software