[Asterisk-cvs] zaptel Makefile, 1.54, 1.55 fxstest.c, 1.4, 1.5 wctdm.c, 1.88, 1.89 wctdm.h, 1.3, 1.4 zaptel.init, 1.5, 1.6 wcfxs.c, 1.88, NONE wcfxs.h, 1.3, NONE

markster at lists.digium.com markster at lists.digium.com
Sat Nov 6 11:38:50 CST 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv22577

Modified Files:
	Makefile fxstest.c wctdm.c wctdm.h zaptel.init 
Removed Files:
	wcfxs.c wcfxs.h 
Log Message:
Makefile fixes from bug #2798 and rename wcfxs to wctdm


Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- Makefile	4 Nov 2004 20:04:53 -0000	1.54
+++ Makefile	6 Nov 2004 16:40:42 -0000	1.55
@@ -1,5 +1,6 @@
 #
 # Makefile for tormenta/carrier driver and utilities
+# $Id$
 #
 BASEADDR=0xd0000
 
@@ -31,13 +32,14 @@
 KFLAGS+=-DSTANDALONE_ZAPATA
 CFLAGS+=-DSTANDALONE_ZAPATA
 
+ROOT_PREFIX=
 INSTALL_PREFIX=
 
 CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
 CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
 
 BUILDVER=$(shell if uname -r | grep -q ^2.6; then echo "linux26"; else echo "linux24"; fi)
