summaryrefslogtreecommitdiffstats
path: root/perl-install/network/isdn.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-09-13 13:13:42 +0000
committerOlivier Blin <oblin@mandriva.org>2004-09-13 13:13:42 +0000
commitf300d93a09eb87bef0d58c6976be0149ea9e4f9c (patch)
tree29e9c3cd0824a3db80e986ac28a73e1dc75c651b /perl-install/network/isdn.pm
parent8e84b69d2cfc35a245552ccca9c94ffc29a21a53 (diff)
downloaddrakx-f300d93a09eb87bef0d58c6976be0149ea9e4f9c.tar
drakx-f300d93a09eb87bef0d58c6976be0149ea9e4f9c.tar.gz
drakx-f300d93a09eb87bef0d58c6976be0149ea9e4f9c.tar.bz2
drakx-f300d93a09eb87bef0d58c6976be0149ea9e4f9c.tar.xz
drakx-f300d93a09eb87bef0d58c6976be0149ea9e4f9c.zip
handle capi drivers
Diffstat (limited to 'perl-install/network/isdn.pm')
-rw-r--r--perl-install/network/isdn.pm69
1 files changed, 61 insertions, 8 deletions
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index c008a6d4f..8f8a364d6 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -10,18 +10,13 @@ use log;
use network::tools;
use MDK::Common::Globals "network", qw($in);
use MDK::Common::File;
+use services;
+use list_modules;
sub write_config {
my ($isdn, $netc) = @_;
$in->do_pkgs->install('isdn4net', if_($isdn->{speed} =~ /128/, 'ibod'), 'isdn4k-utils');
- write_config_backend($isdn, $netc);
- 1;
-}
-
-sub write_config_backend {
- my ($isdn, $netc, $o_netcnx) = @_;
- defined $o_netcnx and $netc->{isdntype} = $o_netcnx->{type};
output_with_perm("$::prefix/etc/isdn/profile/link/myisp", 0600,
qq(
@@ -51,13 +46,49 @@ I4L_PROTOCOL="$isdn->{protocol}"
usepeerdns
defaultroute
";
- system "$::prefix/etc/rc.d/init.d/isdn4linux restart";
+
+ services::stop("isdn4linux"); #- to be stopped before capi is loaded
+ if ($isdn->{driver} eq "capidrv") {
+ setup_capi_conf($isdn);
+ services::start_service_on_boot("capi4linux");
+ services::restart("capi4linux");
+ } else {
+ services::stop("capi4linux");
+ services::do_not_start_service_on_boot("capi4linux");
+ }
+ services::start_service_on_boot("isdn4linux");
+ services::start("isdn4linux");
write_secret_backend($isdn->{login}, $isdn->{passwd});
1;
}
+
+sub setup_capi_conf {
+ my ($isdn) = @_;
+
+ my $capi_card = get_capi_card($isdn);
+ is_module_installed($capi_card->{driver}) or $in->do_pkgs->install($capi_card->{driver});
+
+ my $capi_conf;
+ my $firmware = $capi_card->{firmware} || '-';
+ if ($capi_card->{driver} eq "fcclassic") {
+ $capi_conf = "fcclassic - - 0x300 5 - -\n# adjust IRQ and IO !! ^^^^^ ^^^\n";
+ } elsif ($capi_card->{driver} eq "fcpnp") {
+ $capi_conf = "fcpnp - - 0x300 5 - -\n# adjust IRQ and IO !! ^^^^^ ^^^\n";
+ } else {
+ $capi_conf = "$capi_card->{driver} $firmware - - - - -\n";
+ }
+ output("$::prefix/etc/capi.conf", $capi_conf);
+
+ #- install and run drdsl for dsl connections
+ if ($capi_card->{driver} =~ /dsl/i) {
+ $in->do_pkgs->ensure_is_installed_if_available("drdsl", "$::prefix/usr/sbin/drdsl");
+ run_program::rooted($::prefix, "/usr/sbin/drdsl");
+ }
+}
+
sub read_config {
my ($isdn) = @_;
@@ -145,4 +176,26 @@ sub get_cards() {
}
+sub is_module_installed {
+ my ($driver) = @_;
+ find { m!/\Q$driver\E\.k?o! } cat_($::prefix . '/lib/modules/' . c::kernel_version() . '/modules.dep');
+}
+
+
+sub get_capi_card {
+ my ($isdn) = @_;
+
+ my $capi_card = find {
+ hex($isdn->{vendor}) == $_->{vendor} && hex($isdn->{id}) == $_->{id}
+ } @isdn_capi or return;
+
+ #- check if the capi driver is available
+ unless (is_module_installed($capi_card->{driver}) || $in->do_pkgs->check_kernel_module_packages($capi_card->{driver})) {
+ log::explanations("a capi driver ($capi_card->{driver}) exists to replace $isdn->{driver}, but it isn't installed and no packages provide it");
+ return;
+ }
+
+ $capi_card;
+}
+
1;