[dahdi-commits] tzafrir: linux/trunk r10347 - /linux/trunk/drivers/dahdi/xpp/card_pri.c
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Nov 29 17:38:33 CST 2011
Author: tzafrir
Date: Tue Nov 29 17:38:30 2011
New Revision: 10347
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10347
Log:
xpp: PRI: restore pri_protocol to R/W:
Restores the pri_protocol attribute of the XPD node in SysFS to be
writable. Fixes a minor regression from the pinned-spans fix, similar to
r10334.
* This attribute was made R/O in digium r10280 as part of the
pinned-spans changes:
- The E1/T1 settings were changed via new set_spantype() method
which was called from dahdi when the 'spantype' dahdi attribute
was written to.
- This fails our init_card_4_* trying to write E1/T1 into our private
attribute.
* Restored our old code (with minor modifications) so we
can set E1/T1 the old way (writing to our 'pri_protocol' attribute)
as well as the new way (when it will be used eventually).
Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Modified:
linux/trunk/drivers/dahdi/xpp/card_pri.c
Modified: linux/trunk/drivers/dahdi/xpp/card_pri.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_pri.c?view=diff&rev=10347&r1=10346&r2=10347
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_pri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_pri.c Tue Nov 29 17:38:30 2011
@@ -2261,7 +2261,43 @@
return len;
}
-static DEVICE_ATTR(pri_protocol, S_IRUGO, pri_protocol_show, NULL);
+static DEVICE_ATTR_WRITER(pri_protocol_store, dev, buf, count)
+{
+ xpd_t *xpd;
+ enum pri_protocol new_protocol = PRI_PROTO_0;
+ int i;
+ int ret;
+
+ BUG_ON(!dev);
+ xpd = dev_to_xpd(dev);
+ XPD_DBG(GENERAL, xpd, "%s\n", buf);
+ if (!xpd)
+ return -ENODEV;
+ i = strcspn(buf, " \r\n");
+ if (i != 2) {
+ XPD_NOTICE(xpd,
+ "Protocol name '%s' has %d characters (should be 2). Ignored.\n",
+ buf, i);
+ return -EINVAL;
+ }
+ if (strnicmp(buf, "E1", 2) == 0)
+ new_protocol = PRI_PROTO_E1;
+ else if (strnicmp(buf, "T1", 2) == 0)
+ new_protocol = PRI_PROTO_T1;
+ else if (strnicmp(buf, "J1", 2) == 0)
+ new_protocol = PRI_PROTO_J1;
+ else {
+ XPD_NOTICE(xpd,
+ "Unknown PRI protocol '%s' (should be E1|T1|J1). Ignored.\n",
+ buf);
+ return -EINVAL;
+ }
+ ret = set_pri_proto(xpd, new_protocol);
+ return (ret < 0) ? ret : count;
+}
+
+static DEVICE_ATTR(pri_protocol, S_IRUGO | S_IWUSR, pri_protocol_show,
+ pri_protocol_store);
static DEVICE_ATTR_READER(pri_localloop_show, dev, buf)
{
More information about the dahdi-commits
mailing list