Commit Graph

212 Commits

Author SHA1 Message Date
Oron Peled
cd6083b6ce xpp: waitfor_xpds: assume astribank_is_starting exists
It's in the same package (dahdi-tools) for a long time

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-11-06 13:29:19 +02:00
Oron Peled
0eb77e626e xpp: waitfor_xpds: expansion error with no ABs
Fix an exansion error in case there were no Astribanks on the system.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-11-06 13:29:19 +02:00
Oron Peled
2e1c15baa3 xpp: astribank_is_starting: improve '-v' output
Do print a message if no semaphore exists. It means that either there
are no Astribanks, or existing Astribanks were already initialized.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-11-06 13:29:19 +02:00
Russ Meyerriecks
094bb2c1e8 tonezone: Fix regression in Australian tone patch
Initialize db to 1.0 instead of doing it in a few, but not all, logic contexts.

Reported-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-09-16 19:07:17 -05:00
Oron Peled
9aee76a3a5 xpp: revert USB "clear_halt" change and better overrides.
Why:
 * Doing "clear_halt" is normally the right thing to do on startup.
 * The original observed problem is better fixed via USB bios settings.
 * Defaulting to no "clear_halt" cause more problems on other platform
   combinations (hardware/kernel).

The change:
 * We now reverted to do "clear_halt" by default.
 * The XTALK_OPTIONS may now contain either "use-clear-halt" (the default)
   or "no-use-clear-halt" to override for debugging/testing.

Original commit: ca7c04e9cb

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-08-18 15:15:06 +03:00
Tzafrir Cohen
d4537e46ce xpp: astribank_hexload: allow empty span specs
DAHDI 2.9.2 added support for -S (span specs). However if this option
was not specified, it fails to run.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-08-04 09:35:52 +03:00
Tzafrir Cohen
60401c5f49 xpp_fxloader: rename variable: default_law -> law
The variable 'default_law' was the result of a partial renaming of the
original variable 'law'. Let's keep all of them in sync.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-08-04 09:35:52 +03:00
Armen Karlozian
a109763160 tonezone: Fix congestion tone for Australia
The Congestion tone in Australia must be reduced by 10 to 15 dB
at every other cadence and the frequencies for both at cadences are 425 Hz.

From: Armen Karlozian <armeniki@hotmail.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-08-01 16:04:00 -05:00
Shaun Ruffell
6c40704fec zonedata: Ensure all zones have a default DAHDI_TONE_DIALRECALL.
The default 'us' tone is most likely better than silence when Asterisk tries to
generate the recall tone on a DAHDI channel.

Internal-Issue-ID: DAHTOOL-63
Reported-By: Igor Kravets
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-08-01 15:53:48 -05:00
Russ Meyerriecks
95e9dd71d8 dahdi_cfg: Reduce mass ioctls on non-existing channels
Logic was calling DAHDI_SPECIFY ioctl on all channels up to maximum channel
limit. Added a short circuit to prevent the ioctl on channels that aren't
configured.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
2014-07-23 16:53:38 -05:00
Russ Meyerriecks
df47721962 dahdi_cfg: minor: Rename fo_real to dry_run
Minor readability change

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
2014-07-23 16:52:59 -05:00
Russ Meyerriecks
4e14561508 wcte43xp: Teach tools about te436 and te236 products
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-07-18 10:41:54 -05:00
Shaun Ruffell
49361e5ce7 dahdi_cfg: Warn if idle bits are set on invalid channel type.
Hopefully will save a little time in the future if anyone ever types into
/etc/dahdi/system.conf:

  bchan=1-15,17-30:1101

when they meant:

  cas=1-15,17-30:1101

in the future.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-07-09 15:55:37 -05:00
Shaun Ruffell
8045f7f493 dahdi_cfg: Unlink semaphore on early exit.
If dahdi_cfg is terminated while holding the named semaphore, it is possible to
leave it behind and all subsequenct invocations of dahdi_cfg will block waiting
for it.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-07-07 17:06:16 -05:00
Tzafrir Cohen
64e7c688d3 Makefile: A typo in a comment
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-06-30 13:47:23 +03:00
Oron Peled
b28ec382bb added autoconfig.h to .gitignore
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-06-29 16:34:24 +03:00
Oron Peled
412c3f0fe3 xpp: support per-port E1/T1 EC
* Added optional '-S <span-spec>' argument to astribank_hexload:
  - Allow passing PRI span specification to EC firmware loader.
  - The span specifications is whitespace/comma separate list
    of items.
  - Each item is: <span>:<type> (Example: 3:T1)
  - The <span> may use shell-like globbing (e.g: *:E1 or [12]:T1)
  - Any span not matched in the span specification will be set
    as without the new '-S' option (i.e: depends on the '-A' option).

