Linux::Input

Linux::Input is a Linux input event interface.
Download

Linux::Input Ranking & Summary

Advertisement

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

Linux::Input Tags


Linux::Input Description

Linux::Input is a Linux input event interface. Linux::Input is a Linux input event interface.SYNOPSISExample: 1 joystick using event API my $js1 = Linux::Input->new('/dev/input/event3'); while (1) { while (my @events = $js1->poll(0.01)) { foreach (@event) { } } }Example: 2 joysticks using joystick API (different event structure) my $js1 = Linux::Input::Joystick->new('/dev/input/js0'); my $js2 = Linux::Input::Joystick->new('/dev/input/js1'); my $selector = IO::Select->new(); $selector->add($js1->fh); $selector->add($js2->fh); while (my $fh = $selector->can_read) { my @event; if ($fh == $js1->fh) { @event = $js1->poll() } elsif ($fh == $js2->fh) { @event = $js2->poll() } foreach (@event) { # work } }Example 3: monitor all input devices use File::Basename qw(basename); my @inputs = map { "/dev/input/" . basename($_) } ; my @dev; my $selector = IO::Select->new(); foreach (@inputs) { my $device = Linux::Input->new($_); $selector->add($device->fh); push @dev, $device; } while (my $fh = $selector->can_read) { # work }Example 4: testing for events on the command line # information on what event queue belongs to what device cat /proc/bus/input/devices # verify that events are coming in sudo evtest.pl /dev/input/event* Requirements: · Perl


Linux::Input Related Software