[zaptel-commits] mattf: branch 1.2 r1654 - /branches/1.2/zttool.c
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Tue Nov 28 15:42:04 MST 2006
Author: mattf
Date: Tue Nov 28 16:42:03 2006
New Revision: 1654
URL: http://svn.digium.com/view/zaptel?view=rev&rev=1654
Log:
Fix for broken cards that register channels that don't exist when you try to use them (#8300) Thanks Leo Yuriev!
Modified:
branches/1.2/zttool.c
Modified: branches/1.2/zttool.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/zttool.c?view=diff&rev=1654&r1=1653&r2=1654
==============================================================================
--- branches/1.2/zttool.c (original)
+++ branches/1.2/zttool.c Tue Nov 28 16:42:03 2006
@@ -47,6 +47,7 @@
#endif
static int ctl = -1;
+static int span_max_chan_pos;
static ZT_SPANINFO s[ZT_MAX_SPANS];
@@ -199,14 +200,14 @@
memset(tdbits,0, sizeof(tdbits));
memset(rcbits,0, sizeof(rcbits));
memset(rdbits,0, sizeof(rdbits));
- memset(tabits,32, s[span].totalchans);
- memset(tbbits,32, s[span].totalchans);
- memset(rabits,32, s[span].totalchans);
- memset(rbbits,32, s[span].totalchans);
- memset(tcbits,32, s[span].totalchans);
- memset(tdbits,32, s[span].totalchans);
- memset(rcbits,32, s[span].totalchans);
- memset(rdbits,32, s[span].totalchans);
+ memset(tabits,32, span_max_chan_pos);
+ memset(tbbits,32, span_max_chan_pos);
+ memset(rabits,32, span_max_chan_pos);
+ memset(rbbits,32, span_max_chan_pos);
+ memset(tcbits,32, span_max_chan_pos);
+ memset(tdbits,32, span_max_chan_pos);
+ memset(rcbits,32, span_max_chan_pos);
+ memset(rdbits,32, span_max_chan_pos);
for (x=0;x<ZT_MAX_CHANNELS;x++) {
memset(&zp, 0, sizeof(zp));
@@ -337,9 +338,9 @@
newtComponent syncsrc;
newtComponent irqmisses;
- char s1[] = " 1111111111222222222333";
- char s2[] = "1234567890123456789012345789012";
- int max;
+ char s1[] = " 1111111111222222222233";
+ char s2[] = "1234567890123456789012345678901";
+ int x;
int looped = 0;
struct newtExitStruct es;
@@ -364,14 +365,24 @@
newtFormAddComponents(form, back, loop, NULL);
- max = s[span].totalchans;
- if (max > 32)
- max = 32;
-
- s1[max] = '\0';
- s2[max] = '\0';
-
- bitbox = newtTextbox(8,10,max,9,0);
+ span_max_chan_pos = s[span].totalchans;
+ for (x=0;x<ZT_MAX_CHANNELS;x++) {
+ ZT_PARAMS zp;
+ int res;
+ memset(&zp, 0, sizeof(zp));
+ zp.channo = x;
+ res = ioctl(ctl, ZT_GET_PARAMS, &zp);
+ if (!res && zp.spanno == span && zp.chanpos > span_max_chan_pos )
+ span_max_chan_pos = zp.chanpos;
+ }
+
+ if (span_max_chan_pos > 32)
+ span_max_chan_pos = 32;
+
+ s1[span_max_chan_pos] = '\0';
+ s2[span_max_chan_pos] = '\0';
+
+ bitbox = newtTextbox(8,10,span_max_chan_pos,9,0);
newtFormAddComponent(form, bitbox);
label = newtLabel(8,8,s1);
@@ -482,6 +493,7 @@
newtFormDestroy(form);
newtPopWindow();
newtPopHelpLine();
+ span_max_chan_pos = 0;
}
static void show_spans(void)
More information about the zaptel-commits
mailing list