[dahdi-commits] dahdi/tools.git branch "master" updated.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu May 23 17:19:27 CDT 2013


branch "master" has been updated
       via  de23ca9c1a6055f187b16f059661691109a382c0 (commit)
       via  1f26e30907aab1d7dff258f71017f371a5cc0279 (commit)
       via  17027df04b5aa2d49258f74adf0152ac4a5aeb46 (commit)
      from  eacc071afe6e8ae388341b7181b399fa868a3466 (commit)

Summary of changes:
 .gitignore   |   36 ++++++++++++++++++++++++++++++++++++
 dahdi.init   |    9 +++++++++
 dahdi_scan.c |   31 +++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
 create mode 100644 .gitignore


- Log -----------------------------------------------------------------
commit de23ca9c1a6055f187b16f059661691109a382c0
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Thu May 23 19:49:57 2013 +0300

    Don't fail init script if no modules
    
    No point in loading the modules if nobody built them yet. It is a common
    case for one to install the userspace tools package but not (yet?) build
    the modules. See, e.g.  http://bugs.debian.org/706046 .
    
    With this changeset, we exit gracefully in such a case.
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/dahdi.init b/dahdi.init
index 5fe3cec..c772a92 100755
--- a/dahdi.init
+++ b/dahdi.init
@@ -227,6 +227,11 @@ load_modules() {
 	echo ""
 }
 
+# Make sure that either dahdi is loaded or modprobe-able
+dahdi_modules_loadable() {
+	modinfo dahdi >/dev/null 2>&1 || lsmod | grep -q -w ^dahdi
+}
+
 if [ ! -x "$DAHDI_CFG" ]; then
        echo "dahdi_cfg not executable"
        exit 0
@@ -242,6 +247,10 @@ RETVAL=0
 # See how we were called.
 case "$1" in
   start)
+	if ! dahdi_modules_loadable; then
+		echo "No DAHDI modules on the system. Not starting"
+		exit 0
+	fi
   	if hotplug_should_load_modules; then
 		load_modules
 	fi

commit 1f26e30907aab1d7dff258f71017f371a5cc0279
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Thu May 23 19:49:56 2013 +0300

    Ignore generated files
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..efd4f50
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,36 @@
+*.o
+.*.o.d
+.*.lo.d
+build_tools/menuselect-deps
+config.log
+config.status
+dahdi_cfg
+dahdi_maint
+dahdi_monitor
+dahdi_scan
+dahdi_speed
+dahdi_test
+dahdi_tool
+fxotune
+libtonezone.a
+libtonezone.so
+makeopts
+sethdlc
+tonezone.lo
+version.c
+xpp/.depend
+xpp/.octasic.depend
+xpp/.perlcheck
+xpp/astribank_allow
+xpp/astribank_hexload
+xpp/astribank_is_starting
+xpp/astribank_tool
+xpp/dahdi_genconf.8
+xpp/dahdi_hardware.8
+xpp/dahdi_registration.8
+xpp/lsdahdi.8
+xpp/test_parse
+xpp/twinstar.8
+xpp/xpp_blink.8
+xpp/xpp_sync.8
+zonedata.lo

commit 17027df04b5aa2d49258f74adf0152ac4a5aeb46
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Tue Apr 16 21:33:05 2013 -0500

    dahdi_scan: Support gaps in channel numbering.
    
    If, via the sysfs attributed introduced in DAHDI-Linux 2.5.0, a user has
    configured spans that do not have contiguous channel numbers, dahdi_scan will
    not print several of the span attributes in addition to a bad basechan number.
    
    This patch allows dahdi_scan to try and get the basechan for a span from sysfs
    as opposed to calculating based on the number of channels in the previous span
    scanned.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/dahdi_scan.c b/dahdi_scan.c
index 20a9a4b..7b28a52 100644
--- a/dahdi_scan.c
+++ b/dahdi_scan.c
@@ -42,12 +42,35 @@ static inline int is_digital_span(struct dahdi_spaninfo *s)
 	return (s->linecompat > 0);
 }
 
+static int get_basechan(unsigned int spanno)
+{
+	int res;
+	int basechan;
+	char filename[256];
+	FILE *fp;
+
+	snprintf(filename, sizeof(filename),
+		 "/sys/bus/dahdi_spans/devices/span-%u/basechan", spanno);
+	fp = fopen(filename, "r");
+	if (NULL == fp) {
+		return -1;
+	}
+	res = fscanf(fp, "%d", &basechan);
+	fclose(fp);
+	if (EOF == res) {
+		return -1;
+	}
+	return basechan;
+}
+
+
 int main(int argc, char *argv[])
 {
 	int ctl;
 	int x, y, z;
 	struct dahdi_params params;
 	unsigned int basechan = 1;
+	int direct_basechan;
 	struct dahdi_spaninfo s;
 	char buf[100];
 	char alarms[50];
@@ -87,6 +110,14 @@ int main(int argc, char *argv[])
 			}
 		}
 
+		/* DAHDI-Linux 2.5.x exposes the base channel in sysfs. Let's
+		 * try to look for it there in case there are holes in the span
+		 * numbering. */
+		direct_basechan = get_basechan(x);
+		if (-1 != direct_basechan) {
+			basechan = direct_basechan;
+		}
+
 		alarms[0] = '\0';
 		if (s.alarms) {
 			if (s.alarms & DAHDI_ALARM_BLUE)

-----------------------------------------------------------------------


-- 
dahdi/tools.git



More information about the dahdi-commits mailing list