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>
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>
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>
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>
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>
dahdi_perl: fix regression with an AB with no modules

Fixes a regression introduced in
3572bb5a137e1fef85e30805c6811ae74a619b2a (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>
bash_completion: fix dahdi_genconf

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
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>
dahdi_span_assignment: Run auto assignment for multiple devices in parallel by default.

This allows span assignment for ultiple devices to happen in registration order by default.

For example, the wcte12xp has a device in pci:0000:04:08.0 and the wcaxx in
pci:000:02:00.0. You can see that when auto assigning spans, the order matches
the driver load order:

  # /etc/init.d/dahdi stop
  Unloading DAHDI hardware modules: done
  # modprobe wcte12xp; modprobe wcaxx
  # dahdi_span_assignments auto
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:04:08.0
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:02:00.0
  # /etc/init.d/dahdi stop
  Unloading DAHDI hardware modules: done
  # modprobe wcaxx; modprobe wcte12xp
  # dahdi_span_assignments auto
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:02:00.0
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:04:08.0
  # /etc/init.d/dahdi stop
  Unloading DAHDI hardware modules: done
  # modprobe wcaxx; modprobe wcte12xp
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:02:00.0
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:04:08.0
  # /etc/init.d/dahdi stop
  Unloading DAHDI hardware modules: done
  # modprobe wcte12xp; modprobe wcaxx
  dahdi_span_assignments auto
  # dahdi_span_assignments auto
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:04:08.0
  auto-assign /sys/bus/dahdi_devices/devices/pci:0000:02:00.0

The above behavior depends on dahdi's auto_assign_spans module parameter to be
equal to 0. Otherwise, the drivers will not try to enforce any ordering.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>