line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# You may distribute under the terms of either the GNU General Public License |
2
|
|
|
|
|
|
|
# or the Artistic License (the same terms as Perl itself) |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# (C) Paul Evans, 2016 -- leonerd@leonerd.org.uk |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Linux::Termios2; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
442
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
9
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require XSLoader; |
14
|
|
|
|
|
|
|
XSLoader::load( __PACKAGE__, $VERSION ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
C - wrap the F-specific C structure |
19
|
|
|
|
|
|
|
and related |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This module is primarily intended as a helper for L, but it could |
24
|
|
|
|
|
|
|
also be used directly. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Linux::Termios2; |
27
|
|
|
|
|
|
|
use POSIX qw( TCSANOW ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $termios = Linux::Termios2->new; |
30
|
|
|
|
|
|
|
$termios->getattr( 0 ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$termios->setospeed( 123456 ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$termios->setattr( 0, TCSANOW ) or |
35
|
|
|
|
|
|
|
die "Cannot TCSETS2 - $!"; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This class provides an API equivalent to the L class, except |
40
|
|
|
|
|
|
|
backed by the F-specific C structure instead. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
It uses the C and C family of C calls, meaning it |
43
|
|
|
|
|
|
|
has access to the arbitrary baud rate ability of the C and |
44
|
|
|
|
|
|
|
C fields with the C baud setting. These are accessed |
45
|
|
|
|
|
|
|
transparently, by simply calling C and C with baud rates |
46
|
|
|
|
|
|
|
in bits per second. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Paul Evans |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
0x55AA; |