diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-04-29 20:19:13 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-04-29 20:19:13 +0000 |
commit | 878abc56f013a9bd94a46bf1a009407e6c8ecceb (patch) | |
tree | d38e11f3cc2cdb3cc9357e9a1bee1f20c724f272 /xpp/utils/zconf/Zaptel/Xpp | |
parent | 47bcd1d6d884db6f92c68772aad712579f1c3b16 (diff) |
xpp rev. 3814:
* Protocol no. 2.6: syncing improvements.
* Support for 8-port Astribank BRI.
* Firmware unloading now works:
rmmod xpp_usb; /etc/hotplug/usb/xpp_fxloader reset
* Defaults of kernel parameters are now part of parameter description.
* World-readable kernel parameters.
* No need for extra patch beyond bristuff for Astribank BRI.
* Default poll intervals changed: 500 in BRI and FXO.
* Allow changing FXS polls interval at run time.
* BRI initalization fixed on SUSE (path to logger).
* When using the SUSE zaptel rpm package, set modules_var=ZAPTEL_MODULES in
/etc/sysconfig/zaptel .
* zt_registration not verbose by default.
* xpp_sync warns if FXO is sync slave.
* Fixed genzaptelconf -z (zapscan output emulation).
* PCM fixes.
* Solves "multiple ticks" bug. No need for pcm_tasklets workaround.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2475 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/zconf/Zaptel/Xpp')
-rw-r--r-- | xpp/utils/zconf/Zaptel/Xpp/Xbus.pm | 36 | ||||
-rw-r--r-- | xpp/utils/zconf/Zaptel/Xpp/Xpd.pm | 31 |
2 files changed, 64 insertions, 3 deletions
diff --git a/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm b/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm index 8d9d340..772e050 100644 --- a/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm +++ b/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm @@ -5,12 +5,15 @@ package Zaptel::Xpp::Xbus; # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # -#use strict; +# $Id$ +# +use strict; use Zaptel::Xpp::Xpd; my $proc_base = "/proc/xpp"; # Accessors (miniperl does not have Class:Accessor) +our $AUTOLOAD; sub AUTOLOAD { my $self = shift; my $name = uc($AUTOLOAD); @@ -27,9 +30,37 @@ sub xpds($) { return @{$xbus->{XPDS}}; } +sub by_number($) { + my $busnumber = shift; + die "Missing xbus number parameter" unless defined $busnumber; + my @xbuses = Zaptel::Xpp::xbuses(); + + my ($xbus) = grep { $_->num == $busnumber } @xbuses; + return $xbus; +} + +sub get_xpd_by_number($$) { + my $xbus = shift; + my $xpdnum = shift; + die "Missing XPD number parameter" unless defined $xpdnum; + my @xpds = $xbus->xpds; + return $xpds[$xpdnum]; +} + sub new($$) { my $pack = shift or die "Wasn't called as a class method\n"; - my $self = { @_ }; + my $self = {}; + while(@_) { + my ($k, $v) = @_; + shift; shift; + # Keys in all caps + $k = uc($k); + # Some values are in all caps as well + if($k =~ /^(STATUS)$/) { + $v = uc($v); + } + $self->{$k} = $v; + } bless $self, $pack; $self->{NAME} or die "Missing xbus name"; my $prefix = "$proc_base/" . $self->{NAME}; @@ -45,6 +76,7 @@ sub new($$) { ); push(@{$self->{XPDS}}, $xpd); } + @{$self->{XPDS}} = sort { $a->num <=> $b->num } @{$self->{XPDS}}; return $self; } diff --git a/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm b/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm index 180b7ea..94176b8 100644 --- a/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm +++ b/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm @@ -5,11 +5,14 @@ package Zaptel::Xpp::Xpd; # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # -#use strict; +# $Id$ +# +use strict; my $proc_base = "/proc/xpp"; # Accessors (miniperl does not have Class:Accessor) +our $AUTOLOAD; sub AUTOLOAD { my $self = shift; my $name = uc($AUTOLOAD); @@ -21,6 +24,32 @@ sub AUTOLOAD { } } +sub blink($$) { + my $self = shift; + my $on = shift; + my $result; + + my $file = "$proc_base/" . $self->fqn . "/blink"; + die "$file is missing" unless -f $file; + # First query + open(F, "$file") or die "Failed to open $file for reading: $!"; + $result = <F>; + chomp $result; + close F; + if(defined($on) and $on ne $result) { # Now change + open(F, ">$file") or die "Failed to open $file for writing: $!"; + print F ($on)?"1":"0"; + if(!close(F)) { + if($! == 17) { # EEXISTS + # good + } else { + undef $result; + } + } + } + return $result; +} + sub zt_registration($$) { my $self = shift; my $on = shift; |