[dahdi-commits] tzafrir: tools/trunk r7462 - /tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Wed Nov 4 05:48:47 CST 2009
Author: tzafrir
Date: Wed Nov 4 05:48:43 2009
New Revision: 7462
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7462
Log:
dahdi-perl: Avoid '"is_twinstar" on unblessed reference'
Dpn't panic if a device is not found in the list of hardware. This
is not only indication of a bug, but can also happen if a device
appeared after the script was started.
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=7462&r1=7461&r2=7462
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Hardware/USB.pm Wed Nov 4 05:48:43 2009
@@ -77,7 +77,6 @@
my $xbus = shift || die;
my $xbus_dir = shift;
my $transportdir = "$xbus_dir/transport";
- my $hwdev;
if(! -e "$transportdir/ep_00") {
warn "A trasnport in '$transportdir' is not USB";
return undef;
@@ -101,12 +100,14 @@
my $usbname = sprintf("%03d/%03d", $busnum, $devnum);
#printf STDERR "DEBUG: %03d/%03d\n", $busnum, $devnum;
$xbus->{USB_DEVNAME} = $usbname;
- $hwdev = Dahdi::Hardware->device_by_hwname("usb:$usbname");
- #print "set_transport: ", $hwdev, "\n";
- $xbus->{TRANSPORT} = $hwdev;
- $hwdev->{XBUS} = $xbus;
- $hwdev->{LOADED} = 'xpp_usb';
- $xbus->{IS_TWINSTAR} = $hwdev->is_twinstar;
+ my $hwdev = Dahdi::Hardware->device_by_hwname("usb:$usbname");
+ if(defined $hwdev) {
+ #print "set_transport: ", $hwdev, "\n";
+ $xbus->{TRANSPORT} = $hwdev;
+ $hwdev->{XBUS} = $xbus;
+ $hwdev->{LOADED} = 'xpp_usb';
+ $xbus->{IS_TWINSTAR} = $hwdev->is_twinstar;
+ }
return $hwdev;
}
More information about the dahdi-commits
mailing list