summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilghman Lesher <tlesher@digium.com>2009-11-10 06:49:10 +0000
committerTilghman Lesher <tlesher@digium.com>2009-11-10 06:49:10 +0000
commit4851444ed4e2a5bde1c438bc2ca8c9145718c78c (patch)
tree932e5652d855ddca1999b80c3aa7487b1a6c8d8b
parent610e410b984a3dc9dbc5ab43bed16f5461f03130 (diff)
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.) git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7542 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--xpp/perl_modules/Dahdi/Hardware/USB.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/xpp/perl_modules/Dahdi/Hardware/USB.pm b/xpp/perl_modules/Dahdi/Hardware/USB.pm
index 722b87b..d4985b8 100644
--- a/xpp/perl_modules/Dahdi/Hardware/USB.pm
+++ b/xpp/perl_modules/Dahdi/Hardware/USB.pm
@@ -114,7 +114,7 @@ sub set_transport($$) {
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 @@ sub scan_devices_sysfs($) {
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;