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@xorcom.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10347 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
committed by
Tzafrir Cohen
parent
244c9bd254
commit
c4616c6c86
@@ -2261,7 +2261,43 @@ static DEVICE_ATTR_READER(pri_protocol_show, dev, buf)
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user