summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-09-29 01:19:59 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-09-29 01:19:59 +0000
commit29c4eb44ca49102abd9e20ba4694e0492e214627 (patch)
tree776c01d76d37883514455b3bdafc74d22be2dcc6
parentbe22da9f894210e41a79733e4e45d76aff56bb34 (diff)
allow ZT_GETPARAMS to return the master channel number for a channel
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@780 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xzaptel.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/zaptel.c b/zaptel.c
index c3096b1..6a68ffe 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -2754,10 +2754,18 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c
unsigned long flags;
#endif
int i,j;
+ int return_master = 0;
switch(cmd) {
case ZT_GET_PARAMS: /* get channel timing parameters */
copy_from_user(&stack.param,(struct zt_params *)data,sizeof(stack.param));
+
+ /* check to see if the caller wants to receive our master channel number */
+ if (stack.param.channo & 0x40000000) {
+ return_master = 1;
+ stack.param.channo &= ~0x40000000;
+ }
+
/* Pick the right channo's */
if (!stack.param.channo || unit) {
stack.param.channo = unit;
@@ -2766,7 +2774,11 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c
VALID_CHANNEL(stack.param.channo);
chan = chans[stack.param.channo];
- /* point to relevant structure */
+ /* if requested, put the master channel number in the top 16 bits of the result */
+ if (return_master)
+ stack.param.channo |= chan->master->channo << 16;
+
+ /* point to relevant structure */
stack.param.sigtype = chan->sig; /* get signalling type */
/* return non-zero if rx not in idle state */
if (chan->span) {