[dahdi-commits] tzafrir: branch tools/tzafrir/perl-sysstate r7824 - /tools/team/tzafrir/perl-...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Sun Jan 10 08:31:45 CST 2010
Author: tzafrir
Date: Sun Jan 10 08:31:41 2010
New Revision: 7824
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7824
Log:
Not all Astribanks have a 'serial' attribute. Make it optional.
Modified:
tools/team/tzafrir/perl-sysstate/xpp/perl_modules/Dahdi/Hardware/USB.pm
Modified: tools/team/tzafrir/perl-sysstate/xpp/perl_modules/Dahdi/Hardware/USB.pm
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/perl-sysstate/xpp/perl_modules/Dahdi/Hardware/USB.pm?view=diff&rev=7824&r1=7823&r2=7824
==============================================================================
--- tools/team/tzafrir/perl-sysstate/xpp/perl_modules/Dahdi/Hardware/USB.pm (original)
+++ tools/team/tzafrir/perl-sysstate/xpp/perl_modules/Dahdi/Hardware/USB.pm Sun Jan 10 08:31:41 2010
@@ -121,6 +121,15 @@
return $value;
}
+sub _get_attr_optional($$) {
+ my ($attr_file, $def_val) = $@;
+
+ eval {return _get_attr($attr_file)};
+
+ # If we got here, _get_attr exploded. Return the default value:
+ return $def_val;
+}
+
sub scan_devices_sysfs($) {
my $pack = shift || die;
my @devices = ();
@@ -137,7 +146,7 @@
my $model = $usb_ids{"$vendor:$product"};
next unless defined $model;
my $devnum = _get_attr("$_/devnum");
- my $serial = _get_attr("$_/serial");
+ my $serial = _get_attr_optional("$_/serial", '');
my $devname = sprintf("%03d/%03d", $busnum, $devnum);
my $d = Dahdi::Hardware::USB->new(
IS_ASTRIBANK => ($model->{DRIVER} eq 'xpp_usb')?1:0,
More information about the dahdi-commits
mailing list