[dahdi-commits] tzafrir: branch tools/2.4 r9743 - in /tools/branches/2.4: ./ xpp/perl_modules...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Tue Feb 8 08:18:11 CST 2011


Author: tzafrir
Date: Tue Feb  8 08:18:07 2011
New Revision: 9743

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9743
Log:
dahdi-perl: fix xpp driver in dahdi_hardware

Don't require 'dahdi_hardware -v' to show the driver for a USB device.
Only works when the usbfs is not used (when /proc/bus/usb is not mounted).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Merged revisions 9699 via svnmerge from 
http://svn.digium.com/svn/dahdi/tools/trunk

Modified:
    tools/branches/2.4/   (props changed)
    tools/branches/2.4/xpp/perl_modules/Dahdi/Hardware/USB.pm

Propchange: tools/branches/2.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Feb  8 08:18:07 2011
@@ -1,1 +1,1 @@
-/tools/trunk:1-9220,9313,9426,9452,9458,9473,9482,9485,9648
+/tools/trunk:1-9220,9313,9426,9452,9458,9473,9482,9485,9648,9699

Modified: tools/branches/2.4/xpp/perl_modules/Dahdi/Hardware/USB.pm
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.4/xpp/perl_modules/Dahdi/Hardware/USB.pm?view=diff&rev=9743&r1=9742&r2=9743
==============================================================================
--- tools/branches/2.4/xpp/perl_modules/Dahdi/Hardware/USB.pm (original)
+++ tools/branches/2.4/xpp/perl_modules/Dahdi/Hardware/USB.pm Tue Feb  8 08:18:07 2011
@@ -140,8 +140,9 @@
 
 		# Older kernels, e.g. 2.6.9, don't have the attribute
 		# busnum:
-		m|/(\d+)-[\d.]+$|;
-		my $busnum = $1 || next;
+		m|/((\d+)-[\d.]+)$|;
+		my $busnum = $2 || next;
+		my $dev_sys_name = $1;
 		my $vendor = _get_attr("$_/idVendor");
 		my $product = _get_attr("$_/idProduct");
 		my $model = $usb_ids{"$vendor:$product"};
@@ -149,6 +150,12 @@
 		my $devnum = _get_attr("$_/devnum");
 		my $serial = _get_attr_optional("$_/serial", '');
 		my $devname = sprintf("%03d/%03d", $busnum, $devnum);
+		# Get driver for first interface of the device:
+		my $iface = "$_/$dev_sys_name:1.0";
+		my $loaded = readlink("$iface/driver");
+		if (defined $loaded) {
+			$loaded =~ s|.*/||;
+		}
 		my $d = Dahdi::Hardware::USB->new(
 			IS_ASTRIBANK		=> ($model->{DRIVER} eq 'xpp_usb')?1:0,
 			PRIV_DEVICE_NAME	=> $devname,
@@ -157,6 +164,7 @@
 			SERIAL			=> $serial,
 			DESCRIPTION		=> $model->{DESCRIPTION},
 			DRIVER			=> $model->{DRIVER},
+			LOADED			=> $loaded,
 			);
 		push(@devices, $d);
 	}




More information about the dahdi-commits mailing list