-MODCONF=$(shell if [ -d $(INSTALL_PREFIX)/etc/modprobe.d ]; then echo "$(INSTALL_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(INSTALL_PREFIX)/etc/modutils ]; then echo "$(INSTALL_PREFIX)/etc/modutils/zaptel"; elif [ -f $(INSTALL_PREFIX)/etc/modprobe.conf ]; then echo "$(INSTALL_PREFIX)/etc/modprobe.conf"; elif [ -f $(INSTALL_PREFIX)/etc/modules.conf ]; then echo "$(INSTALL_PREFIX)/etc/modules.conf"; else echo $(INSTALL_PREFIX)/etc/conf.modules ; fi)
+MODCONF=$(shell if [ -d $(ROOT_PREFIX)/etc/modprobe.d ]; then echo "$(ROOT_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(ROOT_PREFIX)/etc/modutils ]; then echo "$(ROOT_PREFIX)/etc/modutils/zaptel"; elif [ -f $(ROOT_PREFIX)/etc/modprobe.conf ]; then echo "$(ROOT_PREFIX)/etc/modprobe.conf"; elif [ -f $(ROOT_PREFIX)/etc/modules.conf ]; then echo "$(ROOT_PREFIX)/etc/modules.conf"; else echo $(ROOT_PREFIX)/etc/conf.modules ; fi)
 
 ifeq (${BUILDVER},linux24)
 #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
@@ -51,7 +53,7 @@
 
 TZOBJS=zonedata.lo tonezone.lo
 LIBTONEZONE=libtonezone.so.1.0
-MODULES=zaptel tor2 torisa wcusb wcfxo wcfxs \
+MODULES=zaptel tor2 torisa wcusb wcfxo wctdm \
 	ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp pciradio # ztdummy
 #MODULES+=wcfxsusb
 
@@ -65,6 +67,7 @@
 PRIMARY=torisa
 #PRIMARY=wcfxo
 PWD=$(shell pwd)
+KERNEL_SOURCE?=/lib/modules/`uname -r`/build
 
 all: $(BUILDVER)
 
@@ -72,8 +75,8 @@
 
 linux26: 
 linux26: prereq $(BINS)
-	@if ! [ -d /usr/src/linux-2.6 ]; then echo "Link /usr/src/linux-2.6 to your kernel sources first!"; exit 1 ; fi
-	make -C /usr/src/linux-2.6 SUBDIRS=$(PWD) modules
+	@if ! [ -d $(KERNEL_SOURCE) ]; then echo "You do not appear to have the kernel sources for your current kernel installed."; exit 1 ; fi
+	make -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) modules
 
 obj-m := $(MODULESO) ztdummy.o
 
@@ -114,8 +117,8 @@
 wct4xxp.o:wct4xxp.c zaptel.h
 	$(HOSTCC) $(KFLAGS) -c wct4xxp.c
 
-wcfxs.o:wcfxs.c zaptel.h
-	$(HOSTCC) $(KFLAGS) -c wcfxs.c
+wctdm.o:wctdm.c zaptel.h wctdm.h
+	$(HOSTCC) $(KFLAGS) -c wctdm.c
 
 pciradio.o:pciradio.c zaptel.h
 	$(HOSTCC) $(KFLAGS) -c pciradio.c
@@ -194,7 +197,7 @@
 
 $(LIBTONEZONE): $(TZOBJS)
 	$(CC) -shared -Wl,-soname,libtonezone.so.1 -lm -o $@ $(TZOBJS)
-	/sbin/ldconfig -n .
+	[ `id -u` = 0 ] && /sbin/ldconfig || :
 	ln -sf libtonezone.so.1 libtonezone.so                                  
 
 ztcfg.c: ztcfg.h
@@ -256,46 +259,44 @@
 endif
 
 install:  all devices $(LIBTONEZONE)
-	mkdir -p $(INSTALL_PREFIX)/sbin
-	install -m 755 ztcfg $(INSTALL_PREFIX)/sbin
+	install -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg
 	if [ -f sethdlc-new ]; then \
-		install -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
+		install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
 	elif [ -f sethdlc ]; then \
-		install -m 755 sethdlc $(INSTALL_PREFIX)/sbin ; \
+		install -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc ; \
 	fi
-	if [ -f zttool ]; then install -m 755 zttool $(INSTALL_PREFIX)/sbin; fi
-	mkdir -p $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc
+	if [ -f zttool ]; then install -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; fi
 
 	if [ -f zaptel.ko ]; then \
 		for x in $(MODULESKO) ztdummy.ko; do \
-			install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \
+			install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/$$x ; \
 		done; \
 		if ! [ -f wcfxsusb.ko ]; then \
-			rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.o; \
+			rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.ko; \
 		fi; \
+		rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxs.ko; \
 	else \
 		for x in $(MODULESO); do \
-			install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \
+			install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/$$x ; \
 		done; \
 		if ! [ -f wcfxsusb.o ]; then \
-			rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.ko; \
+			rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.o; \
 		fi; \
+		rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxs.o; \
 	fi
 
-	mkdir -p $(INSTALL_PREFIX)/usr/lib
-	install -m 755 $(LIBTONEZONE) $(INSTALL_PREFIX)/usr/lib
+	install -D -m 755 $(LIBTONEZONE) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE)
 	
-	mkdir -p $(INSTALL_PREFIX)/usr/include/linux
-	install -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux
-	install -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/linux
-	install -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include
+	install -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
+	install -D -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/linux/torisa.h
+	install -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h
 	( cd $(INSTALL_PREFIX)/usr/lib ; rm -f libtonezone.so ; ln -sf $(LIBTONEZONE) libtonezone.so )
-	/sbin/ldconfig
+	[ `id -u` = 0 ] && /sbin/ldconfig || :
 	if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi
 	cat $(MODCONF).bak | grep -v "alias char-major-250" | \
 	grep -v "post-install torisa /sbin/ztcfg" | \
 	grep -v "post-install wcfxsusb /sbin/ztcfg" | \
-	grep -v "post-install wcfxs /sbin/ztcfg" > $(MODCONF) || true
+	grep -v "post-install wctdm /sbin/ztcfg" > $(MODCONF) || true
 	if ! grep "options torisa" $(MODCONF); then \
 		echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
 	fi
@@ -304,8 +305,8 @@
 	fi
 		
 	for x in $(MODULES); do \
