Commit Graph

155 Commits

Author SHA1 Message Date
Shaun Ruffell
4f259cd569 dahdi_handle_device, dahdi_span_config: Check for auto_assign_spans only when ACTION is add.
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-08 17:56:52 -06:00
Tzafrir Cohen
4d5ca04ad6 README: Update the install targets
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-12-30 19:24:23 +02:00
Tzafrir Cohen
2d3580a3db README: document initialization
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-12-30 19:12:59 +02:00
Tzafrir Cohen
d96be70986 README: indentation level for config samples
Indent the configuration samples one level deeper

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-12-29 20:32:12 +02:00
Tzafrir Cohen
41a725adea .gitignore: more generated files
Ignore test binaries and files generated by 'make docs'

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-12-29 13:53:53 +02:00
Shaun Ruffell
6ed0adc086 dahdi_span_config: Do not run auto span configuration if spans are auto assigned.
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>
Acked-by: Oron Peled <oron.peled@xorcom.com>
2013-12-21 00:02:22 -06:00
Tzafrir Cohen
5e75fa48f4 dahdi.rules: use += for RUN
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-12-12 23:47:50 +02:00
Tzafrir Cohen
4ab8e95d0b dahdi.rules: Replace SYSFS with ATTRS
SYSFS has been deprecated. Use ATTRS.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-12-12 23:47:50 +02:00
Shaun Ruffell
5ca600c7c7 dahdi_cfg: Wait for all spans to be assigned.
When auto span assignment is disabled, it's possible that simply running

  # /etc/init.d/dahdi restart

Will fail since dahdi_cfg can run in parallel with udev scripts that are
assigning spans, which results in /etc/dahdi/system.conf describing spans that
do not exist in the system.

This change sets up dahdi_cfg, when run without the -C or -S options, to look in
sysfs and make sure all spans for each device are assigned.  dahdi_cfg will wait
5 seconds for span assignment to happen before proceeding normally.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-12-12 09:08:51 -06:00
Oron Peled
98736e1add Makefile: do install all man-pages
Fixes a regression in 2.8 (ffced0ca) in the main Makefile:
MAN_PAGES gets assigned twice and thus most man pages will not get
installed.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-12-09 22:57:41 +02:00
Oron Peled
a9338d9b74 Makefile: new 'make-dist' target
Creates a tar.gz:
* Identical results to Digium's distributed tarballs
* Named "dahdi-tools-<version>.tar.gz"
* Only from committed files (uses git-archive)
* Adds a .version file

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-12-02 23:01:17 +02:00
Shaun Ruffell
c0e19d47e8 dahdi_span_assignments, dahdi_span_types: Allow conf file to be overridden.
The environment variables that specified the full path the the configuration
files for dahdi_span_types and dahdi_span_assignments was documented, but they
were not actually set from the environment.

Also, the case of the variable was changed to match the one for the directory
where the rest of the config files are located.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-26 13:50:02 -06:00
Shaun Ruffell
ffced0cad2 Add dahdi_ prefix to handle_device, span_types, span_assignments, and span_config.
All new dahdi tools and utilities will be prefixed with "dahdi_" in order to
avoid any future conflicts with other packages.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>
2013-11-26 13:50:02 -06:00
Shaun Ruffell
e298eb1237 span_types: Fix bug that would prevent matching on devpath.
If a configuration file was specified that used the devpath, like:

  # Device: [] @Board_ID_Switch_0 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:08.0/pci:0000:02:08.0
  /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:08.0/pci:0000:02:08.0 1:E1
  /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:08.0/pci:0000:02:08.0 2:E1
  /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:08.0/pci:0000:02:08.0 3:E1
  /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:08.0/pci:0000:02:08.0 4:E1

