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/Utils.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xpp/perl_modules/Dahdi/Utils.pm') diff --git a/xpp/perl_modules/Dahdi/Utils.pm b/xpp/perl_modules/Dahdi/Utils.pm index dcb7441..4ca468b 100644 --- a/xpp/perl_modules/Dahdi/Utils.pm +++ b/xpp/perl_modules/Dahdi/Utils.pm @@ -23,6 +23,20 @@ sub AUTOLOAD { } } +# Initialize ProcFS and SysFS pathes, in case the user set +# DAHDI_VIRT_TOP +BEGIN { + if (exists $ENV{DAHDI_VIRT_TOP}) { + $Dahdi::virt_base = $ENV{DAHDI_VIRT_TOP}; + } else { + $Dahdi::virt_base = ''; + } + $Dahdi::proc_dahdi_base = "$Dahdi::virt_base/proc/dahdi"; + $Dahdi::proc_xpp_base = "$Dahdi::virt_base/proc/xpp"; + $Dahdi::proc_usb_base = "$Dahdi::virt_base/proc/bus/usb"; + $Dahdi::sys_base = "$Dahdi::virt_base/sys"; +} + sub xpp_dump($) { my $self = shift || die; printf STDERR "Dump a %s\n", ref($self); -- cgit v1.2.3