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/Hardware/PCI.pm | 2 +- xpp/perl_modules/Dahdi/Hardware/USB.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'xpp/perl_modules/Dahdi/Hardware') diff --git a/xpp/perl_modules/Dahdi/Hardware/PCI.pm b/xpp/perl_modules/Dahdi/Hardware/PCI.pm index f6b3901..a1ef6bb 100644 --- a/xpp/perl_modules/Dahdi/Hardware/PCI.pm +++ b/xpp/perl_modules/Dahdi/Hardware/PCI.pm @@ -170,7 +170,7 @@ sub readfile($) { sub scan_devices($) { my @devices; - while() { + while(<$Dahdi::sys_base/bus/pci/devices/*>) { m,([^/]+)$,,; my $name = $1; my $l = readlink $_ || die; diff --git a/xpp/perl_modules/Dahdi/Hardware/USB.pm b/xpp/perl_modules/Dahdi/Hardware/USB.pm index 8b84243..711f977 100644 --- a/xpp/perl_modules/Dahdi/Hardware/USB.pm +++ b/xpp/perl_modules/Dahdi/Hardware/USB.pm @@ -135,7 +135,7 @@ sub scan_devices_sysfs($) { my $pack = shift || die; my @devices = (); - while () { + while (<$Dahdi::sys_base/bus/usb/devices/*-*>) { next unless -r "$_/idVendor"; # endpoints # Older kernels, e.g. 2.6.9, don't have the attribute @@ -165,7 +165,7 @@ sub scan_devices_sysfs($) { sub scan_devices($) { my $pack = shift || die; - my $usb_device_list = "/proc/bus/usb/devices"; + my $usb_device_list = "$Dahdi::proc_usb_base/devices"; return $pack->scan_devices_sysfs() unless (-r $usb_device_list); my @devices; -- cgit v1.2.3