From ee0e06c99e2cf44c23984e84b592ff82af68b19b Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 2 Mar 2010 18:07:37 +0000 Subject: DAHDI-perl: allow setting base of system files with DAHDI_VIRT_TOP If the user set DAHDI_VIRT_TOP in the environment, consider it as a path under which to look for ProcFS and SysFS files. This allows running the DAHDI-perl tools on filesystem dumps generated by build_tools/dump_sys_state . To reduce the number of dependencies between various modules, the 'xpd' member of a Dahdi::Span is removed. Dahdi::Xpp::xpd_of_span() can be used if needed. git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@8215 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- xpp/perl_modules/Dahdi/Xpp/Xbus.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'xpp/perl_modules/Dahdi/Xpp') diff --git a/xpp/perl_modules/Dahdi/Xpp/Xbus.pm b/xpp/perl_modules/Dahdi/Xpp/Xbus.pm index 4bc1844..b68d7cc 100644 --- a/xpp/perl_modules/Dahdi/Xpp/Xbus.pm +++ b/xpp/perl_modules/Dahdi/Xpp/Xbus.pm @@ -12,8 +12,6 @@ use Dahdi::Utils; use Dahdi::Hardware; use Dahdi::Xpp::Xpd; -my $proc_base = "/proc/xpp"; - sub xpds($) { my $xbus = shift; return @{$xbus->{XPDS}}; @@ -54,7 +52,7 @@ sub xbus_attr_path($$) { foreach my $attr (@attr) { my $file = sprintf "$Dahdi::Xpp::sysfs_astribanks/xbus-%02d/$attr", $busnum; unless(-f $file) { - my $procfile = sprintf "/proc/xpp/XBUS-%02d/$attr", $busnum; + 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; @@ -113,7 +111,7 @@ sub transport_type($$) { sub read_xpdnames_old($) { my $xbus_num = shift || die; - my $pat = sprintf "/proc/xpp/XBUS-%02d/XPD-[0-9][0-9]", $xbus_num; + 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"; @@ -175,7 +173,7 @@ sub new($$) { } foreach my $xpdstr (@xpdnames) { my ($busnum, $unit, $subunit) = split(/:/, $xpdstr); - my $procdir = "/proc/xpp/XBUS-$busnum/XPD-$unit$subunit"; + my $procdir = "$Dahdi::proc_xpp_base/XBUS-$busnum/XPD-$unit$subunit"; my $xpd = Dahdi::Xpp::Xpd->new($self, $unit, $subunit, $procdir, "$xbus_dir/$xpdstr"); push(@xpds, $xpd); } -- cgit v1.2.3