[svn-commits] tzafrir: branch linux/tzafrir/sysfs r8439 - in /linux/team/tzafrir/sysfs: dri...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Mar 28 06:47:52 CDT 2010


Author: tzafrir
Date: Sun Mar 28 06:39:46 2010
New Revision: 8439

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8439
Log:
report channel signalling and alarms as strings.

* Rename 'chan_alarms' to 'alarms' (original name was due to namespace
  issues that no longer exist).
* Print the alarms string and the channel signalling as strings rather
  than as numeric value.
* This requires exposing two static functions. They will probably need
  renaming if they remain exposed. 

Modified:
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c
    linux/team/tzafrir/sysfs/include/dahdi/kernel.h

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c?view=diff&rev=8439&r1=8438&r2=8439
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c Sun Mar 28 06:39:46 2010
@@ -547,7 +547,7 @@
 }
 
 #ifdef CONFIG_PROC_FS
-static const char *sigstr(int sig)
+const char *sigstr(int sig)
 {
 	switch (sig) {
 	case DAHDI_SIG_FXSLS:
@@ -594,7 +594,7 @@
 	}
 }
 
-static int fill_alarm_string(char *buf, int count, int alarms)
+int fill_alarm_string(char *buf, int count, int alarms)
 {
 	int len;
 

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c?view=diff&rev=8439&r1=8438&r2=8439
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c Sun Mar 28 06:39:46 2010
@@ -123,13 +123,39 @@
 chan_attr(name, "%s\n");
 chan_attr(channo, "%d\n");
 chan_attr(chanpos, "%d\n");
-chan_attr(sig, "0x%x\n");
 chan_attr(sigcap, "0x%x\n");
-chan_attr(chan_alarms, "%d\n");
 chan_attr(blocksize, "%d\n");
 #ifdef OPTIMIZE_CHANMUTE
 chan_attr(chanmute, "%d\n");
 #endif
+
+static BUS_ATTR_READER(sig_show, dev, buf)
+{
+	struct dahdi_chan	*chan;
+
+	chan = dev_to_chan(dev);
+	return sprintf(buf, "%s\n", sigstr(chan->sig));
+}
+
+static BUS_ATTR_READER(in_use_show, dev, buf)
+{
+	struct dahdi_chan	*chan;
+
+	chan = dev_to_chan(dev);
+	return sprintf(buf, "%d\n", test_bit(DAHDI_FLAGBIT_OPEN, &chan->flags));
+}
+
+static BUS_ATTR_READER(alarms_show, dev, buf)
+{
+	struct dahdi_chan	*chan;
+	int			len;
+
+	chan = dev_to_chan(dev);
+	len = fill_alarm_string(buf, PAGE_SIZE, chan->chan_alarms);
+	buf[len++] = '\n';
+	return len;
+}
+
 
 static struct device_attribute chan_dev_attrs[] = {
 	__ATTR_RO(name),
@@ -137,11 +163,12 @@
 	__ATTR_RO(chanpos),
 	__ATTR_RO(sig),
 	__ATTR_RO(sigcap),
-	__ATTR_RO(chan_alarms),
+	__ATTR_RO(alarms),
 	__ATTR_RO(blocksize),
 #ifdef OPTIMIZE_CHANMUTE
 	__ATTR_RO(chanmute),
 #endif
+	__ATTR_RO(in_use),
 	__ATTR_NULL,
 };
 

Modified: linux/team/tzafrir/sysfs/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/include/dahdi/kernel.h?view=diff&rev=8439&r1=8438&r2=8439
==============================================================================
--- linux/team/tzafrir/sysfs/include/dahdi/kernel.h (original)
+++ linux/team/tzafrir/sysfs/include/dahdi/kernel.h Sun Mar 28 06:39:46 2010
@@ -1065,6 +1065,12 @@
 
 /*! \brief Get a given MF tone struct, suitable for dahdi_tone_nextsample. */
 struct dahdi_tone *dahdi_mf_tone(const struct dahdi_chan *chan, char digit, int digitmode);
+
+/*! \brief Convert signalling bits to human readable string */
+const char *sigstr(int sig);
+
+/*! \brief Convert alarm bits to human readable string */
+int fill_alarm_string(char *buf, int count, int alarms);
 
 /* Echo cancel a receive and transmit chunk for a given channel.  This
    should be called by the low-level driver as close to the interface




More information about the svn-commits mailing list