* Adapted xpp_fxloader:
  - Read specification for both device label and wildcard from
    /etc/dahdi/span-types.conf
  - If the result is non-empty, pass it as '-S <span-spec>' to
    the EC firmware loader.
2014-06-29 16:34:21 +03:00
Oron Peled
fc459c374c xpp: set EC firmware according to PRI settings:
* Read first from modern configuration files
  (/etc/dahdi/span-types.conf)
  - Support either exact label match or complete '*' match in the
    configuration file.

* Fallback to legacy /etc/dahdi/xpp.conf

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-06-29 16:34:17 +03:00
Oron Peled
ca09f327ed xpp: better dahdi_registration
Improvements to the xpp tool dahdi_registration:

* Use the new xpp driver with support for dahdi_registration sysfs
  attribute in each device.

* Wait for UDEV to finish handling span assignments (via
  dahdi_waitfor_span_assignments).

* Still supports legacy drivers without this, by falling back
  to old style iterative "registration" on each xpd.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-06-29 16:30:34 +03:00
Tzafrir Cohen
b1d55683ae xpp: Don't generate .depends if there's no libusb
Creating the The .depends file requires libusb support.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-06-10 12:41:43 +03:00
Oron Peled
9285e86492 xpp: better error checking (echo_loader)
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-11 19:07:40 +03:00
Oron Peled
ca7c04e9cb xpp: fix usb "clear_halt" problem
* Don't use "usb_clear_halt" by default anymore
   - It caused problems with specific devices in the past
   - Now it cause problems with specific servers as well (64 bits, USB3)

 * Add an "XTALK_OPTIONS" environment variable to pass options:
   - Use it to implement a "use-clear-halt" boolean option that
     restore original behavior.
   - Also use it for "no-lock" option which replace the legacy
     environment variable "XUSB_NOLOCK".
2014-05-11 18:03:11 +03:00
Oron Peled
ae02edacb4 xpp: safer compilation
* Compile with "-Wall -Werror"
* Better dependency calculation:
  - Explicit listing of sources, don't use wildcards.
  - Pass various CFLAGS to dependency calculation as well.
  - Make sure a failure is propagated

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-11 18:03:11 +03:00
Shaun Ruffell
2abfd165ae system.conf.sample: Remove reference to single frequency signalling.
Single frequency signalling has not been supported in dahdi_cfg since the switch
to DAHDI. Before DAHDI, in the Zaptel days, it was only suported in the
ztcfg_dude utility which wasn't mainlined. So this removes references to those
signalling modes unless support is added back into the driver.

Internal-Issue-ID: DAHLIN-335
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-05-05 09:45:02 -05:00
Oron Peled
1e6b2741db dahdi_genconf: remove hard-coded E1 default
* The "spantypes" generator had E1 default if no 'line-mode' parameter
  was passed.

* As a result the new logic in "dahdi_span_types dumpconfig" had no
  effect when called from dahdi_genconf, as it was always called
  with "--line-mode=" argument.

* Now "dahdi_genconf spantype" behaves just like
  "dahdi_span_types dumpconfig":
  - The "--line-mode=" forces generation of provided line-mode (E1/J1/T1)
  - Without this option, the generated config matches the current spans
    state according to new dahd_span_types default logic:
    - Wildcard rule if all spans have same line-mode.
    - Uncommented specific matches if spans have different line-modes.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-04-30 22:51:58 +03:00
Oron Peled
794c8eb048 xpp: waitfor_xpds: handle missing serial numbers
Fixes a regression since 949ea4ca9f
(2.7.0) - allows using an Astribank with no serial.

* Some of the olderst Astribanks don't have a serial number burned in
  them. Thus there is no serial attribute for the sysfs USB device node.

* waitfor_xpds identifies the Astribanks by their serial numbers.

* An lone Astribank without serial number would thus block waitfor_xpds
  (until timeout).

* Now we warn about them.

* We also try to handle it gracefully. As long as there's only one
  of thease, it would be counted as "NO-SERIAL".

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-04-30 22:48:06 +03:00
Oron Peled
ffe36c63e0 xpp: dahdi_registration: force re-assignment
* The system state causing the bug:
  - DAHDI has auto_assign_spans==1
  - No /etc/dahdi/assigned-spans.conf

* The bug scenario:
  - During initial device detection, they are assigned by
    DAHDI driver.
  - Later we run "dahdi_span_assignment remove"
  - Then, a "dahdi_registration on" would not assign any span.

