summaryrefslogtreecommitdiffstats
path: root/perl-install/network/modem.pm
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-07-02 20:51:08 +0000
committerdamien <damien@mandriva.com>2001-07-02 20:51:08 +0000
commit6fcfa39325f63952260032fe0b2e42f620bc7734 (patch)
tree8cb7db55a0dc3f5f4ea0e1b2acad3696cda3f341 /perl-install/network/modem.pm
parent3e745b343439ebf6f58e1c41d0e831df7cc4b3e7 (diff)
downloaddrakx-backup-do-not-use-6fcfa39325f63952260032fe0b2e42f620bc7734.tar
drakx-backup-do-not-use-6fcfa39325f63952260032fe0b2e42f620bc7734.tar.gz
drakx-backup-do-not-use-6fcfa39325f63952260032fe0b2e42f620bc7734.tar.bz2
drakx-backup-do-not-use-6fcfa39325f63952260032fe0b2e42f620bc7734.tar.xz
drakx-backup-do-not-use-6fcfa39325f63952260032fe0b2e42f620bc7734.zip
new network sources reorganization
Diffstat (limited to 'perl-install/network/modem.pm')
-rw-r--r--perl-install/network/modem.pm88
1 files changed, 88 insertions, 0 deletions
diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm
new file mode 100644
index 000000000..e97ad13fd
--- /dev/null
+++ b/perl-install/network/modem.pm
@@ -0,0 +1,88 @@
+package network::modem;
+use common qw(:common :file);
+use network::tools;
+use vars qw(@ISA @EXPORT);
+
+@ISA = qw(Exporter);
+@EXPORT = qw(pppConfig modem_detect_backend);
+
+sub configure{
+ my ($netcnx, $mouse, $netc) = @_;
+ $netcnx->{type}='modem';
+ $netcnx->{$netcnx->{type}}={};
+ $netcnx->{modem}{device}=$netc->{autodetect}{modem};
+ modem_step_1:
+ pppConfig($netcnx->{$netcnx->{type}}, $mouse, $netc) or return;
+ output "$prefix$connect_file",
+ q(#!/bin/bash
+ifup ppp0
+);
+ output "$prefix$disconnect_file",
+ q(#!/bin/bash
+ifdown ppp0
+killall pppd
+);
+ chmod 0755, "$prefix$disconnect_file";
+ chmod 0755, "$prefix$connect_file";
+ if ($::isStandalone) { ask_connect_now($netcnx->{$netcnx->{type}}, 'ppp0') or goto modem_step_1 }
+ 1;
+}
+
+sub pppConfig {
+ my ($modem, $mouse, $netc) = @_;
+
+ $mouse ||={};
+ $mouse->{device} ||= readlink "$prefix/dev/mouse";
+ $::isInstall and $in->set_help('selectSerialPort');
+ $modem->{device} ||= $in->ask_from_listf('', _("Please choose which serial port your modem is connected to."),
+ \&mouse::serial_port2text,
+ [ grep { $_ ne $mouse->{device} } (mouse::serial_ports, if_(-e '/dev/modem', '/dev/modem')) ]) || return;
+
+ $::isStandalone || $in->set_help('configureNetworkISP');
+ $in->ask_from_entries_refH('', _("Dialup options"), [
+{ label => _("Connection name"), val => \$modem->{connection} },
+{ label => _("Phone number"), val => \$modem->{phone} },
+{ label => _("Login ID"), val => \$modem->{login} },
+{ label => _("Password"), val => \$modem->{passwd}, hidden => 1 },
+{ label => _("Authentication"), val => \$modem->{auth}, list => [ __("PAP"), __("Terminal-based"), __("Script-based") ] },
+{ label => _("Domain name"), val => \$modem->{domain} },
+{ label => _("First DNS Server (optional)"), val => \$modem->{dns1} },
+{ label => _("Second DNS Server (optional)"), val => \$modem->{dns2} },
+ ]) or return;
+ any::pppConfig($modem, $install);
+ $netc->{$_}='ppp0' foreach 'NET_DEVICE', 'NET_INTERFACE';
+ 1;
+}
+#-AT&F&O2B40
+#- DialString=ATDT0231389595((
+
+#- modem_detect_backend : detects modem on serial ports and fills the infos in $modem : detects only one card
+#- input
+#- $modem
+#- $mouse : facultative, hash containing device to exclude not to test mouse port : ( device => /ttyS[0-9]/ )
+#- output:
+#- $modem->{device} : device where the modem were detected
+sub modem_detect_backend {
+ my ($modem, $mouse) = @_;
+ $mouse ||={};
+ $mouse->{device} ||= readlink "/dev/mouse";
+ my $serdev = arch() =~ /ppc/ ? "macserial" : "serial";
+ eval { modules::load("$serdev") };
+
+ detect_devices::probeSerialDevices();
+ foreach ('modem', map { "ttyS$_" } (0..7)) {
+ next if $mouse->{device} =~ /$_/;
+ next unless -e "/dev/$_";
+ detect_devices::hasModem("/dev/$_") and $modem->{device} = "$_", last;
+ }
+
+ #- add an alias for macserial on PPC
+ modules::add_alias('serial', $serdev) if (arch() =~ /ppc/ && $modem->{device});
+ my @devs = modules::get_pcmcia_devices();
+ foreach (@devs) {
+ $_->{type} =~ /serial/ and $modem->{device} = $_->{device};
+ }
+
+}
+
+1;