summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UPGRADE.txt10
-rw-r--r--drivers/dahdi/xpp/XppConfig.pm73
-rw-r--r--drivers/dahdi/xpp/card_global.c1
-rw-r--r--drivers/dahdi/xpp/card_pri.c115
-rwxr-xr-xdrivers/dahdi/xpp/init_card_1_3022
-rwxr-xr-xdrivers/dahdi/xpp/init_card_2_3034
-rwxr-xr-xdrivers/dahdi/xpp/init_card_4_30102
-rw-r--r--drivers/dahdi/xpp/xpp.conf17
8 files changed, 132 insertions, 242 deletions
diff --git a/UPGRADE.txt b/UPGRADE.txt
index 5fac438..d5785c7 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -66,6 +66,7 @@ Notes about the dahdi-tools package:
ztspeed -> dahdi_speed
zttest -> dahdi_test
zttool -> dahdi_tool
+ zapconf -> dahdi_genconf (deprecate genzaptelconf)
* The system configuration file has moved from /etc/zaptel.conf to
/etc/dahdi/system.conf.
@@ -73,3 +74,12 @@ Notes about the dahdi-tools package:
* The dahdi_cfg tool can now be used to select an echo canceler on a
channel-by-channel basis in the system configuration file; see
system.conf.sample for examples of how to do this.
+
+* The configuration for XPP init_card_* scripts is done now
+ in /etc/dahdi/xpp.conf and uses a simple syntax (example included).
+ For PRI modules, the 'pri_protocol' setting, determines how
+ to configure it (E1/T1).
+
+* In Astribank PRI modules, the LED behaviour represent which ports
+ are *CLOCK MASTER* (red color) and which are *CLOCK SLAVE* (green color).
+ Usually (but not always), this corresponds to the NT/TE settings in Asterisk.
diff --git a/drivers/dahdi/xpp/XppConfig.pm b/drivers/dahdi/xpp/XppConfig.pm
index 1485a0d..f00811f 100644
--- a/drivers/dahdi/xpp/XppConfig.pm
+++ b/drivers/dahdi/xpp/XppConfig.pm
@@ -11,77 +11,28 @@ use strict;
my $conf_file = "/etc/dahdi/xpp.conf";
-sub subst_var($$) {
- my $lookup = shift;
- my $string = shift;
-
- if(defined $lookup->{$string}) {
- return $lookup->{$string};
- } else {
- return $string;
- }
+sub import {
+ my $pack = shift || die "Import without package?";
+ my $init_dir = shift || die "$pack::import -- missing init_dir parameter";
+ my $local_conf = "$init_dir/xpp.conf";
+ $conf_file = $local_conf if -r $local_conf;
}
sub read_config($) {
- my $input = shift || die;
- my %xpp_config;
- my $lookup = \%xpp_config;
+ my $opts = shift || die;
- open(F, $input) || die "Failed reading configuration $input: $!\n";
-LINE:
+ open(F, $conf_file) || return ();
while(<F>) {
chomp;
s/#.*//; # strip comments
next unless /\S/;
- s/^\s*//;
- if(s/\\$//) {
- my $next = <F>;
- $next =~ s/^\s*//;
- $_ .= " $next";
- redo LINE;
- }
- my ($key, $value) = split(/=/, $_, 2);
- # Trim whitespace around key/value
- $key =~ s/^\s*(\S+)\s*$/$1/;
- $value =~ s/^\s*(\S+)\s*$/$1/;
- # Variable substitution
- my $new_value = $value;
- $new_value =~ s/\$(\w+)/subst_var($lookup,$1)/eg;
- $xpp_config{$key} = $new_value;
+ s/\s*$//; # Trim trailing whitespace
+ my ($key, $value) = split(/\s+/, $_, 2);
+ $opts->{$key} = $value;
}
close F;
- return %xpp_config;
-}
-
-sub import {
- my $pack = shift || die "Import without package?";
- my $init_dir = shift || die "$pack::import -- missing init_dir parameter";
- my $local_conf = "$init_dir/xpp.conf";
- $conf_file = $local_conf if -r $local_conf;
- my %x = read_config($conf_file);
-}
-
-sub show_vars {
- my $assoc = shift;
- foreach (sort keys %{$assoc}) {
- print "$_\t$assoc->{$_}\n";
- }
+ $opts->{'xppconf'} = $conf_file;
+ return %{$opts};
}
-sub source_vars {
- my @keys = @_;
- my %conf = read_config($conf_file);
- my %result;
- my $k;
- my $v;
-
- foreach (@keys) {
- if(defined $conf{$_}) {
- $result{$_} = $conf{$_};
- }
- }
- return ($conf_file, %result);
-}
-
-
1;
diff --git a/drivers/dahdi/xpp/card_global.c b/drivers/dahdi/xpp/card_global.c
index 4bc577f..d233871 100644
--- a/drivers/dahdi/xpp/card_global.c
+++ b/drivers/dahdi/xpp/card_global.c
@@ -795,6 +795,7 @@ int run_initialize_registers(xpd_t *xpd)
snprintf(directionstr, MAX_ENV_STR, "UNIT_SUBUNITS_DIR=%d", direction_mask);
snprintf(revstr, MAX_ENV_STR, "XBUS_REVISION=%d", xbus->revision);
snprintf(connectorstr, MAX_ENV_STR, "XBUS_CONNECTOR=%s", xbus->location);
+ snprintf(connectorstr, MAX_ENV_STR, "XBUS_LABEL=%s", xbus->label);
if(snprintf(init_card, MAX_PATH_STR, "%s/init_card_%d_%d",
initdir, xpd->type, xbus->revision) > MAX_PATH_STR) {
XPD_NOTICE(xpd, "Cannot initialize. pathname is longer than %d characters.\n", MAX_PATH_STR);
diff --git a/drivers/dahdi/xpp/card_pri.c b/drivers/dahdi/xpp/card_pri.c
index 509d83e..551da79 100644
--- a/drivers/dahdi/xpp/card_pri.c
+++ b/drivers/dahdi/xpp/card_pri.c
@@ -100,25 +100,16 @@ static int pri_num_channels(enum pri_protocol pri_protocol)
return num_channels[pri_protocol];
}
-static const char *type_name(enum pri_protocol pri_protocol, bool is_nt)
+static const char *type_name(enum pri_protocol pri_protocol)
{
- static const char *names[2][4] = {
- /* TE */ [0] = {
- [PRI_PROTO_0] = "Unknown_TE",
- [PRI_PROTO_E1] = "E1_TE",
- [PRI_PROTO_T1] = "T1_TE",
- [PRI_PROTO_J1] = "J1_TE"
- },
- /* NT */ [1] = {
- [PRI_PROTO_0] = "Unknown_NT",
- [PRI_PROTO_E1] = "E1_NT",
- [PRI_PROTO_T1] = "T1_NT",
- [PRI_PROTO_J1] = "J1_NT"
- }
- };
- int term = (is_nt) ? 1 : 0;
+ static const char *names[4] = {
+ [PRI_PROTO_0] = "Unknown",
+ [PRI_PROTO_E1] = "E1",
+ [PRI_PROTO_T1] = "T1",
+ [PRI_PROTO_J1] = "J1"
+ };
- return names[term][pri_protocol];
+ return names[pri_protocol];
}
static int pri_linecompat(enum pri_protocol pri_protocol)
@@ -159,10 +150,10 @@ enum pri_led_state {
};
enum pri_led_selectors {
- TE_RED_LED = 0,
- TE_GREEN_LED = 1,
- NT_RED_LED = 2,
- NT_GREEN_LED = 3,
+ BOTTOM_RED_LED = 0,
+ BOTTOM_GREEN_LED = 1,
+ TOP_RED_LED = 2,
+ TOP_GREEN_LED = 3,
};
#define NUM_LEDS 4
@@ -242,7 +233,6 @@ struct pri_leds {
#define REG_CMR1_STF BIT(2)
struct PRI_priv_data {
- bool is_nt;
bool clock_source;
struct proc_dir_entry *pri_info;
enum pri_protocol pri_protocol;
@@ -450,7 +440,7 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
xpd->wanted_pcm_mask = BITMASK(xpd->channels);
priv->deflaw = deflaw;
priv->dchan_num = dchan_num;
- xpd->type_name = type_name(priv->pri_protocol, priv->is_nt);
+ xpd->type_name = type_name(priv->pri_protocol);
XPD_DBG(GENERAL, xpd, "%s, channels=%d, dchan_num=%d, deflaw=%d\n",
pri_protocol_name(set_proto),
xpd->channels,
@@ -509,7 +499,7 @@ static void dahdi_update_syncsrc(xpd_t *xpd)
/*
* Called from:
* - set_master_mode() --
- * As a result of ztcfg or writing to /proc/xpp/XBUS-??/XPD-/??/pri_info
+ * As a result of dahdi_cfg
* - layer1_state() --
* As a result of an alarm.
*/
@@ -568,12 +558,8 @@ static void set_clocking(xpd_t *xpd)
/*
* Normally set by the timing parameter in /etc/dahdi/system.conf
- * If this is called by ztcfg, than it's too late to change
+ * If this is called by dahdi_cfg, than it's too late to change
* dahdi sync priority (we are already registered)
- * There are two workarounds to mitigate this problem:
- * 1. So we set *our* sync master at least.
- * 2. And we try to call it with a sane default from set_nt()
- * which is called before dahdi registration.
*/
static int set_master_mode(const char *msg, xpd_t *xpd)
{
@@ -604,27 +590,6 @@ static int set_master_mode(const char *msg, xpd_t *xpd)
return 0;
}
-static int set_nt(const char *msg, xpd_t *xpd, bool is_nt)
-{
- struct PRI_priv_data *priv;
-
- BUG_ON(!xpd);
- priv = xpd->priv;
- if(SPAN_REGISTERED(xpd)) {
- XPD_NOTICE(xpd, "Registered as span %d. Cannot do %s(%s)\n",
- xpd->span.spanno, __FUNCTION__, msg);
- return -EBUSY;
- }
- priv->is_nt = is_nt;
- xpd->type_name = type_name(priv->pri_protocol, is_nt);
- xpd->direction = (is_nt) ? TO_PHONE : TO_PSTN;
- XPD_DBG(SIGNAL, xpd, "%s(%s): %s %s\n", __FUNCTION__, msg, xpd->type_name, (is_nt) ? "NT" : "TE");
- if(xpd->timing_priority == 0 && !is_nt) /* by default set timing priority from NT/TE */
- xpd->timing_priority = 1;
- set_master_mode(msg, xpd);
- return 0;
-}
-
static int set_localloop(const char *msg, xpd_t *xpd, bool localloop)
{
struct PRI_priv_data *priv;
@@ -639,7 +604,7 @@ static int set_localloop(const char *msg, xpd_t *xpd, bool localloop)
return -EBUSY;
}
lim0 |= (localloop) ? REG_LIM0_LL : 0;
- if(priv->is_nt)
+ if(priv->clock_source)
lim0 |= REG_LIM0_MAS;
else
lim0 &= ~REG_LIM0_MAS;
@@ -760,7 +725,7 @@ static int pri_lineconfig(xpd_t *xpd, int lineconfig)
fmr2 |= REG_FMR2_E_RFS1;
}
XPD_DBG(GENERAL, xpd, "[%s] lineconfig=%s/%s/%s %s (0x%X)\n",
- (priv->is_nt)?"NT":"TE",
+ (priv->clock_source)?"MASTER":"SLAVE",
framingstr, codingstr, crcstr,
(lineconfig & DAHDI_CONFIG_NOTOPEN)?"YELLOW":"",
lineconfig);
@@ -796,11 +761,11 @@ static int pri_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
return -EINVAL;
}
/*
- * FIXME: lc->name is unused by ztcfg and dahdi...
+ * FIXME: lc->name is unused by dahdi_cfg and dahdi...
* We currently ignore it also.
*/
XPD_DBG(GENERAL, xpd, "[%s] lbo=%d lineconfig=0x%X sync=%d\n",
- (priv->is_nt)?"NT":"TE", lc->lbo, lc->lineconfig, lc->sync);
+ (priv->clock_source)?"MASTER":"SLAVE", lc->lbo, lc->lineconfig, lc->sync);
ret = pri_lineconfig(xpd, lc->lineconfig);
if(!ret) {
span->lineconfig = lc->lineconfig;
@@ -837,10 +802,9 @@ static xpd_t *PRI_card_new(xbus_t *xbus, int unit, int subunit, const xproto_tab
if(!xpd)
return NULL;
priv = xpd->priv;
- priv->pri_protocol = PRI_PROTO_0; /* Default, changes in set_pri_proto() */
+ priv->pri_protocol = PRI_PROTO_0; /* Default, changes in set_pri_proto() */
priv->deflaw = DAHDI_LAW_DEFAULT; /* Default, changes in set_pri_proto() */
- xpd->type_name =
- type_name(priv->pri_protocol, 0); /* Default, changes in set_nt() */
+ xpd->type_name = type_name(priv->pri_protocol);
if(xpd_common_init(xbus, xpd, unit, subunit, subtype, subunits) < 0)
goto err;
if(pri_proc_create(xbus, xpd) < 0)
@@ -862,7 +826,6 @@ static int PRI_card_init(xbus_t *xbus, xpd_t *xpd)
xproto_table_t *proto_table;
BUG_ON(!xpd);
- XPD_DBG(GENERAL, xpd, "\n");
xpd->type = XPD_TYPE_PRI;
proto_table = &PROTO_TABLE(PRI);
priv = xpd->priv;
@@ -874,6 +837,11 @@ static int PRI_card_init(xbus_t *xbus, xpd_t *xpd)
XPD_NOTICE(xpd, "PRI protocol not set\n");
goto err;
}
+ xpd->type_name = type_name(priv->pri_protocol);
+ xpd->direction = TO_PSTN;
+ XPD_DBG(DEVICES, xpd, "%s\n", xpd->type_name);
+ xpd->timing_priority = 1; /* SLAVE */
+ set_master_mode(__FUNCTION__, xpd);
for(ret = 0; ret < NUM_LEDS; ret++) {
DO_LED(xpd, ret, PRI_LED_ON);
msleep(20);
@@ -1002,7 +970,7 @@ static void dchan_state(xpd_t *xpd, bool up)
/*
* LED managment is done by the driver now:
- * - Turn constant ON RED/GREEN led to indicate NT/TE port
+ * - Turn constant ON RED/GREEN led to indicate MASTER/SLAVE port
* - Very fast "Double Blink" to indicate Layer1 alive (without D-Channel)
* - Constant blink (1/2 sec cycle) to indicate D-Channel alive.
*/
@@ -1018,12 +986,12 @@ static void handle_leds(xbus_t *xbus, xpd_t *xpd)
BUG_ON(!xpd);
priv = xpd->priv;
BUG_ON(!priv);
- if(priv->is_nt) {
- which_led = NT_RED_LED;
- other_led = TE_GREEN_LED;
+ if(xpd->timing_priority == 0) {
+ which_led = TOP_RED_LED;
+ other_led = BOTTOM_GREEN_LED;
} else {
- which_led = TE_GREEN_LED;
- other_led = NT_RED_LED;
+ which_led = BOTTOM_GREEN_LED;
+ other_led = TOP_RED_LED;
}
ledstate = priv->ledstate[which_led];
timer_count = xpd->timer_count;
@@ -1455,11 +1423,10 @@ static xproto_table_t PROTO_TABLE(PRI) = {
static bool pri_packet_is_valid(xpacket_t *pack)
{
- const xproto_entry_t *xe_nt = NULL;
- const xproto_entry_t *xe_te = NULL;
+ const xproto_entry_t *xe = NULL;
// DBG(GENERAL, "\n");
- xe_nt = xproto_card_entry(&PROTO_TABLE(PRI), XPACKET_OP(pack));
- return xe_nt != NULL || xe_te != NULL;
+ xe = xproto_card_entry(&PROTO_TABLE(PRI), XPACKET_OP(pack));
+ return xe != NULL;
}
static void pri_packet_dump(const char *msg, xpacket_t *pack)
@@ -1478,8 +1445,6 @@ static int proc_pri_info_write(struct file *file, const char __user *buffer, uns
int ret = 0;
bool got_localloop = 0;
bool got_nolocalloop = 0;
- bool got_te = 0;
- bool got_nt = 0;
bool got_e1 = 0;
bool got_t1 = 0;
bool got_j1 = 0;
@@ -1509,10 +1474,6 @@ static int proc_pri_info_write(struct file *file, const char __user *buffer, uns
got_localloop = 1;
else if(strnicmp(tok, "NOLOCALLOOP", 8) == 0)
got_nolocalloop = 1;
- else if(strnicmp(tok, "NT", 2) == 0)
- got_nt = 1;
- else if(strnicmp(tok, "TE", 2) == 0)
- got_te = 1;
else if(strnicmp(tok, "E1", 2) == 0)
got_e1 = 1;
else if(strnicmp(tok, "T1", 2) == 0)
@@ -1539,10 +1500,6 @@ static int proc_pri_info_write(struct file *file, const char __user *buffer, uns
ret = set_localloop(msg, xpd, 1);
if(got_nolocalloop)
ret = set_localloop(msg, xpd, 0);
- if(got_nt)
- ret = set_nt(msg, xpd, 1);
- if(got_te)
- ret = set_nt(msg, xpd, 0);
return (ret) ? ret : count;
}
@@ -1562,7 +1519,7 @@ static int proc_pri_info_read(char *page, char **start, off_t off, int count, in
priv = xpd->priv;
BUG_ON(!priv);
len += sprintf(page + len, "PRI: %s %s%s (deflaw=%d, dchan=%d)\n",
- (priv->is_nt) ? "NT" : "TE",
+ (priv->clock_source) ? "MASTER" : "SLAVE",
pri_protocol_name(priv->pri_protocol),
(priv->local_loopback) ? " LOCALLOOP" : "",
priv->deflaw, priv->dchan_num);
diff --git a/drivers/dahdi/xpp/init_card_1_30 b/drivers/dahdi/xpp/init_card_1_30
index f8c7fd5..4075715 100755
--- a/drivers/dahdi/xpp/init_card_1_30
+++ b/drivers/dahdi/xpp/init_card_1_30
@@ -52,8 +52,9 @@ $ENV{XPP_BASE} = '/proc/xpp';
getopts('o:', \%opts);
-my $debug;
-my $skip_calib;
+my %settings;
+$settings{debug} = 0;
+$settings{fxs_skip_calib} = 0;
my $xpd_name = sprintf("XPD-%1d0", $ENV{UNIT_NUMBER});
my $chipregs = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/chipregs";
@@ -63,7 +64,7 @@ sub logit {
}
sub debug {
- logit @_ if $debug;
+ logit @_ if $settings{debug};
}
# Arrange for error logging
@@ -372,14 +373,11 @@ sub calibrate_slics() {
}
sub read_defaults() {
- # Source default files
- my $var_debug = 'DEBUG_INIT_FXS';
- my $var_skip_calib = 'INIT_FXS_SKIP_CALIB';
- my ($default_file, %source_defaults) =
- XppConfig::source_vars($var_debug, $var_skip_calib);
- $debug = $source_defaults{$var_debug};
- $skip_calib = $source_defaults{$var_skip_calib};
- main::logit "From $default_file: $var_debug=$debug $var_skip_calib=$skip_calib";
+ if(XppConfig::read_config(\%settings)) {
+ main::logit "Defaults from $settings{xppconf}";
+ } else {
+ main::logit "No defaults file, use hard-coded defaults.";
+ }
}
package main;
@@ -392,7 +390,7 @@ FXS::init_indirect_registers();
main::debug "after init_indirect_registers";
FXS::init_early_direct_regs();
main::debug "after init_early_direct_regs";
-if($skip_calib) {
+if($settings{fxs_skip_calib}) {
main::logit "==== WARNING: SKIPPED SLIC CALIBRATION =====";
} else {
FXS::calibrate_slics;
diff --git a/drivers/dahdi/xpp/init_card_2_30 b/drivers/dahdi/xpp/init_card_2_30
index b0a7555..bda0792 100755
--- a/drivers/dahdi/xpp/init_card_2_30
+++ b/drivers/dahdi/xpp/init_card_2_30
@@ -52,7 +52,8 @@ $ENV{XPP_BASE} = '/proc/xpp';
getopts('o:v:', \%opts);
-my $debug;
+my %settings;
+$settings{debug} = 0;
my $xpd_name;
my $chipregs;
@@ -62,7 +63,7 @@ sub logit {
}
sub debug {
- logit @_ if $debug;
+ logit @_ if $settings{debug};
}
# Arrange for error logging
@@ -310,23 +311,22 @@ sub opermode_verify($) {
}
sub read_defaults() {
- # Source default files
- my $var_debug = 'DEBUG_INIT_FXO';
- my $var_opermode = 'opermode';
- my ($default_file, %source_defaults) =
- XppConfig::source_vars($var_debug, $var_opermode);
- $debug = $source_defaults{$var_debug};
- my $tmp_opermode = $source_defaults{$var_opermode};
- if(defined($tmp_opermode) and $tmp_opermode) {
- # Verify
- my $mode = $opermode_table{$tmp_opermode};
- if(! defined $mode) {
- main::logit "Unknown opermode='$tmp_opermode'";
- die;
+ if(XppConfig::read_config(\%settings)) {
+ main::logit "Defaults from $settings{xppconf}";
+ my $o = $settings{opermode};
+ if(defined($o)) {
+ # Verify
+ my $mode = $opermode_table{$o};
+ if(! defined $mode) {
+ main::logit "Unknown opermode='$o'";
+ die;
+ }
+ $OPERMODE = $o;
+ main::logit "Set OPERMODE = $o";
}
- $OPERMODE = $tmp_opermode;
+ } else {
+ main::logit "No defaults file, use hard-coded defaults.";
}
- main::logit "From $default_file: $var_debug=$debug $var_opermode=$tmp_opermode";
}
package main;
diff --git a/drivers/dahdi/xpp/init_card_4_30 b/drivers/dahdi/xpp/init_card_4_30
index 0d0ae2b..e79a0dd 100755
--- a/drivers/dahdi/xpp/init_card_4_30
+++ b/drivers/dahdi/xpp/init_card_4_30
@@ -33,6 +33,7 @@ use strict;
# 4 - PRI
# XBUS_REVISION - xbus revision number
# XBUS_CONNECTOR - xbus connector string
+# XBUS_LABEL - xbus label string
#
# Output data format:
# - An optional comment start with ';' or '#' until the end of line
@@ -59,10 +60,11 @@ use XppConfig $init_dir;
my $unit_id;
my %opts;
$ENV{XPP_BASE} = '/proc/xpp';
-my @pri_specs;
getopts('o:', \%opts);
+my %settings;
+
sub logit {
print STDERR "$unit_id: @_\n";
}
@@ -142,24 +144,12 @@ sub finish_quad() {
PRI::gen "0 WD 83 9B"; # PC4 (Port configuration 4): RPD_1.GPI (nConfig1), XPD_1.GPOL (MUX_SEL2)
}
-sub read_pri_specs() {
- # For lab tests
- my $labfile = "${0}.setup";
-
- # Source default files
- $ENV{ZAPTEL_DEFAULTS} = "$labfile" if -r "$labfile";
- my $setup_var = 'XPP_PRI_SETUP';
- my $setup_string;
- my ($default_file, %source_defaults) =
- XppConfig::source_vars($setup_var);
- $setup_string = $source_defaults{$setup_var};
- $setup_string =~ s/^\s+//; # trim
- $setup_string =~ s/\s+$//; # trim
- $setup_string =~ s/\s+/\n/g; # cannonical spaces
- #main::logit "From $default_file: $setup_var=\n$setup_string";
- @pri_specs = split(/\s+/, $setup_string);
- push(@pri_specs, 'NUM/*=TE,E1'); # Fall back default (last)
- main::logit "pri_specs: @pri_specs";
+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 PRI::Port;
@@ -168,57 +158,46 @@ sub new {
my $pack = shift;
my $port = { @_ };
bless $port, $pack;
- $port->process_pri_spec;
return $port;
}
-sub write_pri_info {
+sub get_pri_protocol {
my $port = shift;
my $subunit = $port->{PORT_NUM};
- my @pri_setup = @{$port->{PRI_SETUP}};
- my $pri_type = $pri_setup[0] || die "Missing pri_type parameter";
- my $pri_proto = $pri_setup[1] || die "Missing pri_proto parameter";
my $xpd_name = "XPD-$ENV{UNIT_NUMBER}$subunit";
- my $info = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/pri_info";
-
- main::logit "$xpd_name: PRI_SETUP $pri_type $pri_proto";
- open(INFO, ">$info") || die "Failed to open '$info': $!\n";
- print INFO "$pri_type $pri_proto\n" || die "Failed writing to '$info': $!\n";
- close INFO || die "Failed during close of '$info': $!\n";
+ my $pri_protocol;
+ my @keys = (
+ "pri_protocol/connector:$ENV{XBUS_CONNECTOR}/$xpd_name",
+ "pri_protocol/label:$ENV{XBUS_LABEL}/$xpd_name",
+ "pri_protocol/$ENV{XBUS_NAME}/$xpd_name",
+ "pri_protocol"
+ );
+ foreach my $k (@keys) {
+ $k = lc($k); # Lowercase
+ $pri_protocol = $settings{$k};
+ if(defined $pri_protocol) {
+ $port->{pri_protocol} = $pri_protocol;
+ return $pri_protocol;
+ }
+ }
+ return undef;
}
-sub process_pri_spec($) {
+sub write_pri_info {
my $port = shift;
my $subunit = $port->{PORT_NUM};
my $xpd_name = "XPD-$ENV{UNIT_NUMBER}$subunit";
- my $match;
- my $setup;
- my @pri_setup;
-SPEC:
- for(my $i = 0; $i < @pri_specs; $i++) {
- my $spec = $pri_specs[$i];
- ($match, $setup) = split(/=/, $spec);
- next unless defined $match and defined $setup;
- # Convert "globs" to regex
- $match =~ s/\*/.*/g;
- $match =~ s/\?/./g;
- #logit "match: $match";
- my @patlist = (
- "CONNECTOR/$ENV{XBUS_CONNECTOR}/$xpd_name",
- "NUM/$ENV{XBUS_NAME}/$xpd_name"
- );
- foreach my $pattern (@patlist) {
- #logit "testmatch: $pattern =~ $match";
- if($pattern =~ $match) {
- main::logit "$xpd_name: MATCH '$pattern' ~ '$match' setup=$setup";
- last SPEC;
- }
- }
+ my $info = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/pri_info";
+ my $pri_protocol = $port->get_pri_protocol;
+
+ if(defined $pri_protocol) {
+ main::logit "$xpd_name: pri_protocol $pri_protocol";
+ open(INFO, ">$info") || die "Failed to open '$info': $!\n";
+ print INFO "$pri_protocol\n" || die "Failed writing '$pri_protocol' to '$info': $!\n";
+ close INFO || die "Failed during close of '$info': $!\n";
+ } else {
+ main::logit "$xpd_name: Skip setting pri protocol -- non given";
}
- die "No setup matching $ENV{XBUS_NAME}/$xpd_name\n" unless defined $setup;
- @pri_setup = split(/,/, $setup);
- die "Bad setup string '$setup'\n" unless @pri_setup;
- $port->{'PRI_SETUP'} = \@pri_setup;
}
sub port_setup($) {
@@ -349,7 +328,7 @@ package main;
logit "Starting '$0'";
-PRI::read_pri_specs;
+PRI::read_defaults;
sub main() {
my @ports;
@@ -359,12 +338,9 @@ sub main() {
PRI::init_quad;
# Must initialize all 4 ports, regardless how much there are
for($subunit = 0; $subunit < 4; $subunit++) {
- my $is_nt = 0;
-
- #logit "main(): Initializing subunit $subunit is_nt=$is_nt";
+ #logit "main(): Initializing subunit $subunit";
my $p = PRI::Port->new(
'PORT_NUM' => $subunit,
- 'PRI_NT' => $is_nt,
'EXIST' => ($subunit < $ENV{UNIT_SUBUNITS})
);
$p->port_setup;
diff --git a/drivers/dahdi/xpp/xpp.conf b/drivers/dahdi/xpp/xpp.conf
index daa0d82..700decd 100644
--- a/drivers/dahdi/xpp/xpp.conf
+++ b/drivers/dahdi/xpp/xpp.conf
@@ -4,15 +4,12 @@
# of init_card_* initialization scripts.
#
-#INIT_FXS_SKIP_CALIB=1
-DEBUG_INIT_FXS=0
-DEBUG_INIT_FXO=0
+fxs_skip_calib 0
+debug 0
-opermode=ISRAEL
+opermode ISRAEL
-#TYPE=T1
-TYPE = E1
-
-XPP_PRI_SETUP = \
- NUM/*/XPD-0[02]=TE,$TYPE \
- NUM/*/XPD-0[13]=NT,$TYPE
+pri_protocol E1
+#pri_protocol/xbus-00/xpd-02 T1
+#pri_protocol/connector:usb-0000:00:1d.7-7/xpd-03 T1
+#pri_protocol/label:usb:0000183/xpd-03 T1