Then the span_types script would silently fail to match the configuration lines
for the device and silently fail to change the linemodes.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>
2013-11-25 16:11:37 -06:00
Tzafrir Cohen
a97d373d95 configure: regenerate for 6d10525
Regenerate configure script following changes in commit
6d10525863.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-24 18:11:04 +02:00
Shaun Ruffell
c27664dc1b dahdi.init: Remove spurious "Missing '/sys/bus/astribanks/drivers/xppdrv/sync'".
The xpp_sync will fail if there are not any Astribank devices loaded. Check for
existence of the tools before trying to sync.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-24 10:06:11 -06:00
Tzafrir Cohen
365a12f42a README: include pinned spans config files
Include pinned-spans.conf and span-types.conf in the generated
README.html. Reformat them to render properly.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-24 16:48:29 +02:00
Oron Peled
2a84216fe4 Terminology rename: "pinned" -> "assigned"
* File names fixed
* File contents fixed

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:42:15 +02:00
Oron Peled
791a596c07 dahdi.rules: add persistent channel names as well
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:39:33 +02:00
Oron Peled
d145364c00 dahdi.rules: don't process "add" events unless needed
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:38:43 +02:00
Oron Peled
0afba16b2e hotplug: run fxotune from span_config:
* Use fxotune -b/-e options to run on wanted channel range
2013-11-24 16:36:01 +02:00
Oron Peled
c163caca00 fxotune: Now options '-b/-e' also apply with '-s'
* Now we can limit fxotune "set" mode to specific channel range.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:35:10 +02:00
Oron Peled
c9e8ec7499 dahdi.rules: use tools_rootdir from driver
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:30:49 +02:00
Oron Peled
1356a55d77 span_types: fix for white-space in hardware_id
* Sanitize hardware_id/location attributes, just like span_assignments
* Allow control of keys via SPAN_ASSIGNMENTS_KEY or '-k <key>' option
* In general, import most features/options from span_assignments

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:22:58 +02:00
Oron Peled
10a6622774 udev scripts now read /etc/dahdi/init.conf
Added two override variables in init.conf:
* DAHDI_UDEV_DISABLE_DEVICES
* DAHDI_UDEV_DISABLE_SPANS

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:20:08 +02:00
Oron Peled
a4217f6977 sysfs: restored legacy names /etc/dahdi/<channo>:
Update dahdi.rules to create again the old fashioned device files
(/dev/dahdi/<channo>), but as symlinks to modern names.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:17:35 +02:00
Oron Peled
fb1a2b5572 added udev rules and their install target:
* Added missing Makefile install rule for dahdi.rules
* Pulled xpp.rules from dahdi-linux and added install rules for it

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:16:33 +02:00
Oron Peled
6d10525863 pinned-spans: remove '--enable-pinned' from configure
pinned-spans utilities are now essential:
* Called by udev rules
* Called by dahdi_genconf

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:13:51 +02:00
Oron Peled
a1d4355c20 pinned-spans: fix examples in configuration files
* Correctly use the new "location" attribute
* Document the possibility to match against sysfs devpath
  (used to be the "location")

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:08:31 +02:00
Oron Peled
b303802658 pinned-spans: fix configuration file names
* Install them as *.conf.sample -- that's what they are
* Correctly rename spantype.conf to span-types.conf (new name)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 16:05:11 +02:00
Shaun Ruffell
8d9a6bdd80 dahdi_genconf: Do not fail if pinned/assigned span utilities were not installed.
If you installed dahdi tools and did not specify DAHDI_PINNED=yes on the
makefile, when you run dahdi_genconf you would get an error like the following:

  # dahdi_genconf
  sh: span_types: command not found
  Command failed (status=32512): 'span_types dumpconfig > /etc/dahdi/span-types.conf' at ...

This change allows the generator for span-types.conf and span-assignements.conf
check for the existence of the utilities before attempting to call them.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-22 11:12:12 -06:00
Shaun Ruffell
bb19620c52 wcte43x: Teach tools about the wcte43x driver.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 15:40:11 -06:00
Shaun Ruffell
11310bde53 wcaxx: Teach tools about the wcaxx driver.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 15:39:51 -06:00
Tzafrir Cohen
b123bc87dd xpp_fxloader: support loading AB with ID > 201
Support loading firmware for Astribanks with bcdDevice > 2.01, as we'll
have 2.02 soon.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-21 16:55:18 +03:00
Oron Peled
299d9d9d9c fix typos in man-page
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-14 15:45:21 +03:00
Tzafrir Cohen
5e30a1401f Man pages for span_types and span_assignments
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-13 23:28:46 +03:00
Tzafrir Cohen
2f688f83c4 Remove dahdi_map, obsoleted by span_assignments
dahdi_map can be replaced by span_assignments list / dumpconfig

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-13 11:03:00 -04:00
Oron Peled
680f3e1d1d dahdi_registration: adapt to pinned-spans
* If xpp.dahdi_autoreg parameter is 'Y' -- Skip actuall registration.
* If dahdi.auto_assign_spans is '0' and there's no /etc/dahdi/pinned-spans.conf
  Than use 'span_assignments auto ...' to assign device spans.
