summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-03-12 15:12:50 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-03-12 15:12:50 +0000
commit114c14fc4960dbaeae88d8520456344feec75b84 (patch)
tree0781ec2fc5f2dd4da88f8102c0e5c09977b3f8cd
parent9edb2a384af2078f4769d2d3afbb7f7bb4939c25 (diff)
xpp init_card_* scripts now less verbose
* Demote some messages to be debug messages. * Rephrase the message about defaults for the PRI module (the driver's defaults are used, which is OK) git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@6135 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rwxr-xr-xdrivers/dahdi/xpp/init_card_1_3012
-rwxr-xr-xdrivers/dahdi/xpp/init_card_2_308
-rwxr-xr-xdrivers/dahdi/xpp/init_card_3_3028
-rwxr-xr-xdrivers/dahdi/xpp/init_card_4_3018
4 files changed, 43 insertions, 23 deletions
diff --git a/drivers/dahdi/xpp/init_card_1_30 b/drivers/dahdi/xpp/init_card_1_30
index fafd2c1..1356847 100755
--- a/drivers/dahdi/xpp/init_card_1_30
+++ b/drivers/dahdi/xpp/init_card_1_30
@@ -70,11 +70,11 @@ sub debug {
# Arrange for error logging
if (-t STDERR) {
$unit_id = 'Interactive';
- main::debug "Interactive startup";
+ debug "Interactive startup";
} else {
$unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}";
open (STDERR, "| logger -t $program -p kern.info") || die;
- main::debug "Non Interactive startup";
+ debug "Non Interactive startup";
foreach my $k (qw(
XBUS_NAME
XBUS_NUMBER
@@ -385,14 +385,14 @@ sub auto_calibrate($$) {
}
sub calibrate_slics() {
- main::logit "Calibrating '$0'";
+ main::debug "Calibrating '$0'";
auto_calibrate(0x47, 0x1E);
main::debug "after auto_calibrate";
manual_calibrate();
main::debug "after manul_calibrate";
auto_calibrate(0x40, 0x01);
main::debug "after auto_calibrate 2";
- main::logit "Continue '$0'";
+ main::debug "Continue '$0'";
}
sub read_defaults() {
@@ -405,7 +405,7 @@ sub read_defaults() {
package main;
-main::logit "Starting '$0'";
+main::debug "Starting '$0'";
FXS::read_defaults;
main::debug "before init_indirect_registers";
@@ -431,7 +431,7 @@ while(<DATA>) {
}
close REG;
-main::logit "Ending '$0'";
+main::debug "Ending '$0'";
close STDERR;
exit 0;
diff --git a/drivers/dahdi/xpp/init_card_2_30 b/drivers/dahdi/xpp/init_card_2_30
index 34f8a0b..8dd57ed 100755
--- a/drivers/dahdi/xpp/init_card_2_30
+++ b/drivers/dahdi/xpp/init_card_2_30
@@ -69,11 +69,11 @@ sub debug {
# Arrange for error logging
if (-t STDERR || $opts{v}) {
$unit_id = 'Interactive';
- main::debug "Interactive startup";
+ debug "Interactive startup";
} else {
$unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}";
open (STDERR, "| logger -t $program -p kern.info") || die;
- main::debug "Non Interactive startup";
+ debug "Non Interactive startup";
foreach my $k (qw(
XBUS_NAME
XBUS_NUMBER
@@ -365,7 +365,7 @@ if($opts{v}) {
exit 0;
}
-main::logit "Starting";
+main::debug "Starting";
FXO::read_defaults;
die "OPERMODE is undefined" unless $OPERMODE;
@@ -384,7 +384,7 @@ while(<DATA>) {
FXO::opermode_setup;
close REG;
-main::logit "Ending '$0'";
+main::debug "Ending '$0'";
close STDERR;
exit 0;
diff --git a/drivers/dahdi/xpp/init_card_3_30 b/drivers/dahdi/xpp/init_card_3_30
index 9e72089..47de70c 100755
--- a/drivers/dahdi/xpp/init_card_3_30
+++ b/drivers/dahdi/xpp/init_card_3_30
@@ -67,18 +67,24 @@ my %opts;
getopts('o:', \%opts);
+my %settings;
+
sub logit {
print STDERR "$unit_id: @_\n";
}
+sub debug {
+ logit @_ if $settings{debug};
+}
+
# Arrange for error logging
if (-t STDERR) {
$unit_id = 'Interactive';
- logit "Interactive startup";
+ debug "Interactive startup";
} else {
$unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}";
open (STDERR, "| logger -t $program -p kern.info") || die;
- logit "Non Interactive startup";
+ debug "Non Interactive startup";
foreach my $k (qw(
XBUS_NAME
XBUS_NUMBER
@@ -138,6 +144,14 @@ sub multibyte($) {
}
}
+sub read_defaults() {
+ if(XppConfig::read_config(\%settings)) {
+ main::logit "Defaults from $settings{xppconf}";
+ } else {
+ main::logit "No defaults file, use hard-coded defaults.";
+ }
+}
+
package BRI::Port;
sub new {
@@ -343,7 +357,7 @@ sub zthfc_startup {
$port->setup_su($chan); # zap_xhfc_su.c:194
}
- # Zaptel chan 2 used as HDLC D-Channel
+ # Dahdi chan 2 used as HDLC D-Channel
$port->setup_fifo(2, 0, 0x05, 2, 0); # D-TX: zap_xhfc_su.c:205
$port->setup_fifo(2, 1, 0x05, 2, 0); # D-RX: zap_xhfc_su.c:206
# E-chan, Echo channel is ignored
@@ -362,14 +376,16 @@ sub zthfc_startup {
package main;
-logit "Starting '$0'";
+debug "Starting '$0'";
+
+BRI::read_defaults;
#------------------------------------------- Instance detection
# zap_xhfc_su.c:895
sub init_xhfc($) {
my $portnum = shift;
- main::logit "init_xhfc($portnum)";
+ main::debug "init_xhfc($portnum)";
BRI::gen "#--------------------------- init_xhfc";
BRI::gen "$portnum WD 0D 00"; # r_FIFO_MD: 16 fifos,
# 64 bytes for TX and RX each (FIFO mode config)
@@ -452,7 +468,7 @@ sub main() {
main;
-logit "Ending '$0'";
+debug "Ending '$0'";
close REG;
close STDERR;
diff --git a/drivers/dahdi/xpp/init_card_4_30 b/drivers/dahdi/xpp/init_card_4_30
index 6d56398..ea04545 100755
--- a/drivers/dahdi/xpp/init_card_4_30
+++ b/drivers/dahdi/xpp/init_card_4_30
@@ -71,14 +71,18 @@ sub logit {
print STDERR "$unit_id: @_\n";
}
+sub debug {
+ logit @_ if $settings{debug};
+}
+
# Arrange for error logging
if (-t STDERR) {
$unit_id = 'Interactive';
- logit "Interactive startup";
+ debug "Interactive startup";
} else {
$unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}";
open (STDERR, "| logger -t $program -p kern.info") || die;
- logit "Non Interactive startup";
+ debug "Non Interactive startup";
foreach my $k (qw(
XBUS_NAME
XBUS_NUMBER
@@ -226,7 +230,7 @@ sub write_pri_info {
print INFO "$pri_protocol\n" || die "Failed writing '$pri_protocol' to '$file': $!\n";
close INFO || die "Failed during close of '$file': $!\n";
} else {
- main::logit "$xpd_name: Skip setting pri protocol -- non given";
+ main::logit "$xpd_name: pri_protocol not given. Driver will use defaults.";
}
}
@@ -359,7 +363,7 @@ sub port_setup($) {
package main;
-logit "Starting '$0'";
+main::debug "Starting '$0'";
PRI::read_defaults;
@@ -367,11 +371,11 @@ sub main() {
my @ports;
my $subunit;
- logit "main(): Initializing chip ($ENV{UNIT_SUBUNITS} ports)";
+ main::debug "main(): Initializing chip ($ENV{UNIT_SUBUNITS} ports)";
PRI::init_quad;
# Must initialize all 4 ports, regardless how much there are
for($subunit = 0; $subunit < 4; $subunit++) {
- #logit "main(): Initializing subunit $subunit";
+ #main::debug "main(): Initializing subunit $subunit";
my $p = PRI::Port->new(
'PORT_NUM' => $subunit,
'EXIST' => ($subunit < $ENV{UNIT_SUBUNITS})
@@ -389,7 +393,7 @@ sub main() {
main;
-logit "Ending '$0'";
+main::debug "Ending '$0'";
close REG;
close STDERR;