[svn-commits] tilghman: tools/trunk r7542 - /tools/trunk/xpp/perl_modules/Dahdi/Hardware/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 10 00:49:14 CST 2009


Author: tilghman
Date: Tue Nov 10 00:49:10 2009
New Revision: 7542

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7542
Log:
If the USB device doesn't have a serial, DON'T PANIC.  Just return a soft failure.
(Fixes panicked users on #asterisk wondering why dahdi-tools springs up with
Perl errors when they don't even have xpp hardware.)

Modified:
    tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm

Modified: tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm?view=diff&rev=7542&r1=7541&r2=7542
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm Tue Nov 10 00:49:10 2009
@@ -114,7 +114,7 @@
 sub _get_attr($) {
 	my $attr_file = shift;
 
-	open(ATTR, $attr_file) or die "Failed to read SysFS attribute $attr_file\n";
+	open(ATTR, $attr_file) or return undef;
 	my $value = <ATTR>;
 	chomp $value;
 	return $value;
@@ -134,7 +134,7 @@
 		my $devnum = _get_attr("$_/devnum");
 		my $vendor = _get_attr("$_/idVendor");
 		my $product = _get_attr("$_/idProduct");
-		my $serial = _get_attr("$_/serial");
+		my $serial = _get_attr("$_/serial") or return undef;
 		my $devname = sprintf("%03d/%03d", $busnum, $devnum);
 		my $model = $usb_ids{"$vendor:$product"};
 		next unless defined $model;




More information about the svn-commits mailing list