summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-02-08 14:18:07 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-02-08 14:18:07 +0000
commit92aaff92a63ea914d7efa0a2d7a262e4d08d2389 (patch)
treeedd3966d446616d87a0bcb4e8d35f03a4dc36eb0
parent3f223e7440d57bd8ed80d98c56f70bd5c1f10e16 (diff)
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@xorcom.com> Merged revisions 9699 via svnmerge from http://svn.digium.com/svn/dahdi/tools/trunk git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/branches/2.4@9743 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--xpp/perl_modules/Dahdi/Hardware/USB.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/xpp/perl_modules/Dahdi/Hardware/USB.pm b/xpp/perl_modules/Dahdi/Hardware/USB.pm
index edc0f4c..60df56b 100644
--- a/xpp/perl_modules/Dahdi/Hardware/USB.pm
+++ b/xpp/perl_modules/Dahdi/Hardware/USB.pm
@@ -140,8 +140,9 @@ sub scan_devices_sysfs($) {
# 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 @@ sub scan_devices_sysfs($) {
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 @@ sub scan_devices_sysfs($) {
SERIAL => $serial,
DESCRIPTION => $model->{DESCRIPTION},
DRIVER => $model->{DRIVER},
+ LOADED => $loaded,
);
push(@devices, $d);
}