[svn-commits] kpfleming: branch kpfleming/ztscan r3277 - in /team/kpfleming/ztscan: ./ wct4...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 4 07:52:41 CST 2007


Author: kpfleming
Date: Tue Dec  4 07:52:41 2007
New Revision: 3277

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3277
Log:
copy working copy into branch to make merge easier

Added:
    team/kpfleming/ztscan/   (props changed)
      - copied from r3276, branches/1.4/
    team/kpfleming/ztscan/ztscan.c   (with props)
Modified:
    team/kpfleming/ztscan/Makefile
    team/kpfleming/ztscan/tor2.c
    team/kpfleming/ztscan/torisa.c
    team/kpfleming/ztscan/wcfxo.c
    team/kpfleming/ztscan/wct1xxp.c
    team/kpfleming/ztscan/wct4xxp/base.c
    team/kpfleming/ztscan/wctdm.c
    team/kpfleming/ztscan/wctdm24xxp/base.c
    team/kpfleming/ztscan/wctdm24xxp/wctdm24xxp.h
    team/kpfleming/ztscan/wcte11xp.c
    team/kpfleming/ztscan/wcte12xp.c
    team/kpfleming/ztscan/wcusb.c
    team/kpfleming/ztscan/wcusb.h
    team/kpfleming/ztscan/zaptel-base.c
    team/kpfleming/ztscan/zaptel.h
    team/kpfleming/ztscan/ztdummy.c

Propchange: team/kpfleming/ztscan/
------------------------------------------------------------------------------
--- branch-1.2-blocked (added)
+++ branch-1.2-blocked Tue Dec  4 07:52:41 2007
@@ -1,0 +1,1 @@
+/branches/1.2:917,937,1073,1206,1613,2018,2434,2583,2668,2750,2789,2868,2871,2878,3083,3098-3099,3201

Propchange: team/kpfleming/ztscan/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/kpfleming/ztscan/
------------------------------------------------------------------------------
--- svn:externals (added)
+++ svn:externals Tue Dec  4 07:52:41 2007
@@ -1,0 +1,2 @@
+menuselect https://origsvn.digium.com/svn/menuselect/branches/1.0
+oct612x http://svn.digium.com/svn/octasic_api/oct612x/tags/PR49-00/software

Propchange: team/kpfleming/ztscan/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Dec  4 07:52:41 2007
@@ -1,0 +1,49 @@
+sethdlc-new
+ztdiag
+zttool
+ztspeed
+ztmonitor
+ztcfg
+zonedata.lo
+torisatool
+tor2fw.h
+radfw.h
+tonezone.lo
+tones.h
+makefw
+libtonezone.so.1.0
+gendigits
+fxstest
+zttest
+fxotune
+patlooptest
+hdlcstress
+ztcfg-dude
+hdlctest
+timertest
+pattest
+hdlcgen
+usbfxstest
+patgen
+hdlcverify
+*.ko
+*.mod.c
+.*.cmd
+.tmp_versions
+*.so
+*.a
+version.h
+vpm450m_fw.h
+fw2h
+autom4te.cache
+missing
+makeopts
+menuselect.makeopts
+menuselect.makedeps
+config.log
+config.status
+menuselect-tree
+Modules.symvers
+Module.symvers
+README.html
+ztscan

Modified: team/kpfleming/ztscan/Makefile
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/Makefile?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/Makefile (original)
+++ team/kpfleming/ztscan/Makefile Tue Dec  4 07:52:41 2007
@@ -235,7 +235,8 @@
 
 # Utilities we build with a standard build procedure:
 UTILS		= zttool zttest ztmonitor ztspeed sethdlc-new ztcfg \
-		  ztcfg-dude usbfxstest fxstest fxotune ztdiag torisatool
+		  ztcfg-dude usbfxstest fxstest fxotune ztdiag torisatool \
+		  ztscan
 
 
 # Makefile mentions them. Source is not included (anynore?)
@@ -247,7 +248,7 @@
 
 UTILSO		= $(UTILS:%=%.o)
 
-BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest zttool
+BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest zttool ztscan
 BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS))
 MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8))
 
@@ -320,17 +321,19 @@
 
 prereq: config.status tones.h tor2fw.h radfw.h version.h
 
-zttool.o: zttool.c zaptel.h
-zttool.o: CFLAGS+=$(NEWT_INCLUDE)
-
-ztprovision.o: ztprovision.c zaptel.h
-
-ztmonitor.o: ztmonitor.c zaptel.h
+zttool: zaptel.h
+zttool: CFLAGS+=$(NEWT_INCLUDE)
+zttool: LDLIBS+=$(NEWT_LIB)
+
+ztscan: zaptel.h
+
+ztprovision: zaptel.h
+
+ztmonitor: zaptel.h
 
 ztspeed: CFLAGS=
-ztspeed.o: CFLAGS=
-zttool: LDLIBS+=$(NEWT_LIB)
-sethdlc-new.o: CFLAGS+=-I$(KINCLUDES)
+
+sethdlc-new: CFLAGS+=-I$(KINCLUDES)
 
 $(LTZ_A): $(LTZ_A_OBJS)
 	ar rcs $@ $^
@@ -339,19 +342,18 @@
 $(LTZ_SO): $(LTZ_SO_OBJS)
 	$(CC) $(CFLAGS) -shared -Wl,-soname,$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) -o $@ $^ $(LDFLAGS) $(LDLIBS) -lm
 
-ztcfg.c: ztcfg.h
+ztcfg.o: ztcfg.h zaptel.h
+ztcfg: ztcfg.o $(LTZ_A)
+ztcfg: LDLIBS+=-lm
 
 ztcfg-shared: ztcfg.o $(LTZ_SO)
 	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) -lm
 
+ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LTZ_SO)
+ztcfg-dude: LDLIBS+=-lm -lstdc++
+
 data:
 	$(MAKE) -C datamods datamods
-
-ztcfg: ztcfg.o $(LTZ_A)
-ztcfg: LDLIBS+=-lm
-
-ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LTZ_SO)
-ztcfg-dude: LDLIBS+=-lm -lstdc++
 
 # FIXME: we assume CC can build the C++ modules:
 complex.o mknotch.o: %.o: %.cc

Modified: team/kpfleming/ztscan/tor2.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/tor2.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/tor2.c (original)
+++ team/kpfleming/ztscan/tor2.c Tue Dec  4 07:52:41 2007
@@ -269,15 +269,11 @@
 {
 	int x, y, c;
 	for (x = 0; x < SPANS_PER_CARD; x++) {
-		sprintf(tor->spans[x].name,
-                	"Tor2/%d/%d", 
-		        tor->num,
-                        x + 1);
-		sprintf(tor->spans[x].desc,
-                	"Tormenta 2 (PCI) Quad %s Card %d Span %d",
-                        (tor->cardtype == TYPE_T1)  ?  "T1"  :  "E1",
-                	tor->num,
-                        x + 1);
+		sprintf(tor->spans[x].name, "Tor2/%d/%d", tor->num, x + 1);
+		sprintf(tor->spans[x].desc, "Tormenta 2 (PCI) Quad %s Card %d Span %d", (tor->cardtype == TYPE_T1)  ?  "T1"  :  "E1", tor->num, x + 1);
+		tor->spans[x].manufacturer = "Digium";
+		tor->spans[x].devicetype = tor->type;
+		sprintf(tor->spans[x].location, "PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
 		tor->spans[x].spanconfig = tor2_spanconfig;
 		tor->spans[x].chanconfig = tor2_chanconfig;
 		tor->spans[x].startup = tor2_startup;
@@ -289,13 +285,16 @@
 		if (tor->cardtype == TYPE_T1) {
 			tor->spans[x].channels = 24;
 			tor->spans[x].deflaw = ZT_LAW_MULAW;
+			tor->spans[x].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+			tor->spans[x].spantype = "T1";
 		} else {
 			tor->spans[x].channels = 31;
 			tor->spans[x].deflaw = ZT_LAW_ALAW;
+			tor->spans[x].linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+			tor->spans[x].spantype = "E1";
 		}
 		tor->spans[x].chans = tor->chans[x];
 		tor->spans[x].flags = ZT_FLAG_RBS;
-		tor->spans[x].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 		tor->spans[x].ioctl = tor2_ioctl;
 		tor->spans[x].pvt = &tor->tspans[x];
 		tor->tspans[x].tor = tor;
@@ -1518,6 +1517,3 @@
 
 module_init(tor2_init);
 module_exit(tor2_cleanup);
-
-
-

Modified: team/kpfleming/ztscan/torisa.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/torisa.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/torisa.c (original)
+++ team/kpfleming/ztscan/torisa.c Tue Dec  4 07:52:41 2007
@@ -1077,8 +1077,11 @@
 		free_irq(irq, NULL);
 		return -EIO;
 	}
+
 	strcpy(spans[0].name, "TorISA/1");
 	strcpy(spans[0].desc, "ISA Tormenta Span 1");
+	spans[0].manufacturer = "Digium";
+	spans[0].devicetype = "Tormenta ISA";
 	spans[0].spanconfig = torisa_spanconfig;
 	spans[0].chanconfig = torisa_chanconfig;
 	spans[0].startup = torisa_startup;
@@ -1090,35 +1093,25 @@
 	spans[0].channels = channels_per_span;
 	spans[0].chans = &chans[0];
 	spans[0].flags = ZT_FLAG_RBS;
-	spans[0].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 	spans[0].ioctl = torisa_ioctl;
 	spans[0].irq = irq;
-	init_waitqueue_head(&spans[0].maintq);
-
-
+
+	if (card_type == TYPE_E1) {
+		spans[0].spantype = "T1";
+		spans[0].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+		spans[0].deflaw = ZT_LAW_ALAW;
+	} else {
+		spans[0].spantype = "E1";
+		spans[0].linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+		spans[0].deflaw = ZT_LAW_MULAW;
+	}
+
+	spans[1] = spans[0];
 	strcpy(spans[1].name, "TorISA/2");
 	strcpy(spans[1].desc, "ISA Tormenta Span 2");
-	spans[1].spanconfig = torisa_spanconfig;
-	spans[1].chanconfig = torisa_chanconfig;
-	spans[1].startup = torisa_startup;
-	spans[1].shutdown = torisa_shutdown;
-	spans[1].rbsbits = torisa_rbsbits;
-	spans[1].maint = torisa_maint;
-	spans[1].open = torisa_open;
-	spans[1].close = torisa_close;
-	spans[1].channels = channels_per_span;
 	spans[1].chans = &chans[channels_per_span];
-	spans[1].flags = ZT_FLAG_RBS;
-	spans[1].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
-	spans[1].ioctl = torisa_ioctl;
-	spans[1].irq = irq;
-	if (card_type == TYPE_E1) {
-		spans[0].deflaw = ZT_LAW_ALAW;
-		spans[1].deflaw = ZT_LAW_ALAW;
-	} else {
-		spans[0].deflaw = ZT_LAW_MULAW;
-		spans[1].deflaw = ZT_LAW_MULAW;
-	}
+
+	init_waitqueue_head(&spans[0].maintq);
 	init_waitqueue_head(&spans[1].maintq);
 
 	make_chans();

Modified: team/kpfleming/ztscan/wcfxo.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wcfxo.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wcfxo.c (original)
+++ team/kpfleming/ztscan/wcfxo.c Tue Dec  4 07:52:41 2007
@@ -627,6 +627,9 @@
 	sprintf(wc->span.name, "WCFXO/%d", wc->pos);
 	sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
 	sprintf(wc->chan.name, "WCFXO/%d/%d", wc->pos, 0);
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
 	wc->chan.sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF;
 	wc->chan.chanpos = 1;
 	wc->span.chans = &wc->chan;

Modified: team/kpfleming/ztscan/wct1xxp.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wct1xxp.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wct1xxp.c (original)
+++ team/kpfleming/ztscan/wct1xxp.c Tue Dec  4 07:52:41 2007
@@ -747,7 +747,6 @@
 		return t1xxp_startup(span);
 	return 0;
 }
-
 static int t1xxp_software_init(struct t1xxp *wc)
 {
 	int x;
@@ -763,6 +762,9 @@
 	wc->num = x;
 	sprintf(wc->span.name, "WCT1/%d", wc->num);
 	sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 	wc->span.spanconfig = t1xxp_spanconfig;
 	wc->span.chanconfig = t1xxp_chanconfig;
 	wc->span.irq = wc->dev->irq;
@@ -778,13 +780,17 @@
 		wc->span.channels = 24;
 	wc->span.chans = wc->chans;
 	wc->span.flags = ZT_FLAG_RBS;
-	wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 	wc->span.ioctl = t1xxp_ioctl;
 	wc->span.pvt = wc;
-	if (wc->ise1)
+	if (wc->ise1) {
 		wc->span.deflaw = ZT_LAW_ALAW;
-	else
+		wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+		wc->span.spantype = "T1";
+	} else {
 		wc->span.deflaw = ZT_LAW_MULAW;
+		wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+		wc->span.spantype = "E1";
+	}
 	init_waitqueue_head(&wc->span.maintq);
 	for (x=0;x<wc->span.channels;x++) {
 		sprintf(wc->chans[x].name, "WCT1/%d/%d", wc->num, x + 1);

Modified: team/kpfleming/ztscan/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wct4xxp/base.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wct4xxp/base.c (original)
+++ team/kpfleming/ztscan/wct4xxp/base.c Tue Dec  4 07:52:41 2007
@@ -210,7 +210,8 @@
 #define FLAG_VPM2GEN (1 << 5)
 #define FLAG_OCTOPT  (1 << 6)
 #define FLAG_3RDGEN  (1 << 7)
-#define FLAG_BURST  (1 << 8)
+#define FLAG_BURST   (1 << 8)
+#define FLAG_EXPRESS (1 << 9)
 
 #define CANARY 0xc0de
 
@@ -220,14 +221,14 @@
 };
 
 static struct devtype wct4xxp = { "Wildcard TE410P/TE405P (1st Gen)", 0 };
-static struct devtype wct420p4 = { "Wildcard TE420 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN };
+static struct devtype wct420p4 = { "Wildcard TE420 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_EXPRESS };
 static struct devtype wct410p4 = { "Wildcard TE410P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct410p3 = { "Wildcard TE410P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct405p4 = { "Wildcard TE405P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct405p3 = { "Wildcard TE405P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct410p2 = { "Wildcard TE410P (2nd Gen)", FLAG_2NDGEN };
 static struct devtype wct405p2 = { "Wildcard TE405P (2nd Gen)", FLAG_2NDGEN };
-static struct devtype wct220p4 = { "Wildcard TE220 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
+static struct devtype wct220p4 = { "Wildcard TE220 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT | FLAG_EXPRESS };
 static struct devtype wct205p4 = { "Wildcard TE205P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
 static struct devtype wct205p3 = { "Wildcard TE205P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
 static struct devtype wct210p4 = { "Wildcard TE210P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
@@ -1526,11 +1527,24 @@
 	gen2 = (wc->tspans[0]->spanflags & FLAG_2NDGEN);
 	if (!wc->t1e1)
 		offset += 4;
-	for (x=0;x<wc->numspans;x++) {
+	for (x = 0; x < wc->numspans; x++) {
 		ts = wc->tspans[x];
-		sprintf(ts->span.name, "TE%d/%d/%d", wc->numspans,
-		       wc->num, x + 1);
+		sprintf(ts->span.name, "TE%d/%d/%d", wc->numspans, wc->num, x + 1);
 		sprintf(ts->span.desc, "T%dXXP (PCI) Card %d Span %d", wc->numspans, wc->num, x+1);
+		ts->span.manufacturer = "Digium";
+		ts->span.devicetype = wc->variety;
+		sprintf(ts->span.location, "PCI%sBus %02d Slot %02d", ts->spanflags & FLAG_EXPRESS ? " Express" : " ", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+		switch (ts->spantype) {
+		case TYPE_T1:
+			ts->span.spantype = "T1";
+			break;
+		case TYPE_E1:
+			ts->span.spantype = "E1";
+			break;
+		case TYPE_J1:
+			ts->span.spantype = "J1";
+			break;
+		}
 		ts->span.spanconfig = t4_spanconfig;
 		ts->span.chanconfig = t4_chanconfig;
 		ts->span.irq = wc->dev->irq;
@@ -1549,13 +1563,14 @@
 		if (ts->spantype == TYPE_T1 || ts->spantype == TYPE_J1) {
 			ts->span.channels = 24;
 			ts->span.deflaw = ZT_LAW_MULAW;
+			ts->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 		} else {
 			ts->span.channels = 31;
 			ts->span.deflaw = ZT_LAW_ALAW;
+			ts->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
 		}
 		ts->span.chans = ts->chans;
 		ts->span.flags = ZT_FLAG_RBS;
-		ts->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 		ts->span.ioctl = t4_ioctl;
 		ts->span.hdlc_hard_xmit = t4_hdlc_hard_xmit;
 		if (gen2) {

Modified: team/kpfleming/ztscan/wctdm.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wctdm.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wctdm.c (original)
+++ team/kpfleming/ztscan/wctdm.c Tue Dec  4 07:52:41 2007
@@ -2023,6 +2023,9 @@
 	/* Zapata stuff */
 	sprintf(wc->span.name, "WCTDM/%d", wc->pos);
 	sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
 	if (alawoverride) {
 		printk("ALAW override parameter detected.  Device will be operating in ALAW\n");
 		wc->span.deflaw = ZT_LAW_ALAW;

Modified: team/kpfleming/ztscan/wctdm24xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wctdm24xxp/base.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wctdm24xxp/base.c (original)
+++ team/kpfleming/ztscan/wctdm24xxp/base.c Tue Dec  4 07:52:41 2007
@@ -253,8 +253,8 @@
 static struct wctdm_desc wctdm2400 = { "Wildcard TDM2400P", 0, 24 };
 static struct wctdm_desc wctdm800 = { "Wildcard TDM800P", 0, 8 };
 static struct wctdm_desc wctdm410 = { "Wildcard TDM410P", 0, 4 };
-static struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", 0, 24 };
-static struct wctdm_desc wcaex800 = { "Wildcard AEX800", 0, 8 };
+static struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", FLAG_EXPRESS, 24 };
+static struct wctdm_desc wcaex800 = { "Wildcard AEX800", FLAG_EXPRESS, 8 };
 
 static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x2, 0x0, 0x3 };
 
@@ -3046,6 +3046,9 @@
 	/* Zapata stuff */
 	sprintf(wc->span.name, "WCTDM/%d", wc->pos);
 	sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
+	sprintf(wc->span.location, "PCI%s Bus %02d Slot %02d", (wc->flags[0] & FLAG_EXPRESS) ? " Express" : "", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
 	if (alawoverride) {
 		printk("ALAW override parameter detected.  Device will be operating in ALAW\n");
 		wc->span.deflaw = ZT_LAW_ALAW;

Modified: team/kpfleming/ztscan/wctdm24xxp/wctdm24xxp.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wctdm24xxp/wctdm24xxp.h?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wctdm24xxp/wctdm24xxp.h (original)
+++ team/kpfleming/ztscan/wctdm24xxp/wctdm24xxp.h Tue Dec  4 07:52:41 2007
@@ -22,6 +22,7 @@
 #define OHT_TIMER		6000	/* How long after RING to retain OHT */
 
 #define FLAG_3215	(1 << 0)
+#define FLAG_EXPRESS	(1 << 1)
 
 #define EFRAME_SIZE	108
 #define ERING_SIZE 16		/* Maximum ring size */

Modified: team/kpfleming/ztscan/wcte11xp.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wcte11xp.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wcte11xp.c (original)
+++ team/kpfleming/ztscan/wcte11xp.c Tue Dec  4 07:52:41 2007
@@ -972,6 +972,9 @@
 	wc->num = x;
 	sprintf(wc->span.name, "WCT1/%d", wc->num);
 	sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 	wc->span.spanconfig = t1xxp_spanconfig;
 	wc->span.chanconfig = t1xxp_chanconfig;
 	wc->span.irq = wc->dev->irq;
@@ -986,11 +989,15 @@
 			wc->span.channels = 32;
 		else
 			wc->span.channels = 31;
-	} else
+		wc->span.spantype = "E1";
+		wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+	} else {
 		wc->span.channels = 24;
+		wc->span.spantype = "T1";
+		wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+	}
 	wc->span.chans = wc->chans;
 	wc->span.flags = ZT_FLAG_RBS;
-	wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 	wc->span.ioctl = t1xxp_ioctl;
 	wc->span.pvt = wc;
 	if (wc->spantype == TYPE_E1)

Modified: team/kpfleming/ztscan/wcte12xp.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wcte12xp.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wcte12xp.c (original)
+++ team/kpfleming/ztscan/wcte12xp.c Tue Dec  4 07:52:41 2007
@@ -1353,6 +1353,9 @@
 	wc->num = x;
 	sprintf(wc->span.name, "WCT1/%d", wc->num);
 	sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 
 	wc->span.spanconfig = t1xxp_spanconfig;
 	wc->span.chanconfig = t1xxp_chanconfig;
@@ -1370,8 +1373,13 @@
 			wc->span.channels = 32;
 		else
 			wc->span.channels = 31;
-	} else
+		wc->span.spantype = "E1";
+		wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+	} else {
 		wc->span.channels = 24;
+		wc->span.spantype = "T1";
+		wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+	}
 	wc->span.chans = wc->chans;
 	wc->span.flags = ZT_FLAG_RBS;
 	wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;

Modified: team/kpfleming/ztscan/wcusb.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wcusb.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wcusb.c (original)
+++ team/kpfleming/ztscan/wcusb.c Tue Dec  4 07:52:41 2007
@@ -1250,6 +1250,8 @@
 	sprintf(p->span.name, "WCUSB/%d", x);
 	sprintf(p->span.desc,"%s %d", p->span.name, x);
         sprintf(p->chan.name, "WCUSB/%d/%d", x, 0);
+	p->span.manufacturer = "Digium";
+	p->span.devicetype = p->variety;
 
         p->chan.sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS;    /* We're capabable of both FXOKS and FXOLS */
         p->chan.chanpos = 1;
@@ -1261,11 +1263,11 @@
         p->span.close = wc_usb_close;
 
 	ifaces[x] = p;
-    p->pos = x;
-    p->span.flags = ZT_FLAG_RBS;
-    init_waitqueue_head(&p->span.maintq);
-    p->span.pvt = p;
-    p->chan.pvt = p;
+	p->pos = x;
+	p->span.flags = ZT_FLAG_RBS;
+	init_waitqueue_head(&p->span.maintq);
+	p->span.pvt = p;
+	p->chan.pvt = p;
 	
 	/* Set the stream to just pass the data from the device uninhibited */
 	p->sample = STREAM_NORMAL;
@@ -1357,6 +1359,7 @@
 	p->dead = 0;
 	/* Clear alarms */
 	p->span.alarms = 0;
+	p->variety = d->name;
 	zt_alarm_notify(&p->span);
 #ifdef LINUX26
 	usb_set_intfdata(intf, p);
@@ -1485,4 +1488,3 @@
 
 module_init(wc_init);
 module_exit(wc_cleanup);
-

Modified: team/kpfleming/ztscan/wcusb.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/wcusb.h?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/wcusb.h (original)
+++ team/kpfleming/ztscan/wcusb.h Tue Dec  4 07:52:41 2007
@@ -99,6 +99,7 @@
 };
 
 struct wc_usb_pvt {
+	const char *variety;
         struct usb_device *dev;
         dev_type_t devclass;
         int usecount;

Modified: team/kpfleming/ztscan/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/zaptel-base.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/zaptel-base.c (original)
+++ team/kpfleming/ztscan/zaptel-base.c Tue Dec  4 07:52:41 2007
@@ -2947,8 +2947,7 @@
 {
 	union {
 		struct zt_gains gain;
-		struct zt_spaninfo span;
-		struct zt_spaninfo_compat span_compat;
+		struct zt_spaninfo spaninfo;
 		struct zt_params param;
 	} stack;
 	struct zt_chan *chan;
@@ -2957,6 +2956,7 @@
 	struct zt_chan *mychan;
 	int i,j;
 	int return_master = 0;
+	size_t size_to_copy;
 
 	switch(cmd) {
 	case ZT_GET_PARAMS: /* get channel timing parameters */
@@ -3131,43 +3131,60 @@
 		if (copy_to_user((struct zt_gains *) data,&stack.gain,sizeof(stack.gain)))
 			return -EFAULT;
 		break;
-	case ZT_SPANSTAT_COMPAT:
+	case ZT_SPANSTAT_V1:
+	case ZT_SPANSTAT_V2:
 	case ZT_SPANSTAT:
-		if (copy_from_user(&stack.span,(struct zt_spaninfo *) data, cmd == ZT_SPANSTAT_COMPAT ? sizeof(stack.span_compat) : sizeof(stack.span)))
+		size_to_copy = (cmd == ZT_SPANSTAT_V1) ? sizeof(struct zt_spaninfo_v1) :
+			       (cmd == ZT_SPANSTAT_V2) ? sizeof(struct zt_spaninfo_v2) :
+			       sizeof(struct zt_spaninfo);
+		if (copy_from_user(&stack.spaninfo, (struct zt_spaninfo *) data, size_to_copy))
 			return -EFAULT;
-		i = stack.span.spanno; /* get specified span number */
+		i = stack.spaninfo.spanno; /* get specified span number */
 		if ((i < 0) || (i >= maxspans)) return(-EINVAL);  /* if bad span no */
-		if (i == 0) /* if to figure it out for this chan */
-		   {
-		   	if (!chans[unit])
+		if (i == 0) {
+			/* if to figure it out for this chan */
+			if (!chans[unit])
 				return -EINVAL;
 			i = chans[unit]->span->spanno;
-		   }
+		}
 		if (!spans[i])
 			return -EINVAL;
-		stack.span.spanno = i; /* put the span # in here */
-		stack.span.totalspans = 0;
-		if (maxspans) stack.span.totalspans = maxspans - 1; /* put total number of spans here */
-		strncpy(stack.span.desc, spans[i]->desc, sizeof(stack.span.desc) - 1);
-		strncpy(stack.span.name, spans[i]->name, sizeof(stack.span.name) - 1);
-		stack.span.alarms = spans[i]->alarms;		/* get alarm status */
-		stack.span.bpvcount = spans[i]->bpvcount;	/* get BPV count */
-		stack.span.rxlevel = spans[i]->rxlevel;	/* get rx level */
-		stack.span.txlevel = spans[i]->txlevel;	/* get tx level */
-		stack.span.crc4count = spans[i]->crc4count;	/* get CRC4 error count */
-		stack.span.ebitcount = spans[i]->ebitcount;	/* get E-bit error count */
-		stack.span.fascount = spans[i]->fascount;	/* get FAS error count */
-		stack.span.irqmisses = spans[i]->irqmisses;	/* get IRQ miss count */
-		stack.span.syncsrc = spans[i]->syncsrc;	/* get active sync source */
-		stack.span.totalchans = spans[i]->channels;
-		/* We have space in the stack for these 2, even if they aren't copied back to userspace (for _COMPAT) */
-		stack.span.lbo = spans[i]->lbo;
-		stack.span.lineconfig = spans[i]->lineconfig;
-		stack.span.numchans = 0;
-		for (j=0; j < spans[i]->channels; j++)
+		stack.spaninfo.spanno = i; /* put the span # in here */
+		stack.spaninfo.totalspans = 0;
+		if (maxspans) stack.spaninfo.totalspans = maxspans - 1; /* put total number of spans here */
+		strncpy(stack.spaninfo.desc, spans[i]->desc, sizeof(stack.spaninfo.desc) - 1);
+		strncpy(stack.spaninfo.name, spans[i]->name, sizeof(stack.spaninfo.name) - 1);
+		stack.spaninfo.alarms = spans[i]->alarms;		/* get alarm status */
+		stack.spaninfo.bpvcount = spans[i]->bpvcount;	/* get BPV count */
+		stack.spaninfo.rxlevel = spans[i]->rxlevel;	/* get rx level */
+		stack.spaninfo.txlevel = spans[i]->txlevel;	/* get tx level */
+		stack.spaninfo.crc4count = spans[i]->crc4count;	/* get CRC4 error count */
+		stack.spaninfo.ebitcount = spans[i]->ebitcount;	/* get E-bit error count */
+		stack.spaninfo.fascount = spans[i]->fascount;	/* get FAS error count */
+		stack.spaninfo.irqmisses = spans[i]->irqmisses;	/* get IRQ miss count */
+		stack.spaninfo.syncsrc = spans[i]->syncsrc;	/* get active sync source */
+		stack.spaninfo.totalchans = spans[i]->channels;
+		stack.spaninfo.numchans = 0;
+		for (j = 0; j < spans[i]->channels; j++) {
 			if (spans[i]->chans[j].sig)
-				stack.span.numchans++;
-		if (copy_to_user((struct zt_spaninfo *) data,&stack.span, cmd == ZT_SPANSTAT_COMPAT ? sizeof(stack.span_compat) : sizeof(stack.span)))
+				stack.spaninfo.numchans++;
+		}
+		/* version 2 fields */
+		stack.spaninfo.lbo = spans[i]->lbo;
+		stack.spaninfo.lineconfig = spans[i]->lineconfig;
+		/* version 3 fields */
+		stack.spaninfo.irq = spans[i]->irq;
+		stack.spaninfo.linecompat = spans[i]->linecompat;
+		strncpy(stack.spaninfo.lboname, zt_lboname(spans[i]->lbo), sizeof(stack.spaninfo.lboname) - 1);
+		if (spans[i]->manufacturer)
+			strncpy(stack.spaninfo.manufacturer, spans[i]->manufacturer, sizeof(stack.spaninfo.manufacturer));
+		if (spans[i]->devicetype)
+			strncpy(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype));
+		strncpy(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location));
+		if (spans[i]->spantype)
+			strncpy(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype));
+		
+		if (copy_to_user((struct zt_spaninfo *) data, &stack.spaninfo, size_to_copy))
 			return -EFAULT;
 		break;
 	case ZT_CHANDIAG:
@@ -3297,7 +3314,7 @@
 		if (copy_from_user(&lc, (struct zt_lineconfig *)data, sizeof(lc)))
 			return -EFAULT;
 		VALID_SPAN(lc.span);
-		if ((lc.lineconfig & 0xf0 & spans[lc.span]->linecompat) != (lc.lineconfig & 0xf0))
+		if ((lc.lineconfig & 0x07f0 & spans[lc.span]->linecompat) != (lc.lineconfig & 0x07f0))
 			return -EINVAL;
 		if (spans[lc.span]->spanconfig)
 			return spans[lc.span]->spanconfig(spans[lc.span], &lc);

Modified: team/kpfleming/ztscan/zaptel.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/zaptel.h?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/zaptel.h (original)
+++ team/kpfleming/ztscan/zaptel.h Tue Dec  4 07:52:41 2007
@@ -179,6 +179,7 @@
 
 /* Extended attributes in lineconfig structure */
 #define ZT_SPANINFO_HAS_LINECONFIG
+#define ZT_SPANINFO_HAS_LBONAME
 
 typedef struct zt_params
 {
@@ -208,44 +209,69 @@
 int	pulseaftertime;
 } ZT_PARAMS;
 
-typedef struct zt_spaninfo_compat
-{
-int	spanno;		/* span number */
-char name[20];	/* Name of span */
-char desc[40];	/* Description of span */
-int	alarms;		/* alarms status */
-int	txlevel;	/* what TX level is set to */
-int	rxlevel;	/* current RX level */
-int	bpvcount;	/* current BPV count */
-int	crc4count;	/* current CRC4 error count */
-int	ebitcount;	/* current E-bit error count */
-int	fascount;	/* current FAS error count */
-int	irqmisses;	/* current IRQ misses */
-int	syncsrc;	/* span # of current sync source, or 0 for free run  */
-int	numchans;	/* number of configured channels on this span */
-int	totalchans;	/* total number of channels on the span */
-int	totalspans;	/* total number of zaptel spans in entire system */
-} ZT_SPANINFO_COMPAT;
-
-typedef struct zt_spaninfo
-{
-int	spanno;		/* span number */
-char name[20];	/* Name of span */
-char desc[40];	/* Description of span */
-int	alarms;		/* alarms status */
-int	txlevel;	/* what TX level is set to */
-int	rxlevel;	/* current RX level */
-int	bpvcount;	/* current BPV count */
-int	crc4count;	/* current CRC4 error count */
-int	ebitcount;	/* current E-bit error count */
-int	fascount;	/* current FAS error count */
-int	irqmisses;	/* current IRQ misses */
-int	syncsrc;	/* span # of current sync source, or 0 for free run  */
-int	numchans;	/* number of configured channels on this span */
-int	totalchans;	/* total number of channels on the span */
-int	totalspans;	/* total number of zaptel spans in entire system */
-int	lbo;        /* line build out */
-int	lineconfig; /* framing/coding */
+struct zt_spaninfo_v1 {
+	int	spanno;		/* span number */
+	char	name[20];	/* Name */
+	char	desc[40];	/* Description */
+	int	alarms;		/* alarms status */
+	int	txlevel;	/* what TX level is set to */
+	int	rxlevel;	/* current RX level */
+	int	bpvcount;	/* current BPV count */
+	int	crc4count;	/* current CRC4 error count */
+	int	ebitcount;	/* current E-bit error count */
+	int	fascount;	/* current FAS error count */
+	int	irqmisses;	/* current IRQ misses */
+	int	syncsrc;	/* span # of current sync source, or 0 for free run  */
+	int	numchans;	/* number of configured channels on this span */
+	int	totalchans;	/* total number of channels on the span */
+	int	totaflspans;	/* total number of spans in entire system */
+};
+
+struct zt_spaninfo_v2 {
+	int	spanno;		/* span number */
+	char	name[20];	/* Name */
+	char	desc[40];	/* Description */
+	int	alarms;		/* alarms status */
+	int	txlevel;	/* what TX level is set to */
+	int	rxlevel;	/* current RX level */
+	int	bpvcount;	/* current BPV count */
+	int	crc4count;	/* current CRC4 error count */
+	int	ebitcount;	/* current E-bit error count */
+	int	fascount;	/* current FAS error count */
+	int	irqmisses;	/* current IRQ misses */
+	int	syncsrc;	/* span # of current sync source, or 0 for free run  */
+	int	numchans;	/* number of configured channels on this span */
+	int	totalchans;	/* total number of channels on the span */
+	int	totalspans;	/* total number of spans in entire system */
+	int	lbo;        	/* line build out */
+	int	lineconfig;	 /* framing/coding */
+};
+
+typedef struct zt_spaninfo {
+	int	spanno;		/* span number */
+	char	name[20];	/* Name */
+	char	desc[40];	/* Description */
+	int	alarms;		/* alarms status */
+	int	txlevel;	/* what TX level is set to */
+	int	rxlevel;	/* current RX level */
+	int	bpvcount;	/* current BPV count */
+	int	crc4count;	/* current CRC4 error count */
+	int	ebitcount;	/* current E-bit error count */
+	int	fascount;	/* current FAS error count */
+	int	irqmisses;	/* current IRQ misses */
+	int	syncsrc;	/* span # of current sync source, or 0 for free run  */
+	int	numchans;	/* number of configured channels on this span */
+	int	totalchans;	/* total number of channels on the span */
+	int	totalspans;	/* total number of spans in entire system */
+	int	lbo;		/* line build out */
+	int	lineconfig;	/* framing/coding */
+	char 	lboname[40];	/* line build out in text form */
+	char	location[40];	/* span's device location in system */
+	char	manufacturer[40]; /* manufacturer of span's device */
+	char	devicetype[40];	/* span's device type */
+	int	irq;		/* span's device IRQ */
+	int	linecompat;	/* signaling modes possible on this span */
+	char	spantype[6];	/* type of span in text form */
 } ZT_SPANINFO;
 
 typedef struct zt_maintinfo
@@ -408,9 +434,10 @@
 #define ZT_IOMUX		_IOWR (ZT_CODE, 9, int)
 
 /*
- * Get Span Status (_COMPAT is deprecated)
- */
-#define ZT_SPANSTAT_COMPAT		_IOWR (ZT_CODE, 10, struct zt_spaninfo_compat)
+ * Get Span Status
+ */
+#define ZT_SPANSTAT_V1		_IOWR (ZT_CODE, 10, struct zt_spaninfo_v1)
+#define ZT_SPANSTAT_V2		_IOWR (ZT_CODE, 10, struct zt_spaninfo_v2)
 #define ZT_SPANSTAT		_IOWR (ZT_CODE, 10, struct zt_spaninfo)
 
 /*
@@ -1391,6 +1418,10 @@
 	void *pvt;			/* Private stuff */
 	char name[40];			/* Span name */
 	char desc[80];			/* Span description */
+	const char *spantype;		/* span type in text form */
+	const char *manufacturer;	/* span's device manufacturer */
+	const char *devicetype;		/* span's device type */
+	char location[40];		/* span device's location in system */
 	int deflaw;			/* Default law (ZT_MULAW or ZT_ALAW) */
 	int alarms;			/* Pending alarms on span */
 	int flags;

Modified: team/kpfleming/ztscan/ztdummy.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/ztdummy.c?view=diff&rev=3277&r1=3276&r2=3277
==============================================================================
--- team/kpfleming/ztscan/ztdummy.c (original)
+++ team/kpfleming/ztscan/ztdummy.c Tue Dec  4 07:52:41 2007
@@ -262,6 +262,7 @@
 	sprintf(ztd->span.name, "ZTDUMMY/1");
 	sprintf(ztd->span.desc, "%s (source: " CLOCK_SRC ") %d", ztd->span.name, 1);
 	sprintf(ztd->chan.name, "ZTDUMMY/%d/%d", 1, 0);
+	ztd->span.devicetype = "Zaptel Dummy Timing Driver";
 	ztd->chan.chanpos = 1;
 	ztd->span.chans = &ztd->chan;
 	ztd->span.channels = 0;		/* no channels on our span */

Added: team/kpfleming/ztscan/ztscan.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/ztscan/ztscan.c?view=auto&rev=3277
==============================================================================
--- team/kpfleming/ztscan/ztscan.c (added)
+++ team/kpfleming/ztscan/ztscan.c Tue Dec  4 07:52:41 2007
@@ -1,0 +1,181 @@
+/*
+ * Scan and output information about Zaptel spans and ports.
+ * 
+ * Written by Brandon Kruse <bkruse at digium.com>
+ * and Kevin P. Fleming <kpfleming at digium.com>
+ * Copyright (C) 2007 Digium, Inc.
+ *
+ * Based on zttool written by Mark Spencer <markster at digium.com>
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under thet erms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
+ *
+ */
+
+#include <stdio.h> 
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#ifdef STANDALONE_ZAPATA
+#include "zaptel.h"
+#else
+#include <zaptel/zaptel.h>
+#endif
+
+int main(int argc, char *argv[])
+{
+	int ctl;
+	int span = 0;
+	int x, y;
+	int hasgeneral = 0;
+	struct zt_params params;
+	unsigned int basechan = 1;
+	struct zt_spaninfo s;
+	char buf[100];
+	int totalspans = ZT_MAX_SPANS;
+	char alarms[50];
+
+	if ((ctl = open("/dev/zap/ctl", O_RDWR)) < 0) {
+		fprintf(stderr, "Unable to open /dev/zap/ctl: %s\n", strerror(errno));
+		exit(1);
+	}
+	
+	for (x = 1; x < totalspans; x++) {
+		memset(&s, 0, sizeof(s));
+		s.spanno = x;
+		if (ioctl(ctl, ZT_SPANSTAT, s))
+			continue;
+
+		alarms[0] = '\0';
+		if (s.alarms) {
+			if (s.alarms & ZT_ALARM_BLUE)
+				strcat(alarms,"BLU/");
+			if (s.alarms & ZT_ALARM_YELLOW)
+				strcat(alarms, "YEL/");
+			if (s.alarms & ZT_ALARM_RED)
+				strcat(alarms, "RED/");
+			if (s.alarms & ZT_ALARM_LOOPBACK)
+				strcat(alarms,"LB/");
+			if (s.alarms & ZT_ALARM_RECOVER)
+				strcat(alarms,"REC/");
+			if (s.alarms & ZT_ALARM_NOTOPEN)
+				strcat(alarms, "NOP/");
+			if (!strlen(alarms))
+				strcat(alarms, "UUU/");
+			if (strlen(alarms)) {
+				/* Strip trailing / */
+				alarms[strlen(alarms)-1]='\0';
+			}
+		} else {
+			if (s.numchans)
+				strcpy(alarms, "OK");
+			else
+				strcpy(alarms, "UNCONFIGURED");
+		}
+
+		if (!hasgeneral) {
+			fprintf(stdout, "[general]\ntotalspans=%d\n", s.totalspans);
+			hasgeneral++;
+			totalspans = s.totalspans;
+		}
+
+		fprintf(stdout, "[%d]\n", x);
+		fprintf(stdout, "active=yes\n");
+		fprintf(stdout, "alarms=%s\n", alarms);
+		fprintf(stdout, "description=%s\n", s.desc);
+		fprintf(stdout, "name=%s\n", s.name);
+		fprintf(stdout, "manufacturer=%s\n", s.manufacturer);
+		fprintf(stdout, "devicetype=%s\n", s.devicetype);
+		fprintf(stdout, "location=%s\n", s.location);
+		fprintf(stdout, "basechan=%d\n", basechan);
+		fprintf(stdout, "totchans=%d\n", s.totalchans);
+		fprintf(stdout, "irq=%d\n", s.irq);
+		y = basechan;
+		memset(&params, 0, sizeof(params));
+		params.channo = y;
+		if (ioctl(ctl, ZT_GET_PARAMS, &params))
+			goto skip;
+		if (params.sigcap & __ZT_SIG_DACS) {
+			/* this is a digital span */
+			fprintf(stdout, "type=digital-%s\n", s.spantype);
+			fprintf(stdout, "syncsrc=%d\n", s.syncsrc);
+			fprintf(stdout, "lbo=%s\n", s.lboname);
+			fprintf(stdout, "coding_opts=");
+			buf[0] = '\0';
+			if (s.linecompat & ZT_CONFIG_B8ZS) strcat(buf, "B8ZS,");
+			if (s.linecompat & ZT_CONFIG_AMI) strcat(buf, "AMI,");
+			if (s.linecompat & ZT_CONFIG_HDB3) strcat(buf, "HDB3,");
+			buf[strlen(buf) - 1] = '\0';
+			fprintf(stdout, "%s\n", buf);
+			fprintf(stdout, "framing_opts=");
+			buf[0] = '\0';
+			if (s.linecompat & ZT_CONFIG_ESF) strcat(buf, "ESF,");
+			if (s.linecompat & ZT_CONFIG_D4) strcat(buf, "D4,");
+			if (s.linecompat & ZT_CONFIG_CCS) strcat(buf, "CCS,");
+			if (s.linecompat & ZT_CONFIG_CRC4) strcat(buf, "CRC4,");
+			buf[strlen(buf) - 1] = '\0';
+			fprintf(stdout, "%s\n", buf);
+			fprintf(stdout, "coding=");
+			if (s.lineconfig & ZT_CONFIG_B8ZS) fprintf(stdout, "B8ZS");
+			else if (s.lineconfig & ZT_CONFIG_AMI) fprintf(stdout, "AMI");
+			else if (s.lineconfig & ZT_CONFIG_HDB3) fprintf(stdout, "HDB3");
+			fprintf(stdout, "\n");
+			fprintf(stdout, "framing=");

[... 53 lines stripped ...]



More information about the svn-commits mailing list