summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {