From 3fc23b446584995609bfb1dd09564c0e3e2229ec Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Wed, 26 Oct 2011 19:08:33 +0000 Subject: [PATCH] added 'basechan' and 'channels' attributes to spans * So we can: - Generate 'pinned-spans.conf' from existing state - Run dahdi_cfg from udev (on specific span + its channels) Signed-off-by: Oron Peled git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10286 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-sysfs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c index 5dcd6b8..5dbd539 100644 --- a/drivers/dahdi/dahdi-sysfs.c +++ b/drivers/dahdi/dahdi-sysfs.c @@ -246,6 +246,22 @@ static BUS_ATTR_READER(is_sync_master_show, dev, buf) return sprintf(buf, "%d\n", dahdi_is_sync_master(span)); } +static BUS_ATTR_READER(basechan_show, dev, buf) +{ + struct dahdi_span *span; + + span = dev_to_span(dev); + return sprintf(buf, "%d\n", span->chans[0]->channo); +} + +static BUS_ATTR_READER(channels_show, dev, buf) +{ + struct dahdi_span *span; + + span = dev_to_span(dev); + return sprintf(buf, "%d\n", span->channels); +} + static struct device_attribute span_dev_attrs[] = { __ATTR_RO(name), __ATTR_RO(desc), @@ -256,6 +272,8 @@ static struct device_attribute span_dev_attrs[] = { __ATTR_RO(syncsrc), __ATTR_RO(is_digital), __ATTR_RO(is_sync_master), + __ATTR_RO(basechan), + __ATTR_RO(channels), __ATTR_NULL, };