1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
package network::connection::dvb;
use base qw(network::connection::ethernet);
use strict;
use lib qw(/usr/lib/libDrakX); # helps perl_checker
use common;
use modules;
sub get_type_name() { N("DVB") }
sub get_type_description() { N("Satellite (DVB)") }
sub _get_type_icon() { 'dvb' }
sub get_devices() {
require detect_devices;
detect_devices::probe_category("multimedia/dvb");
}
sub get_metric { 15 }
sub handles_ifcfg {
my ($_class, $ifcfg) = @_;
exists $ifcfg->{DVB_ADAPTER_ID};
}
sub get_interface {
my ($self) = @_;
defined $self->{hardware}{adapter_id} && defined $self->{hardware}{network_demux} or return "dvb";
'dvb' . $self->{hardware}{adapter_id} . '_' . $self->{hardware}{network_demux};
}
sub get_dvb_device {
find { sysopen(undef, $_, c::O_RDWR() | c::O_NONBLOCK()) } glob("/dev/dvb/adapter*/net*");
}
sub load_interface_settings {
my ($self) = @_;
$self->guess_hardware_settings; #- so that matching interface settings can be loaded
$self->network::connection::load_interface_settings;
$self->{hardware}{adapter_id} = $self->{ifcfg}{DVB_ADAPTER_ID};
$self->{hardware}{network_demux} = $self->{ifcfg}{DVB_NETWORK_DEMUX};
$self->{hardware}{network_pid} = $self->{ifcfg}{DVB_NETWORK_PID};
}
sub guess_hardware_settings {
my ($self) = @_;
my $device = get_dvb_device() or return;
($self->{hardware}{adapter_id}, $self->{hardware}{network_demux}) = $device =~ m,/dev/dvb/adapter(\d+)/net(\d+),;
}
sub get_hardware_settings {
my ($self) = @_;
[
{ label => N("Adapter card"), val => \$self->{hardware}{adapter_id} },
{ label => N("Net demux"), val => \$self->{hardware}{network_demux} },
{ label => N("PID"), val => \$self->{hardware}{network_pid} },
];
}
sub build_ifcfg_settings {
my ($self) = @_;
my $settings = {
DVB_ADAPTER_ID => qq("$self->{hardware}{adapter_id}"),
DVB_NETWORK_DEMUX => qq("$self->{hardware}{network_demux}"),
DVB_NETWORK_PID => qq("$self->{hardware}{network_pid}"),
MII_NOT_SUPPORTED => "yes",
};
$self->SUPER::build_ifcfg_settings($settings);
}
1;
|