diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-18 14:31:07 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-18 14:31:07 +0000 |
commit | cfd61537b47387b0fb5c8228baad6cec16d8f6e6 (patch) | |
tree | 108deea65c09c7c273a9b981f8783efcd433eaea /xpp/utils/zconf/Zaptel/Hardware/USB.pm | |
parent | 4391b4a6ee42bdfd8e097c5ee5485e9eb13f19a0 (diff) |
xpp r5151:
* xpd_pri: Basically ready.
* PCM synchronization changes:
- Each Astribank unit ticks independently. Each with its own PLL.
- HOST synchronization is gone. Loading of xpp will no longer cause
useless 250 ticks per second if you have no Astribank.
- Synchronization from the zaptel sync master requires setting
ZAPTEL as sync source (xpp_sync ZAPTEL).
* rx_tasklet is now a parameter of the module xpp, rather than of xpp_usb.
* New FPGA firmware: 5128 (1151) / 5122 (1141, 1131):
- Fixes synchronization issues.
- PRI module: E1 should now work.
* perl module and utilities:
- Modules no longer magically scan system on initialization.
- Scanning is by calling explicit methods.
- "Serial" has been renamed "Label". It is basically unique, but
should be modifieble.
- Some basic documentation of zaptel perl modules.
* Default sort order of zt_registration is back to SORT_CONNCTOR.
* zt_registration proc file now shows the number of span registered to
if registered. Try: grep . /proc/xpp/XBUS-*/XPD-*/zt_registration
* genzaptelconf: Allow using a custom command instead of
/etc/init.d/asterisk to start/stop asterisk.
* Fixed the typo "Slagish".
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3506 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/zconf/Zaptel/Hardware/USB.pm')
-rw-r--r-- | xpp/utils/zconf/Zaptel/Hardware/USB.pm | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/xpp/utils/zconf/Zaptel/Hardware/USB.pm b/xpp/utils/zconf/Zaptel/Hardware/USB.pm index 4d87536..a5501d1 100644 --- a/xpp/utils/zconf/Zaptel/Hardware/USB.pm +++ b/xpp/utils/zconf/Zaptel/Hardware/USB.pm @@ -8,6 +8,7 @@ package Zaptel::Hardware::USB; # $Id$ # use strict; +use XppUtils; use Zaptel::Hardware; use Zaptel::Xpp; use Zaptel::Xpp::Xbus; @@ -30,25 +31,14 @@ my %usb_ids = ( 'e4e4:1150' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi no-firmware' }, 'e4e4:1151' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi USB-firmware' }, 'e4e4:1152' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi FPGA-firmware' }, + 'e4e4:1160' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular no-firmware' }, + 'e4e4:1161' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular USB-firmware' }, + 'e4e4:1162' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular FPGA-firmware' }, ); $ENV{PATH} .= ":/usr/sbin:/sbin:/usr/bin:/bin"; -# Accessors (miniperl does not have Class:Accessor) -our $AUTOLOAD; -sub AUTOLOAD { - my $self = shift; - my $name = uc($AUTOLOAD); - $name =~ s/.*://; # strip fully-qualified portion - if (@_) { - return $self->{$name} = shift; - } else { - return $self->{$name}; - } -} - -my @devices; my @xbuses = Zaptel::Xpp::xbuses('SORT_CONNECTOR'); sub usb_sorter() { @@ -59,7 +49,10 @@ sub xbus_of_usb($) { my $priv_device_name = shift; my $dev = shift; - my ($wanted) = grep { $priv_device_name eq $_->usb_devname } @xbuses; + my ($wanted) = grep { + defined($_->usb_devname) && + $priv_device_name eq $_->usb_devname + } @xbuses; return $wanted; } @@ -71,6 +64,9 @@ sub new($$) { if(defined $xbus) { $self->{XBUS} = $xbus; $self->{LOADED} = 'xpp_usb'; + } else { + $self->{XBUS} = undef; + $self->{LOADED} = undef; } Zaptel::Hardware::device_detected($self, sprintf("usb:%s", $self->{PRIV_DEVICE_NAME})); @@ -78,36 +74,43 @@ sub new($$) { } sub devices($) { - my $pack = shift or die "Wasn't called as a class method\n"; - return sort usb_sorter @devices; -} - -sub scan_devices($) { my $pack = shift || die; my $usb_device_list = "/proc/bus/usb/devices"; return unless (-r $usb_device_list); + my @devices; open(F, $usb_device_list) || die "Failed to open $usb_device_list: $!"; - $/ = ''; + local $/ = ''; while(<F>) { my @lines = split(/\n/); my ($tline) = grep(/^T/, @lines); my ($pline) = grep(/^P/, @lines); + my ($sline) = grep(/^S:.*SerialNumber=/, @lines); my ($busnum,$devnum) = ($tline =~ /Bus=(\w+)\W.*Dev#=\s*(\w+)\W/); my $devname = sprintf("%03d/%03d", $busnum, $devnum); my ($vendor,$product) = ($pline =~ /Vendor=(\w+)\W.*ProdID=(\w+)\W/); + my $serial; + if(defined $sline) { + $sline =~ /SerialNumber=(.*)/; + $serial = $1; + #$serial =~ s/[[:^print:]]/_/g; + } my $model = $usb_ids{"$vendor:$product"}; next unless defined $model; my $d = Zaptel::Hardware::USB->new( + IS_ASTRIBANK => ($model->{DRIVER} eq 'xpp_usb')?1:0, + BUS_TYPE => 'USB', PRIV_DEVICE_NAME => $devname, VENDOR => $vendor, PRODUCT => $product, + SERIAL => $serial, DESCRIPTION => $model->{DESCRIPTION}, DRIVER => $model->{DRIVER}, ); push(@devices, $d); } close F; + @devices = sort usb_sorter @devices; } 1; |