diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2009-03-19 20:08:29 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2009-03-19 20:08:29 +0000 |
commit | d8562c778088ff6ab3383df5ceead41eff4bf124 (patch) | |
tree | 43e394ae225fd7183018c2ae08d3fb1e5bcb12cb /kernel/xpp/utils/zaptel_drivers | |
parent | b6b3226735f5e3b3fb000fa92daa7a574265c817 (diff) |
xpp: a massive backport from DAHDI. From Xorcom branch-rel-6839-r6908 .
Sun Mar 1 2009 Oron Peled <oron@actcom.co.il> - xpp.r6795
* Fix cases where the command_queue overflowed during initialization.
- Also add a 'command_queue_length' parameter to xpp.ko
* More migrations to sysfs:
- Add a 'transport' attribute to our astribank devices which
points to the usb device we use. E.g:
/sys/bus/astribanks/devices/xbus-00/transport is symlinked to
../../../../../../devices/pci0000:00/0000:00:10.4/usb5/5-4
- Move /proc/xpp/XBUS-??/XPD-??/span to
/sys/bus/xpds/devices/??:?:?/span
- Migrate from /proc/xpp/sync to:
/sys/bus/astribanks/drivers/xppdrv/sync
- New 'offhook' attribute in:
/sys/bus/xpds/devices/??:?:?/offhook
* PRI: change the "timing" priority to match the convention used by
other PRI cards -- I.e: lower numbers (not 0) have higher
priority.
* FXO:
- Power denial: create two module parameters instead of hard-coded
constants (power_denial_safezone, power_denial_minlen).
For sites that get non-standard power-denial signals from central
office on offhook.
- Don't hangup on power-denial, just notify Dahdi and wait for
- Fix caller-id detection for the case central office sends it before
first ring without any indication before.
Asterisk's desicion.
Mon, Dec 8 2008 Oron Peled <oron@actcom.co.il> - xpp.r6430
* PRI:
- Match our span clocking priorities (in system.conf)
to Digium -- this is a reversal of the previous state.
Now lower numbers (greater than 0) are better.
- Synchronization fixes for PRI ports other than 0.
- Fix T1 CRC for some countries (e.g: China).
* FXS: fix bug in VMWI detection if using old asterisk
which does not provide ZT_VMWI ioctl().
* FXO:
- Improve caller_id_style module parameter. This provide a workaround
for countries that send this information without any notification
(reverse polarity, ring, etc.)
- Don't force on-hook upon power-denial. So, loopstart devices
would ignore these as expected.
* Implement a flow-control to prevent user space (init_card_* scripts)
from pressuring our command queue.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4631 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/xpp/utils/zaptel_drivers')
-rwxr-xr-x | kernel/xpp/utils/zaptel_drivers | 151 |
1 files changed, 150 insertions, 1 deletions
diff --git a/kernel/xpp/utils/zaptel_drivers b/kernel/xpp/utils/zaptel_drivers index d7904c0..5ace08b 100755 --- a/kernel/xpp/utils/zaptel_drivers +++ b/kernel/xpp/utils/zaptel_drivers @@ -3,7 +3,156 @@ use strict; use File::Basename; BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } +use Errno; +use Getopt::Std; use Zaptel::Hardware; +my %opts; +my $etc_modules = '/etc/modules'; +my $zaptel_redhat = '/etc/sysconfig/zaptel'; +my $zaptel_debian = '/etc/default/zaptel'; +my $zaptel_conffile; + +getopts('vdM', \%opts) || die "$0: Bad options\n"; + +if(-f $zaptel_redhat) { + $zaptel_conffile = $zaptel_redhat; +} elsif(-f $zaptel_debian) { + $zaptel_conffile = $zaptel_debian; + $opts{'d'} = 1 if $opts{'M'}; +} else { + die "$0: Could not find '$zaptel_redhat' nor '$zaptel_debian'\n"; +} + my $hardware = Zaptel::Hardware->scan; -print join("\n", $hardware->drivers),"\n"; + +sub update_zaptel_distro(@) { + my @driver_list = @_; + my $varname = 'MODULES'; + my $newfile = "${zaptel_conffile}.new"; + my $backupfile = "${zaptel_conffile}.bak"; + + print "Updating $zaptel_conffile\n" if $opts{'v'}; + open(NEWFILE, ">$newfile") || die "$0: Failed to open '$newfile': $!\n"; + open(BACKUPFILE, ">$backupfile") || die "$0: Failed to open '$backupfile': $!\n"; + if(open(IN, $zaptel_conffile)) { + while(my $line = <IN>) { + print BACKUPFILE $line; + chomp $line; + next if $line =~ /^${varname}=/; # Skip old defs. + print NEWFILE "$line\n"; + } + close IN; + } elsif(defined($!{ENOENT})) { + print "Creating $zaptel_conffile\n" if $opts{'v'}; + } else { + die "$0: Failed opening '$zaptel_conffile': $!\n"; + } + print NEWFILE "${varname}='@driver_list'\n"; + close NEWFILE; + close BACKUPFILE; + rename($newfile, $zaptel_conffile) || + die "$0: rename($newfile, $zaptel_conffile) failed: $!\n"; +} + +# This is for Debian. +sub update_etc_modules(@) { + my @driver_list = @_; + my $newfile = "${etc_modules}.new"; + my $backupfile = "${etc_modules}.bak"; + # Just to make module loading order deterministic. + my @module_order = qw( + wct4xxp + wcte12xp + wcte11xp + wct1xxp + wanpipe + tor2 + torisa + qozap + vzaphfc + zaphfc + ztgsm + wctdm24xxp + wctdm + opvxa1200 + wcfxo + pciradio + wcusb + xpp_usb + ystdm8xx + zma8xx + ); + + open(NEWFILE, ">$newfile") || die "$0: Failed to open '$newfile': $!\n"; + open(BACKUPFILE, ">$backupfile") || die "$0: Failed to open '$backupfile': $!\n"; + if(open(IN, $etc_modules)) { + print "Updating $etc_modules\n" if $opts{'v'}; + while(my $line = <IN>) { + print BACKUPFILE $line; + chomp $line; + next if grep(/^\s*${line}\s*$/, @module_order, @driver_list); + print NEWFILE "$line\n"; + } + close IN; + } elsif(defined($!{ENOENT})) { + print "Creating $etc_modules\n" if $opts{'v'}; + } else { + die "$0: Failed opening '$etc_modules': $!\n"; + } + foreach my $d (@module_order) { + print NEWFILE "$d\n" if grep($d eq $_, @driver_list); + } + close NEWFILE; + close BACKUPFILE; + rename($newfile, $etc_modules) || + die "$0: rename($newfile, $etc_modules) failed: $!\n"; +} + +if($opts{'d'}) { + update_etc_modules($hardware->drivers); +} +if($opts{'M'}) { + update_zaptel_distro($hardware->drivers); +} + +if(!$opts{'d'} && !$opts{'M'}) { + print join("\n", $hardware->drivers),"\n"; +} + +__END__ + +=head1 NAME + +zaptel_drivers - Show drivers required for installed zaptel devices. + +=head1 SYNOPSIS + +zaptel_drivers [-vdM] + +=head1 DESCRIPTION + +This script shows by default the list of drivers required for currently +installed zaptel devices. + +Options: + +=over 4 + +=item -v + +Verbose + +=item -d + +Generate /etc/modules for Debian systems. + +=item -M + +Generate distribution dependent module configuration file: + /etc/sysconfig/zaptel # For RedHat like systems + /etc/default/zaptel # For Debian like systems + +On debian systems, specifying this option turns on the '-d' option as well. + +=back |