diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2009-05-27 10:01:24 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2009-05-27 10:01:24 +0000 |
commit | 18c6813f2c788b603dab363b9138d65d24252167 (patch) | |
tree | 92402484268f2bc1d5e4e55f7321b9204ad47c5f /kernel/xpp/utils/zconf/Zaptel/Xpp.pm | |
parent | 2a73224819e867eaf56371d6055e2ca4d36396b6 (diff) |
Big dump of newer xpp code.
For finer details and separate commits, you are advised to look into the
commit log of dahdi-{linux,tools}.
xpp.r7150
* 116x Astribanks:
- Support for the TwinStar capability and for FXO and (BRI|PRI) on
same device.
- New control protocol ("MPP").
- astribank_hextool - a low-level firmware loading tool instead of
fpga_load .
- astribank_tool - Other MPP activities .
- Can still reset (but just that) through older protocol.
- astribank_hexload is required for loading FPGA firmware for USB_FW.hex
rev > 6885.
- USB_FW rev. 7071 .
- More modular FPGA firmware (1161 only).
- FPGA_1161.hex rev. 7131. PIC_TYPE_* rev. 7107.
- software-settings of some capabilities with astribank_allow .
* XPP:
- init_card_* script are less verbose.
- Reduced rate of "Is a DAHDI sync master" message.
- Replace member bus_id with dev_name() and set_dev_name() for
building with 2.6.30.
- Conditionally remove 'owner' property of procfs was dropped in 2.6.30.
- astribank_hook now enabled by default.
- Has an optional hook for TwinStar.
* BRI:
- hardhdlc support: The bri_dchan patch is no longer needed.
- If bri_dchan patch applied: old code is used, and "dchan" is used.
- If not: new code and "hardhdlc" is used.
- zapconf will generate the right configuration, depending on the new
sysfs driver attribute bri_hardhdlc, but default to "dchan" as
before if not explicitly told.
- Bugfix: explicitly turn off leds on startup.
* FXS:
- Initialization and calibration fixes.
- Notify the user just one about wrong VMWI config
* Dahdi-perl:
- Fix detection of empty slots in wctdm.
- Fix working with ethmf's extra file in /proc/zaptel
- Improved detection of Rhino cards.
- dahdi_genconf's generated text better explains files are generated.
- /etc/xpp_order - allow specifiying an explicit order for
Astribanks to register with Zaptel.
- Dahdi::Xpp::Mpp - A wrapper around astribank_tool .
* dahdi.init:
- A separate waitfor_xpds script. May now have a wait-loop in
some cases.
- xpp_sync needs to only be called after dahdi_cfg .
(for the PRI module).
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4641 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/xpp/utils/zconf/Zaptel/Xpp.pm')
-rw-r--r-- | kernel/xpp/utils/zconf/Zaptel/Xpp.pm | 93 |
1 files changed, 82 insertions, 11 deletions
diff --git a/kernel/xpp/utils/zconf/Zaptel/Xpp.pm b/kernel/xpp/utils/zconf/Zaptel/Xpp.pm index b626bfa..8473b79 100644 --- a/kernel/xpp/utils/zconf/Zaptel/Xpp.pm +++ b/kernel/xpp/utils/zconf/Zaptel/Xpp.pm @@ -8,6 +8,7 @@ package Zaptel::Xpp; # $Id$ # use strict; +use Zaptel::Hardware; use Zaptel::Xpp::Xbus; =head1 NAME @@ -28,12 +29,29 @@ Zaptel::Xpp - Perl interface to the Xorcom Astribank drivers. } =cut +# +# A global handle for all xbuses +# +my @xbuses; my $proc_base = "/proc/xpp"; our $sysfs_astribanks = "/sys/bus/astribanks/devices"; our $sysfs_xpds = "/sys/bus/xpds/devices"; our $sysfs_ab_driver = "/sys/bus/astribanks/drivers/xppdrv"; +sub scan($) { + my $pack = shift || die; + + opendir(D, $sysfs_astribanks) || return(); + while(my $entry = readdir D) { + next unless $entry =~ /xbus-(\d+)/; + my $xbus = Zaptel::Xpp::Xbus->new($1); + push(@xbuses, $xbus); + } + closedir D; + return @xbuses; +} + # Nominal sorters for xbuses sub by_name { return $a->name cmp $b->name; @@ -72,6 +90,11 @@ sub by_type { return $res; } +sub by_xpporder { + my $cmp = $a->xpporder cmp $b->xpporder; + return $cmp if $cmp != 0; + return $a->connector cmp $b->connector; +} =head1 xbuses([sort_order]) @@ -91,6 +114,19 @@ The built in sorters are: =over +=item SORT_XPPORDER + +Sort by ordering defined in F</etc/xpp_order> file. +Astribanks can be listed in this file by their label or by +their connector string (prefixed with <@>). + +Astribanks not listed in the F<xpp_order> file are sorted +via ordering number 999 -- So they come after the Astribanks +that are listed. + +Astribanks with same ordering number (e.g: 999) are sorted +by their connector string (to preserve legacy behaviour). + =item SORT_CONNECTOR Sort by the connector string. For USB this defines the "path" to get to @@ -129,38 +165,73 @@ sub sorters { SORT_NAME => \&by_name, SORT_LABEL => \&by_label, SORT_TYPE => \&by_type, + SORT_XPPORDER => \&by_xpporder, # Aliases connector => \&by_connector, name => \&by_name, label => \&by_label, type => \&by_type, + xpporder => \&by_xpporder, ); my $which_sorter = shift || return sort keys %sorter_table; return $which_sorter if ref($which_sorter) eq 'CODE'; return $sorter_table{$which_sorter}; } +sub add_xpporder(@) { + my @xbuses = @_; + my $cfg = $ENV{XPPORDER_CONF} || '/etc/xpp_order'; + my %order; + + # Set defaults + foreach my $xbus (@xbuses) { + $xbus->{XPPORDER} = 99; + } + # Read from optional config file + if(!open(F, $cfg)) { + warn "$0: Failed opening '$cfg': $!" + unless $! == 2; # ENOENT + return; + } + my $count = 1; + while(<F>) { + chomp; + s/#.*//; + s/^\s*//; + s/\s*$//; + next unless /\S/; + $order{$_} = $count++; + } + close F; + # Overrides from config file + foreach my $xbus (@xbuses) { + my $label = $xbus->label; + my $connector = '@' . $xbus->connector; + my $val; + $val = $order{$label}; + $val = $order{$connector} unless defined $val; + $xbus->{XPPORDER} = $val if defined $val; + } +} + sub xbuses { - my $optsort = shift || 'SORT_CONNECTOR'; - my @xbuses; + my $optsort = shift || 'SORT_XPPORDER'; + my @sorted_xbuses; - opendir(D, $sysfs_astribanks) || return(); - while(my $entry = readdir D) { - next unless $entry =~ /xbus-(\d+)/; - my $xbus = Zaptel::Xpp::Xbus->new($1); - push(@xbuses, $xbus); + if(! @xbuses) { + @xbuses = Zaptel::Xpp->scan(); } - closedir D; + add_xpporder(@xbuses); my $sorter = sorters($optsort); die "Unknown optional sorter '$optsort'" unless defined $sorter; - @xbuses = sort $sorter @xbuses; - return @xbuses; + @sorted_xbuses = sort $sorter @xbuses; + return @sorted_xbuses; } sub xpd_of_span($) { my $span = shift or die "Missing span parameter"; return undef unless defined $span; - foreach my $xbus (Zaptel::Xpp::xbuses('SORT_CONNECTOR')) { + foreach my $xbus (Zaptel::Xpp::xbuses) { foreach my $xpd ($xbus->xpds()) { return $xpd if $xpd->fqn eq $span->name; } |