-		if ! grep "post-install $$x" $(MODCONF); then \
-			if ! grep "install $$x " $(MODCONF); then \
+		if ! grep -q "post-install $$x" $(MODCONF); then \
+			if ! grep -q "install $$x " $(MODCONF); then \
 				if [ "$$x" != "zaptel" ] ; then \
 					if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x && /sbin/ztcfg" >> $(MODCONF); \
 					else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \
@@ -314,25 +315,29 @@
 			fi; \
 		fi; \
 	done
+	if ! grep "alias wcfxs" $(MODCONF); then \
+		echo "alias wcfxs wctdm" >> $(MODCONF); \
+	fi \
 
 	if [ -d /etc/modutils ]; then \
 		/sbin/update-modules ; \
 	fi
-	-/sbin/depmod -a
-	[ -f $(CONFIG_FILE) ] || install -m 644 zaptel.conf.sample $(CONFIG_FILE)
+	[ `id -u` = 0 ] && /sbin/depmod -a || :
+	[ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
 
 config:
 	if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \
-		install -m 755 zaptel.init $(INSTALL_PREFIX)/etc/rc.d/init.d/zaptel; \
+		install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/rc.d/init.d/zaptel; \
 		chkconfig --add zaptel; \
 	elif [ -d $(INSTALL_PREFIX)/etc/init.d ]; then \
-		install -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zaptel; \
+		install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zaptel; \
+		chkconfig --add zaptel; \
 	fi 
 	if [ ! -f /etc/sysconfig/zaptel ]; then \
-		install -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/sysconfig/zaptel; \
+		install -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/sysconfig/zaptel; \
 	fi
 	if [ -d /etc/sysconfig/network-scripts ]; then \
-		install -m 755 ifup-hdlc $(INSTALL_PREFIX)/etc/sysconfig/network-scripts/ifup-hdlc; \
+		install -D -m 755 ifup-hdlc $(INSTALL_PREFIX)/etc/sysconfig/network-scripts/ifup-hdlc; \
 	fi
 	
 clean:

Index: fxstest.c
===================================================================
RCS file: /usr/cvsroot/zaptel/fxstest.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- fxstest.c	25 Feb 2004 15:35:13 -0000	1.4
+++ fxstest.c	6 Nov 2004 16:40:42 -0000	1.5
@@ -7,7 +7,7 @@
 #include <sys/ioctl.h>
 #include "zaptel.h"
 #include "tonezone.h"
-#include "wcfxs.h"
+#include "wctdm.h"
 
 static int tones[] = {
 	ZT_TONE_DIALTONE,
@@ -55,8 +55,8 @@
 			x=(x+1) % (sizeof(tones) / sizeof(tones[0]));
 		}
 	} else if (!strcasecmp(argv[2], "stats")) {
-		struct wcfxs_stats stats;
-		res = ioctl(fd, WCFXS_GET_STATS, &stats);
+		struct wctdm_stats stats;
+		res = ioctl(fd, WCTDM_GET_STATS, &stats);
 		if (res) {
 			fprintf(stderr, "Unable to get stats on channel %s\n", argv[1]);
 		} else {
@@ -65,10 +65,10 @@
 			printf("VBAT: %7.4f Volts\n", (float)stats.batvolt / 1000.0);
 		}
 	} else if (!strcasecmp(argv[2], "regdump")) {
-		struct wcfxs_regs regs;
+		struct wctdm_regs regs;
 		int numregs = NUM_REGS;
 		memset(&regs, 0, sizeof(regs));
-		res = ioctl(fd, WCFXS_GET_REGS, &regs);
+		res = ioctl(fd, WCTDM_GET_REGS, &regs);
 		if (res) {
 			fprintf(stderr, "Unable to get registers on channel %s\n", argv[1]);
 		} else {
@@ -96,7 +96,7 @@
 		}
 	} else if (!strcasecmp(argv[2], "setdirect") ||
 				!strcasecmp(argv[2], "setindirect")) {
-		struct wcfxs_regop regop;
+		struct wctdm_regop regop;
 		int val;
 		int reg;
 		if ((argc < 5) || (sscanf(argv[3], "%i", &reg) != 1) ||
@@ -111,7 +111,7 @@
 			} else {
 				regop.indirect = 0;
 			}
-			res = ioctl(fd, WCFXS_SET_REG, &regop);
+			res = ioctl(fd, WCTDM_SET_REG, &regop);
 			if (res) 
 				fprintf(stderr, "Unable to get registers on channel %s\n", argv[1]);
 			else

Index: wctdm.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wctdm.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- wctdm.c	14 Oct 2004 20:19:14 -0000	1.88
+++ wctdm.c	6 Nov 2004 16:40:42 -0000	1.89
@@ -33,7 +33,7 @@
 #include <linux/interrupt.h>
 
 #include "proslic.h"
-#include "wcfxs.h"
+#include "wctdm.h"
 /*
  *  Define for audio vs. register based ring detection
  *  
@@ -271,7 +271,7 @@
 	unsigned char vals[NUM_CAL_REGS];
 };
[...1574 lines suppressed...]
 
-static void __exit wcfxs_cleanup(void)
+static void __exit wctdm_cleanup(void)
 {
-	pci_unregister_driver(&wcfxs_driver);
+	pci_unregister_driver(&wctdm_driver);
 }
 
 MODULE_PARM(debug, "i");
@@ -2191,8 +2191,8 @@
 MODULE_LICENSE("GPL");
 #endif
 
-module_init(wcfxs_init);
-module_exit(wcfxs_cleanup);
+module_init(wctdm_init);
+module_exit(wctdm_cleanup);
 
 
 

Index: wctdm.h
===================================================================
RCS file: /usr/cvsroot/zaptel/wctdm.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- wctdm.h	5 Jul 2003 18:00:34 -0000	1.3
+++ wctdm.h	6 Nov 2004 16:40:42 -0000	1.4
@@ -28,24 +28,24 @@
 #define NUM_REGS	  109
 #define NUM_INDIRECT_REGS 105
 
-struct wcfxs_stats {
+struct wctdm_stats {
 	int tipvolt;	/* TIP voltage (mV) */
 	int ringvolt;	/* RING voltage (mV) */
 	int batvolt;	/* VBAT voltage (mV) */
 };
 
