diff options
Diffstat (limited to 'xpp/perl_modules/Dahdi/Xpp')
-rw-r--r-- | xpp/perl_modules/Dahdi/Xpp/Line.pm | 36 | ||||
-rw-r--r-- | xpp/perl_modules/Dahdi/Xpp/Xbus.pm | 35 | ||||
-rw-r--r-- | xpp/perl_modules/Dahdi/Xpp/Xpd.pm | 66 |
3 files changed, 10 insertions, 127 deletions
diff --git a/xpp/perl_modules/Dahdi/Xpp/Line.pm b/xpp/perl_modules/Dahdi/Xpp/Line.pm index 1302a9e..bb0ec27 100644 --- a/xpp/perl_modules/Dahdi/Xpp/Line.pm +++ b/xpp/perl_modules/Dahdi/Xpp/Line.pm @@ -42,7 +42,6 @@ sub blink($$) { sub create_all($$) { my $pack = shift or die "Wasn't called as a class method\n"; my $xpd = shift || die; - my $procdir = shift || die; local $/ = "\n"; my @lines; for(my $i = 0; $i < $xpd->{CHANNELS}; $i++) { @@ -52,37 +51,14 @@ sub create_all($$) { $xpd->{LINES} = \@lines; if($xpd->type eq 'FXO') { my $battery = $xpd->xpd_getattr("fxo_battery"); - if(defined $battery) { - my @batt = split(/\s+/, $battery); - foreach my $l (@lines) { - die unless @batt; - my $state = shift @batt; - $l->{BATTERY} = ($state eq '+') ? 1 : 0; - } - } else { - # Fallback to old interface - my ($infofile) = glob "$procdir/*_info"; - die "Failed globbing '$procdir/*_info'" unless defined $infofile; - open(F, "$infofile") || die "Failed opening '$infofile': $!"; - my $battery_info = 0; - while (<F>) { - chomp; - $battery_info = 1 if /^Battery:/; - if($battery_info && s/^\s*on\s*:\s*//) { - my @batt = split; - foreach my $l (@lines) { - die unless @batt; - my $state = shift @batt; - $l->{BATTERY} = ($state eq '+') ? 1 : 0; - } - $battery_info = 0; - die if @batt; - } - } - close F; + die "Missing '$battery' attribute\n" unless defined $battery; + my @batt = split(/\s+/, $battery); + foreach my $l (@lines) { + die unless @batt; + my $state = shift @batt; + $l->{BATTERY} = ($state eq '+') ? 1 : 0; } } - close F; } diff --git a/xpp/perl_modules/Dahdi/Xpp/Xbus.pm b/xpp/perl_modules/Dahdi/Xpp/Xbus.pm index b68d7cc..dbfab00 100644 --- a/xpp/perl_modules/Dahdi/Xpp/Xbus.pm +++ b/xpp/perl_modules/Dahdi/Xpp/Xbus.pm @@ -51,12 +51,6 @@ sub xbus_attr_path($$) { my ($busnum, @attr) = @_; foreach my $attr (@attr) { my $file = sprintf "$Dahdi::Xpp::sysfs_astribanks/xbus-%02d/$attr", $busnum; - unless(-f $file) { - my $procfile = sprintf "$Dahdi::proc_xpp_base/XBUS-%02d/$attr", $busnum; - warn "$0: warning - OLD DRIVER: missing '$file'. Fall back to '$procfile'\n" - unless $file_warned{$attr}++; - $file = $procfile; - } next unless -f $file; return $file; } @@ -109,21 +103,6 @@ sub transport_type($$) { return $xbus->{TRANSPORT_TYPE}; } -sub read_xpdnames_old($) { - my $xbus_num = shift || die; - my $pat = sprintf "$Dahdi::proc_xpp_base/XBUS-%02d/XPD-[0-9][0-9]", $xbus_num; - my @xpdnames; - - #print STDERR "read_xpdnames_old($xbus_num): $pat\n"; - foreach (glob $pat) { - die "Bad /proc entry: '$_'" unless /^.*XPD-([0-9])([0-9])$/; - my $name = sprintf("%02d:%1d:%1d", $xbus_num, $1, $2); - #print STDERR "\t> $_ ($name)\n"; - push(@xpdnames, $name); - } - return @xpdnames; -} - sub read_xpdnames($) { my $xbus_num = shift || die; my $xbus_dir = "$Dahdi::Xpp::sysfs_astribanks/xbus-$xbus_num"; @@ -141,8 +120,6 @@ sub read_xpdnames($) { return @xpdnames; } -my $warned_notransport = 0; - sub new($$) { my $pack = shift or die "Wasn't called as a class method\n"; my $num = shift; @@ -164,17 +141,11 @@ sub new($$) { } my @xpdnames; my @xpds; - if(-e $transport) { - @xpdnames = read_xpdnames($num); - } else { - @xpdnames = read_xpdnames_old($num); - warn "$0: warning - OLD DRIVER: missing '$transport'. Fall back to /proc\n" - unless $warned_notransport++; - } + die "OLD DRIVER: missing '$transport'\n" unless -e $transport; + @xpdnames = read_xpdnames($num); foreach my $xpdstr (@xpdnames) { my ($busnum, $unit, $subunit) = split(/:/, $xpdstr); - my $procdir = "$Dahdi::proc_xpp_base/XBUS-$busnum/XPD-$unit$subunit"; - my $xpd = Dahdi::Xpp::Xpd->new($self, $unit, $subunit, $procdir, "$xbus_dir/$xpdstr"); + my $xpd = Dahdi::Xpp::Xpd->new($self, $unit, $subunit, "$xbus_dir/$xpdstr"); push(@xpds, $xpd); } @{$self->{XPDS}} = sort { $a->id <=> $b->id } @xpds; diff --git a/xpp/perl_modules/Dahdi/Xpp/Xpd.pm b/xpp/perl_modules/Dahdi/Xpp/Xpd.pm index 197d969..7edfc58 100644 --- a/xpp/perl_modules/Dahdi/Xpp/Xpd.pm +++ b/xpp/perl_modules/Dahdi/Xpp/Xpd.pm @@ -52,11 +52,6 @@ Applicable only to digital (BRI/PRI) modules and always 0 for others. Textual name: E.g. C<XPD-10>. -=head1 dir - -The ProcFS directory with information about the XPD. e.g. -C</proc/xpp/XBUS-00/XPD-10>. - =head1 sysfs_dir The SysFS directory with information about the module. E.g. @@ -112,65 +107,12 @@ sub xpd_attr_path($@) { foreach my $attr (@attr) { my $file = sprintf "$Dahdi::Xpp::sysfs_xpds/%02d:%1d:%1d/$attr", $busnum, $unitnum, $subunitnum; - unless(-f $file) { - my $procfile = sprintf "/proc/xpp/XBUS-%02d/XPD-%1d%1d/$attr", - $busnum, $unitnum, $subunitnum; - warn "$0: warning - OLD DRIVER: missing '$file'. Fall back to /proc\n" - unless $file_warned{$attr}++; - $file = $procfile; - } next unless -f $file; return $file; } return undef; } -# Backward compat plug for old /proc interface... -sub xpd_old_gettype($) { - my $xpd = shift || die; - my $summary = "/proc/xpp/" . $xpd->fqn . "/summary"; - open(F, $summary) or die "Failed to open '$summary': $!"; - my $head = <F>; - close F; - chomp $head; - $head =~ s/^XPD-\d+\s+\(//; - $head =~ s/,.*//; - return $head; -} - -sub xpd_old_getspan($) { - my $xpd = shift || die; - my $dahdi_registration = "/proc/xpp/" . $xpd->fqn . "/dahdi_registration"; - open(F, $dahdi_registration) or die "Failed to open '$dahdi_registration': $!"; - my $head = <F>; - close F; - chomp $head; - return $head; -} - -sub xpd_old_getoffhook($) { - my $xpd = shift || die; - my $summary = "/proc/xpp/" . $xpd->fqn . "/summary"; - my $channels; - - local $/ = "\n"; - open(F, "$summary") || die "Failed opening $summary: $!\n"; - my $head = <F>; - chomp $head; # "XPD-00 (BRI_TE ,card present, span 3)" - my $offhook; - while(<F>) { - chomp; - if(s/^\s*offhook\s*:\s*//) { - s/\s*$//; - $offhook = $_; - $offhook || die "No channels in '$summary'"; - last; - } - } - close F; - return $offhook; -} - my %attr_missing_warned; # Prevent duplicate warnings sub xpd_driver_getattr($$) { @@ -198,10 +140,6 @@ sub xpd_getattr($$) { $attr = lc($attr); my $file = $xpd->xpd_attr_path(lc($attr)); - # Handle special cases for backward compat - return xpd_old_gettype($xpd) if $attr eq 'type' and !defined $file; - return xpd_old_getspan($xpd) if $attr eq 'span' and !defined $file; - return xpd_old_getoffhook($xpd) if $attr eq 'offhook' and !defined $file; if(!defined($file)) { warn "$0: xpd_getattr($attr) -- Missing attribute.\n" if $attr_missing_warned{$attr}; @@ -284,7 +222,6 @@ sub new($$$$$) { my $xbus = shift || die; my $unit = shift; # May be zero my $subunit = shift; # May be zero - my $procdir = shift || die; my $sysfsdir = shift || die; my $self = { XBUS => $xbus, @@ -292,7 +229,6 @@ sub new($$$$$) { FQN => $xbus->name . "/" . "XPD-$unit$subunit", UNIT => $unit, SUBUNIT => $subunit, - DIR => $procdir, SYSFS_DIR => $sysfsdir, }; bless $self, $pack; @@ -319,7 +255,7 @@ sub new($$$$$) { } } $self->{IS_DIGITAL} = ( $self->{IS_BRI} || $self->{IS_PRI} ); - Dahdi::Xpp::Line->create_all($self, $procdir); + Dahdi::Xpp::Line->create_all($self); return $self; } |