| 1 | package Linux::Input::Joystick; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use base 'Linux::Input'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # class data | ||||||||||||||||||||
| 8 | 1 | Linux::Input::Joystick->event_bytes(8); | |||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | # return all pending events | ||||||||||||||||||||
| 11 | 0 | ▶ | sub poll { | ||||||||||||||||||
|
Subroutine
poll: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 12 | 0 | my $self = shift; | |||||||||||||||||||
| 13 | 0 | ▶ | my $timeout = shift || ref($self)->timeout(); | ||||||||||||||||||
|
Condition0%0/3
shift() || ref($self)->timeout
MC/DC0%0/2
shift() || ref($self)->timeout
shift()
ref($self)->timeout
Truth table0%0/3
A || B
A= shift()B= ref($self)->timeout
| |||||||||||||||||||||
| 14 | 0 | my $selector = $self->selector(); | |||||||||||||||||||
| 15 | 0 | my @ev; | |||||||||||||||||||
| 16 | 0 | ▶ | while (my ($fh) = $selector->can_read($timeout)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 17 | 0 | my $buffer; | |||||||||||||||||||
| 18 | 0 | my $len = sysread($fh, $buffer, Linux::Input::Joystick->event_bytes); | |||||||||||||||||||
| 19 | 0 | my ($time, $value, $type, $number) = | |||||||||||||||||||
| 20 | unpack('LsCC', $buffer); | ||||||||||||||||||||
| 21 | 0 | my $event = { | |||||||||||||||||||
| 22 | time => $time, | ||||||||||||||||||||
| 23 | type => $type, | ||||||||||||||||||||
| 24 | number => $number, | ||||||||||||||||||||
| 25 | value => $value, | ||||||||||||||||||||
| 26 | }; | ||||||||||||||||||||
| 27 | 0 | push @ev, $event; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | 0 | return @ev; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 1 | 1; | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||