summaryrefslogtreecommitdiffstats
path: root/lib/network/connection/pots.pm
blob: 22299f65c600e526dc0401878df5b49d71db43fb (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package network::connection::pots;

use base qw(network::connection::ppp);

use strict;
use common;

sub get_type_name {
    #-PO: POTS means "Plain old telephone service"
    N("POTS");
}
sub get_type_description {
    #-PO: POTS means "Plain old telephone service"
    #-PO: remove it if it doesn't have an equivalent in your language
    #-PO: for example, in French, it can be translated as "RTC"
    N("Analog telephone modem (POTS)");
}
sub _get_type_icon { 'potsmodem' }
sub get_metric { 50 }

sub handles_ifcfg {
    my ($_class, $ifcfg) = @_;
    $ifcfg->{DEVICE} =~ /^ppp/ && exists $ifcfg->{MODEMPORT};
}

sub get_devices {
    require detect_devices;
    require modules;
    #- FIXME: module alias should be written when config is written only
    #detect_devices::getModem(modules::any_conf->read);
    ();
}

my @thirdparty_settings = (
    {
        matching => qr/^Hcf:/,
        description => 'HCF 56k Modem',
        url => 'http://www.linuxant.com/drivers/hcf/',
        name => 'hcfpcimodem',
        kernel_module => {
            test_file => 'hcfpciengine',
        },
        tools => {
            test_file => '/usr/sbin/hcfpciconfig',
        },
        device => '/dev/ttySHCF0',
        post => '/usr/sbin/hcfpciconfig --auto',
        restart_service => 'hcfpci',
    },

    {
        matching => qr/^Hsf:/,
        description => 'HSF 56k Modem',
        url => 'http://www.linuxant.com/drivers/hsf/',
        name => 'hsfmodem',
        kernel_module => {
            test_file => 'hsfengine',
        },
        tools => {
            test_file => '/usr/sbin/hsfconfig',
        },
        device => '/dev/ttySHSF0',
        post => '/usr/sbin/hsfconfig --auto',
        restart_service => 'hsf',
    },

    {
        matching => qr/^LT:/,
        description => 'LT WinModem',
        url => 'http://www.heby.de/ltmodem/',
        name => 'ltmodem',
        kernel_module => 1,
        tools => {
            test_file => '/etc/devfs/conf.d/ltmodem.conf',
        },
        device => '/dev/ttyS14',
        links => [
            'http://linmodems.technion.ac.il/Ltmodem.html',
            'http://linmodems.technion.ac.il/packages/ltmodem/',
        ],
    },

    {
        matching => [ list_modules::category2modules('network/slmodem') ],
        description => 'Smartlink WinModem',
        url => 'http://linmodems.technion.ac.il/resources.html#smartlink',
        name => 'slmodem',
        kernel_module => 1,
        tools => {
            test_file => '/usr/sbin/slmodemd',
        },
        device => '/dev/ttySL0',
        post => sub {
            my ($driver) = @_;
            addVarsInSh("$::prefix/etc/sysconfig/slmodemd", { SLMODEMD_MODULE => $driver });
        },
        restart_service => "slmodemd",
    },

    {
        name => 'sm56',
        description => 'Motorola SM56 WinModem',
        url => 'http://www.motorola.com/softmodem/driver.htm#linux',
        kernel_module => {
            package => 'sm56',
        },
        no_distro_package => 1,
        device => '/dev/sm56',
    },
);

sub get_thirdparty_settings { \@thirdparty_settings }

sub get_providers {
    my $db_path = "/usr/share/apps/kppp/Provider";
    #$in->do_pkgs->ensure_is_installed('kdenetwork-kppp-provider', $db_path);
    my $separator = "|";
    my %providers;
    foreach (all($::prefix . $db_path)) {
        s!_! !g;
        my $country = $_;
        my $t_country = translate($country);
        my $country_root = $::prefix . $db_path . '/' . $country;
        foreach (grep { $_ ne '.directory' } all($country_root)) {
            my $path = $country_root . $_;
            s/%([0-9]{3})/chr(int($1))/eg;
            $providers{$t_country . $separator . $_} = { path => $path };
        }
    }
    (\%providers, $separator);
}

1;