* Since dahdi_registration iterate in correct xpp_order, the span
  assignment logic provides migration path for users who did not
  generate their pinned-spans.conf configuration yet.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-13 11:02:47 -04:00
Oron Peled
60fca920bc span_assignments: -k / --keys and more
* New functionality (documented in the script header):
  - Alternative "keys" for device matching
  - Added new command line options: --help, --dry-run, --verbose, --key

* Clean sysfs attribute contents from special characters in every use-case.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-13 11:01:56 -04:00
Tzafrir Cohen
c1e016fa33 Do the Right Thing when there's no config
Do the "right thing" (hopefully. At least for a system with a single
device) if there is are no configuration files:

* No span-types.conf: just ignore it as before. It is optional.
* No pinned-spans.conf: use span_assignments auto (same as having
  dahdi.auto_assign_spans=1).
* No system.conf: generate a temporary one with dahdi_genconf.

This will hopefully allow having a partially-working system, and help
making ut usable with 'span_assignments dumpconfig'. Or maybe just work
as-is.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-13 10:18:34 -04:00
Oron Peled
dc5c7de9fc dahdi_cfg: can optionally read config from stdin
Allow for the convention of '-' marking stdin:

  dahdi_cfg -c -

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-08 10:05:09 -04:00
Oron Peled
1e81ed14cf Augment dahdi_genconf default generators list
Run Add spantypes and pinnedspans generators by default.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 22:01:35 +03:00
Oron Peled
44a5285454 add new dahdi_genconf generators
* pinnedspas: For /etc/dahdi/pinned-spans.conf
* spantypes: For /etc/dahdi/span-types.conf

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 21:58:04 +03:00
Oron Peled
7a1e222309 remove unused dahdi_cfg_device_args
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 21:57:42 +03:00
Tzafrir Cohen
52488d66fa handle_device: don't fail if no config files
Allow the udev rule to work well even if there's no span-types.conf

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 21:56:47 +03:00
Oron Peled
00af777a97 Newer version of DAHDI hotplug scripts
A newer version of the scripts fully adapted to pinned spans:
* handle_device does not run dahdi_cfg.
* A separate UDEV rule script for that: span_config. Should also work
  for the non-pinned case.
* span_assignments, span_types: add actions 'auto' (manually enable all)
  and 'dumpconfig' (dump current status in the format of configuration
  file).
* Fixed name of span_types and span_assignments (no '-').
* spantype.conf renamed span-types.conf: configuration files do have a
  dash.
* Those two are useful programs, insstalled to /usr/sbin.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 21:51:46 +03:00
Shaun Ruffell
025985d9b7 build_tools/make_version: Teach version string about git.
This copies in the make_version script from DAHDI-Linux to allow the version to
be properly reported from builds in git checkouts.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-06-26 16:45:03 -05:00
Russ Meyerriecks
2380c99c5f Add support for Digium's new te13x line of cards
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-28 17:06:10 -05:00
Shaun Ruffell
8b493f5ee2 fxotune: Use DAHDI_SPECIFY when opening by integer channel number.
In DAHDI-Linux 2.7 the layout of the /dev/dahdi files changes so that they are
grouped by span. When opening channels by number all utilities need to use
DAHDI_SPECIFY now.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-28 15:17:28 -05:00
Shaun Ruffell
2889d6afee dahdi_cfg: Make -S option based on spannumber instead of order in config file.
If the config file has two spans defined:

  span=1,1,0,esf,b8zs
  bchan=1-23
  dchan=24
  echocanceller=mg2,1-23
  span=2,2,0,esf,b8zs
  bchan=25-47
  dchan=48

And you only want to configure span-2, you would need to pass -S 1 to
dahdi_cfg. Now make the -S option take the span number as assigned in the
config file.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-28 12:34:03 -05:00