summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2012-02-22 12:10:59 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2012-02-22 12:10:59 +0000
commit12336c61e43d7cff62ca9547c418875f8c876fdb (patch)
treebcff9f43daf68b2edf5dd7fc91d5d1caa08a305b
parentcea472e488fc6b17c0fa5922c9618bb3e5a35f72 (diff)
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@xorcom.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> Acked-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10461 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--README6
-rw-r--r--drivers/dahdi/dahdi-sysfs.c30
2 files changed, 36 insertions, 0 deletions
diff --git a/README b/README
index c94c2be..f1d3e6c 100644
--- a/README
+++ b/README
@@ -802,6 +802,12 @@ A free-form description of the span.
===== /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.
diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
index 3641606..b3b10d8 100644
--- a/drivers/dahdi/dahdi-sysfs.c
+++ b/drivers/dahdi/dahdi-sysfs.c
@@ -259,6 +259,35 @@ static BUS_ATTR_READER(channels_show, dev, buf)
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 @@ static struct device_attribute span_dev_attrs[] = {
__ATTR_RO(is_sync_master),
__ATTR_RO(basechan),
__ATTR_RO(channels),
+ __ATTR_RO(lineconfig),
__ATTR_NULL,
};