From 29c4eb44ca49102abd9e20ba4694e0492e214627 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Thu, 29 Sep 2005 01:19:59 +0000 Subject: 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 --- zaptel.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3