* The fix:
  - Using the '-R' option, force "dahdi_registration on" to also
    do "dahdi_span_assignment auto" on relevant devices.
  - This is the way it's called by /usr/share/dahdi/dahdi_auto_assign_compat

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
2014-04-30 22:46:41 +03:00
Oron Peled
f2628eeedd improved dahdi_span_types dumpconfig
* Better defaults:
  - A wildcard match:
    - If '--line-mode' option is given, generate a wildcard entry.
      (existing behavior).

    - Otherwise, if *all spans* are of the same type (E1/T1),
      generate a wildcard entry for this type.
      This is the most common use-case and now it work without
      any command line flags.

    - Otherwise (mixed E1/T1 spans), do not generate a wildcard entry.
      This isn't common case (except from our labs), but regardless
      without '--line-mode' any guess could be wrong.

  - Specific device matches:
    - If all spans are of the same type, generate commented out
      specific entries (for manual overrides).

    - If spans have mixed E1/T1 types, generate specific entries
      In this case, specific entries MUST NOT be commented out
      otherwise, the configuration file is wrong!

* Generated header with better organization:
  - Shows what is generated:
    - Generating wildcard / Not generating wildcard
    - Generating specific lines / Generating *commented-out* specific lines

  - For each decision, show *why* it was taken.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-04-01 21:23:28 +03:00
Oron Peled
1292ea9078 registration-order: Added dahdi_auto_assign_compat
Maintains the original registration order as was before span
assignments. Should allow seemless trannsition to
dahdi.auto_assign_spans=0

* The idea:
  - We stop handling in udev the case of missing
    /etc/dahdi/assigned-spans.conf
  - Instead we rely on "registration_time" dahdi_device attribute from
    DAHDI-linux
  - Then, we can sort the devices and assign their spans in
    /etc/init.d/dahdi
* Mechanics:
  - From /etc/init.d/dahdi, we run a new 'dahdi_auto_assign_compat'
    script (after "waitfor_xpds" etc.)
  - In this script we "auto" assign spans of non-Astribank devices
  - In the end of the script we run "dahdi_registration" which
    does the same for Astribank devices.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-03-25 14:51:29 +02:00
