summaryrefslogtreecommitdiff
path: root/xpp/perl_modules/Dahdi/Xpp.pm
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-03-02 18:07:37 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-03-02 18:07:37 +0000
commitee0e06c99e2cf44c23984e84b592ff82af68b19b (patch)
treee3c8fc7310253671fcc7d1b77a4b308013da72dd /xpp/perl_modules/Dahdi/Xpp.pm
parentff09b1ff474333d8f7e51a8f4ef84a2f9cd9e395 (diff)
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
Diffstat (limited to 'xpp/perl_modules/Dahdi/Xpp.pm')
-rw-r--r--xpp/perl_modules/Dahdi/Xpp.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/xpp/perl_modules/Dahdi/Xpp.pm b/xpp/perl_modules/Dahdi/Xpp.pm
index 7ac574b..d4b315b 100644
--- a/xpp/perl_modules/Dahdi/Xpp.pm
+++ b/xpp/perl_modules/Dahdi/Xpp.pm
@@ -34,10 +34,16 @@ Dahdi::Xpp - Perl interface to the Xorcom Astribank drivers.
#
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";
+our $sysfs_astribanks;
+our $sysfs_xpds;
+our $sysfs_ab_driver;
+
+BEGIN {
+ my $virt_base = $Dahdi::virt_base;
+ $sysfs_astribanks = "$virt_base/sys/bus/astribanks/devices";
+ $sysfs_xpds = "$virt_base/sys/bus/xpds/devices";
+ $sysfs_ab_driver = "$virt_base/sys/bus/astribanks/drivers/xppdrv";
+}
sub scan($) {
my $pack = shift || die;
@@ -253,6 +259,7 @@ sub sync_via_proc {
my $result;
my $newapi = 0;
+ my $proc_base = $Dahdi::proc_xpp_base;
my $file = "$proc_base/sync";
return '' unless -f $file;
# First query