-struct wcfxs_regs {
+struct wctdm_regs {
 	unsigned char direct[NUM_REGS];
 	unsigned short indirect[NUM_INDIRECT_REGS];
 };
 
-struct wcfxs_regop {
+struct wctdm_regop {
 	int indirect;
 	unsigned char reg;
 	unsigned short val;
 };
 
-#define WCFXS_GET_STATS	_IOR (ZT_CODE, 60, struct wcfxs_stats)
-#define WCFXS_GET_REGS	_IOR (ZT_CODE, 61, struct wcfxs_regs)
-#define WCFXS_SET_REG	_IOW (ZT_CODE, 62, struct wcfxs_regop)
+#define WCTDM_GET_STATS	_IOR (ZT_CODE, 60, struct wctdm_stats)
+#define WCTDM_GET_REGS	_IOR (ZT_CODE, 61, struct wctdm_regs)
+#define WCTDM_SET_REG	_IOW (ZT_CODE, 62, struct wctdm_regop)
 

Index: zaptel.init
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.init,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- zaptel.init	14 Jul 2003 19:25:44 -0000	1.5
+++ zaptel.init	6 Nov 2004 16:40:42 -0000	1.6
@@ -27,9 +27,9 @@
 
 RETVAL=0
 
-MODULES="torisa tor2 wct4xxp wct1xxp wcfxo wcfxs wcusb"
+MODULES="torisa tor2 wct4xxp wcte11xp wct1xxp wcfxo wctdm wcusb"
 
-RMODULES="wcusb wcfxs wcfxo wct1xxp wct4xxp tor2 torisa"
+RMODULES="wcusb wctdm wcfxo wct1xxp wcte11xp wct4xxp tor2 torisa"
 
 if [ "${DEBUG}" = "yes" ]; then
 	ARGS="debug=1"

--- wcfxs.c DELETED ---

--- wcfxs.h DELETED ---




More information about the svn-commits mailing list