[svn-commits] tzafrir: linux/trunk r10461 - in /linux/trunk: ./ drivers/dahdi/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Feb 22 06:11:03 CST 2012


Author: tzafrir
Date: Wed Feb 22 06:10:59 2012
New Revision: 10461

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10461
Log:
sysfs: add 'lineconfig' attribute to span

This patch exposes the span 'lineconfig' via sysfs: textual representation
of the framing and coding of the span.

This is needed in order for the Dahdi perl classes (in tools) to get
the inforamtion for e.g. dahdi_genconf to work without the guesswork of
parsing /proc/dahdi .

Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/README
    linux/trunk/drivers/dahdi/dahdi-sysfs.c

Modified: linux/trunk/README
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/README?view=diff&rev=10461&r1=10460&r2=10461
==============================================================================
--- linux/trunk/README (original)
+++ linux/trunk/README Wed Feb 22 06:10:59 2012
@@ -802,6 +802,12 @@
 ===== /sys/bus/dahdi_spans/devices/span-N/lbo
 LBO setting for the channel.
 
+===== /sys/bus/dahdi_spans/devices/span-N/lineconfig
+The framing and coding of the span, for a digital span. Textual
+represenation:
+
+<B8ZS|AMI|HDB3>/<D4|ESF|CCS>[/CRC4]
+
 ===== /sys/bus/dahdi_spans/devices/span-N/local_spanno
 The number of the span within the DAHDI device.
 

Modified: linux/trunk/drivers/dahdi/dahdi-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-sysfs.c?view=diff&rev=10461&r1=10460&r2=10461
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-sysfs.c Wed Feb 22 06:10:59 2012
@@ -259,6 +259,35 @@
 	return sprintf(buf, "%d\n", span->channels);
 }
 
+static BUS_ATTR_READER(lineconfig_show, dev, buf)
+{
+	struct dahdi_span *span;
+	int len = 0;
+
+	span = dev_to_span(dev);
+	if (span->lineconfig) {
+		/* framing first */
+		if (span->lineconfig & DAHDI_CONFIG_B8ZS)
+			len += sprintf(buf + len, "B8ZS/");
+		else if (span->lineconfig & DAHDI_CONFIG_AMI)
+			len += sprintf(buf + len, "AMI/");
+		else if (span->lineconfig & DAHDI_CONFIG_HDB3)
+			len += sprintf(buf + len, "HDB3/");
+		/* then coding */
+		if (span->lineconfig & DAHDI_CONFIG_ESF)
+			len += sprintf(buf + len, "ESF");
+		else if (span->lineconfig & DAHDI_CONFIG_D4)
+			len += sprintf(buf + len, "D4");
+		else if (span->lineconfig & DAHDI_CONFIG_CCS)
+			len += sprintf(buf + len, "CCS");
+		/* E1's can enable CRC checking */
+		if (span->lineconfig & DAHDI_CONFIG_CRC4)
+			len += sprintf(buf + len, "/CRC4");
+	}
+	len += sprintf(buf + len, "\n");
+	return len;
+}
+
 static struct device_attribute span_dev_attrs[] = {
 	__ATTR_RO(name),
 	__ATTR_RO(desc),
@@ -271,6 +300,7 @@
 	__ATTR_RO(is_sync_master),
 	__ATTR_RO(basechan),
 	__ATTR_RO(channels),
+	__ATTR_RO(lineconfig),
 	__ATTR_NULL,
 };
 




More information about the svn-commits mailing list