Index: dahdi_scan.c =================================================================== --- dahdi_scan.c (revision 6886) +++ dahdi_scan.c (working copy) @@ -62,6 +62,12 @@ } for (x = 1; x < DAHDI_MAX_SPANS; x++) { + + memset(&s, 0, sizeof(s)); + s.spanno = x; + if (ioctl(ctl, DAHDI_SPANSTAT, &s)) + continue; + if (filter_count > 0) { int match = 0; for (z = 0; z < filter_count; z++) { @@ -70,14 +76,13 @@ break; } } + /* Even if we aren't displaying this span, keep track of the number + of channels anyway. */ if (!match) { + basechan += s.totalchans; continue; } } - memset(&s, 0, sizeof(s)); - s.spanno = x; - if (ioctl(ctl, DAHDI_SPANSTAT, &s)) - continue; alarms[0] = '\0'; if (s.alarms) {