diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2008-10-16 18:03:47 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2008-10-16 18:03:47 +0000 |
commit | f48e3505473b9be26fa6d71c8437a87abde608f1 (patch) | |
tree | 5de89f01c6b0882b780447501327cd052cf6da31 /xpp/perl_modules/Dahdi/Xpp.pm | |
parent | eb21b700dd088304d1d9da2a657d4665ca655e23 (diff) |
xpp: userspace support for sysfx migration.
The userspace side of dahdi-linux r5097.
* Perl modules default to using xpp sysfs but will fallback (with warning)
to procfs interface.
* An additional /usr/share/dahdi/waitfor_xpds to replace the line in the
init.d script.
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@5099 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/perl_modules/Dahdi/Xpp.pm')
-rw-r--r-- | xpp/perl_modules/Dahdi/Xpp.pm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/xpp/perl_modules/Dahdi/Xpp.pm b/xpp/perl_modules/Dahdi/Xpp.pm index 919df30..f2811aa 100644 --- a/xpp/perl_modules/Dahdi/Xpp.pm +++ b/xpp/perl_modules/Dahdi/Xpp.pm @@ -32,6 +32,38 @@ Dahdi::Xpp - Perl interface to the Xorcom Astribank drivers. my $proc_base = "/proc/xpp"; +sub xpd_attr_path($$$@) { + my ($busnum, $unitnum, $subunitnum, @attr) = @_; + foreach my $attr (@attr) { + my $file = sprintf "/sys/bus/xpds/devices/%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: OLD DRIVER: missing '$file'. Fall back to '$procfile'\n"; + $file = $procfile; + } + next unless -f $file; + return $file; + } + return undef; +} + +sub xbus_attr_path($$) { + my ($busnum, @attr) = @_; + foreach my $attr (@attr) { + my $file = sprintf "/sys/bus/astribanks/devices/xbus-%02d/$attr", $busnum; + unless(-f $file) { + my $procfile = sprintf "/proc/xpp/XBUS-%02d/$attr", $busnum; + warn "$0: OLD DRIVER: missing '$file'. Fall back to '$procfile'\n"; + $file = $procfile; + } + next unless -f $file; + return $file; + } + return undef; +} + # Nominal sorters for xbuses sub by_name { return $a->name cmp $b->name; |