From e45d247d903f548a7aa927b9d13244f3f972dd21 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Sun, 18 Jan 2009 10:22:27 +0000 Subject: XPP tool updates to match r5663: sysfs migration. git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@5671 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- xpp/perl_modules/Dahdi/Xpp/Line.pm | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'xpp/perl_modules/Dahdi/Xpp/Line.pm') diff --git a/xpp/perl_modules/Dahdi/Xpp/Line.pm b/xpp/perl_modules/Dahdi/Xpp/Line.pm index 507b2e2..1302a9e 100644 --- a/xpp/perl_modules/Dahdi/Xpp/Line.pm +++ b/xpp/perl_modules/Dahdi/Xpp/Line.pm @@ -26,17 +26,7 @@ sub blink($$) { my $self = shift; my $on = shift; my $xpd = $self->xpd; - my $result; - my $file = Dahdi::Xpp::xpd_attr_path( - $xpd->xbus->num, - $xpd->unit, - $xpd->subunit, "blink"); - die "$file is missing" unless -f $file; - # First query - open(F, "$file") or die "Failed to open $file for reading: $!"; - $result = ; - chomp $result; - close F; + my $result = $xpd->xpd_getattr("blink"); $result = hex($result); if(defined($on)) { # Now change my $onbitmask = 1 << $self->index; @@ -44,15 +34,7 @@ sub blink($$) { $result = $offbitmask; $result |= $onbitmask if $on; - open(F, ">$file") or die "Failed to open $file for writing: $!"; - print F "$result"; - if(!close(F)) { - if($! == 17) { # EEXISTS - # good - } else { - undef $result; - } - } + $result = $xpd->xpd_setattr("blink", $result); } return $result; } @@ -69,15 +51,9 @@ sub create_all($$) { } $xpd->{LINES} = \@lines; if($xpd->type eq 'FXO') { - my $file = Dahdi::Xpp::xpd_attr_path( - $xpd->xbus->num, - $xpd->unit, - $xpd->subunit, "fxo_battery"); - if(defined $file) { - open(F, "$file") || die "Failed opening '$file': $!"; - my $battery_line = ; - close F; - my @batt = split(/\s+/, $battery_line); + my $battery = $xpd->xpd_getattr("fxo_battery"); + if(defined $battery) { + my @batt = split(/\s+/, $battery); foreach my $l (@lines) { die unless @batt; my $state = shift @batt; -- cgit v1.2.3