Oron Peled
cfee27106b hotplug: call handle_device.d/ actions for remove
* Original actions didn't care about remove (10-span-types, 20-span-assignments)
* But others need to know about removals too.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-03-25 14:48:09 +02:00
Shaun Ruffell
066fa2aff3 dahdi_cfg: error()->perror() when sem_open fails.
This fixes a confusing error message. When sem_open failed, the system.conf line
number was being printed and the system error code was not.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-02-12 11:56:00 -06:00
Aslan Laoz
bce5afacf1 waitfor_xpds: handle the case of a failing AB
If an Astribank failed initialization, don't keep waiting for it.
2014-02-07 14:23:19 +02:00
Tzafrir Cohen
dd752529f0 auto_assign_spans may be true even if not '1'
auto_assign_spans is an int and may have legal values other than 1. It
is legal (though pointless) to use: modprobe dahdi auto_assign_spans=3.
Any value != 0 is true.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-02-07 14:22:49 +02:00
Shaun Ruffell
27d07446ef hotplug: Check for auto_assign_spans only when ACTION is add.
Removes a potentially confusing error message. This is a reapplication of
(4f259cd569 "dahdi_handle_device, dahdi_span_config: Check for
auto_assign_spans only when ACTION is add.") which appears to have been
accidentally removed when moving the hotplug scripts into a subdirectory.

From the original commit:

When dahdi.ko is unloaded, it may be possible for the driver to be removed from
the kernel before the udev scripts are run.  When this happens, you'll see
messages like the following which are not accurate:

    'dahdi_handle_device'[24567]: Old driver (no auto_assign_spans parameter). Skip /devices/pci0000:00/0000:00:1e.0/0000:11:01.0/pci:0000:11:01.0

Now instead you will see:

    'dahdi_handle_device'[28008]: remove: /devices/pci0000:00/0000:00:1e.0/0000:11:01.0/pci:0000:11:01.0

Also, all the udev events will be logged in the system log even when they are
ignored because of legacy auto span assignment. This will help show what is
going on during the transition period to full udev configuration of spans.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>
2014-01-31 16:08:21 -06:00
Shaun Ruffell
8e2a5def27 hotplug: Do not run auto span configuration if spans are auto assigned.
This reapplies the change made in commit (6ed0adc08 "dahdi_span_config: Do not run auto
span configuration if spans are auto assigned.") which appears to have been
accidentally removed in (7f826a7d35 "hotplug modularization: split logic to
scriptlets").

To rationale from commit 6ed0adc08:

I have seen cases were users run:

  # modprobe <driver>; dahdi_cfg -c <custom config file>

and the spans end up misconfigured because dahdi_span_assignments ends up
running, via udev, after the user configured the span the way it wanted.

dahdi_span_assignments now looks at auto_assign_spans module parameter on
dahdi.ko, like dahdi_handle_device already does, to determine if legacy or udev
based configuration is being done.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-01-31 11:16:08 -06:00
Tzafrir Cohen
e553ffde2b README: udev hooks run scripts from directories
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-28 11:42:33 +02:00
Tzafrir Cohen
d1fb614ac8 hotplug: document asterisk scriptlet
A well-behaving distribution may choose not to install
span_config.d/50-asterisk as part of dahdi-tools, as it belongs in
asterisk. Still, it would be nice to be able to keep it as a documented
usage example. So just writ where this file needs to go and what it
does.

No other change: it is still installed by default.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-28 11:32:31 +02:00
Tzafrir Cohen
98ecc272d1 hyphen/minus fixes in man pages
in groff '-' creates a hyphen and for a minus (path, option, or similar)
you need '\-'.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-27 20:29:04 +02:00
Russ Meyerriecks
91768d360c dahdi.init: Don't exit on lack of /etc/dahdi/system.conf
auto_spans and dahdi_cfg -c are valid config methods which may not have a
/etc/dahdi/system.conf. We already check for the existance of the dahdi modules
before the case start, so I think it's safe to remove this section.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-23 16:25:56 -06:00
Tzafrir Cohen
63842cc4f3 bash_completion: fix dahdi_genconf
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-23 23:16:55 +02:00
Tzafrir Cohen
b8d1e467e4 dahdi_perl: fix regression with an AB with no modules
Fixes a regression introduced in
3572bb5a13 (before 2.7.0) - most of the
dahdi_perl tools will fail for an Astribank with no modules claiming
"No XPDs for '/sys/bus/astribanks/devices/xbus-00'"

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-23 22:32:45 +02:00
Tzafrir Cohen
de1ee8494a programmable bash completion for some commands
Programmable bash completion for dahdi_span_assignments,
dahdi_span_types and dahdi_genconf.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 22:30:47 +02:00
Tzafrir Cohen
d3feed5c4c dahdi_span_types: hush warning of missing attribute
Don't warn when a sysfs attribute does not exist.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 21:33:10 +02:00
Oron Peled
b621c02b7f Change span-type.conf generation policy
* Add '--line-mode=<E1|T1|J1>' option to dahdi_span_types:
  - Will first generate a wildcard entry (* *:<type>)
  - All later entries will be commented-out.
  - Manually uncommenting any of them will create an "override"
    (e.g: mixed system with all spans T1, but some E1)

* Now dahdi_genconf does not generate span-types.conf by default:
  - Added '--line-mode=<E1|T1|J1>' option to trigger generation
  - This parameter will be passed to "dahdi_span_types dumpconfig"
  - Also explicit specification of 'spantypes' as an argument will
    trigger a similar generation (with a default of 'E1').
  - The line-mode may also be passed to the generator directly
    with identical results. Example:
          dahdi_genconf spantypes=line-mode=T1

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 21:32:14 +02:00
Oron Peled
451a8b4d6f dahdi_span_types: allow defaults + overrides
* Allow wildcards for both device and span number (as before).
  Example:
     *        *:T1

* But now we are carefull to follow strict order in the configuration
  file. This means, if there are multiple matches -- last one wins.

* So we can use specialisation:
     *        *:T1	# Everything is T1
     FOO      [34]:T1	# Except spans 3,4 on the FOO device

* Added --dry-run and --verbose options.

* Updated the man-page:
  - Fixed "registered" => "assigned".
  - Use "line mode" for E1/J1/T1.
  - Document current changes.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 21:28:59 +02:00
Tzafrir Cohen
09fd3f53b1 dahdi_span_assignments.8: s/register/assign/
* Use the term "assignment" instead of "registration" (for spans).
* Further fixes.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 21:27:58 +02:00
Oron Peled
c3b020a155 new "dahdi_waitfor_span_assignments" tool
* Allows waiting until all spans are "assigned" or "unassigned"
* Current implementation use a polling loop with sleep
* Future implementation may block on sysfs attribute
  (like waitfor_xpds is blocking on sysfs Astribanks attribute)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 12:35:59 +02:00
Oron Peled
7f826a7d35 hotplug modularization: split logic to scriptlets
* Device related operations are ordered in /usr/share/dahdi/handle_device.d/
* Span related operations are ordered in /usr/share/dahdi/span_config.d/
* In the future, span_config.d/50-asterisk should be moved to Asterisk.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 12:35:59 +02:00
Oron Peled
cdedf024ae hotplug modularization: move sources to a subdir
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 12:35:59 +02:00
Russ Meyerriecks
a6203e151f wcte13xp: Teach tools about te131 te132 products
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 17:45:58 -06:00