Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.48
diff -u -r1.48 Makefile
--- Makefile	30 Jun 2004 16:09:43 -0000	1.48
+++ Makefile	16 Jul 2004 21:47:03 -0000
@@ -38,8 +38,13 @@
 
 ifeq (${BUILDVER},linux24)
 #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
-DEVFS=$(shell ps ax | grep -v grep | grep devfsd)
+DYNFS=$(shell ps ax | grep -v grep | grep devfsd)
 endif
+ifeq (${BUILDVER},linux26)
+#Tests for newer linux-2.6 udev support
+DYNFS=$(shell ps ax | grep -v grep | grep udevd)
+endif
+
 
 TZOBJS=zonedata.lo tonezone.lo
 LIBTONEZONE=libtonezone.so.1.0
@@ -234,7 +239,8 @@
 		N=$$[$$N+1]; \
 	done
 else
-	@echo "**** devfs detected -- not making device nodes"
+	@echo "**** Dynamic filesystem detected -- not creating device nodes"
+	@echo "**** If you are running udev, read README.udev"
 endif
 
 install:  all devices $(LIBTONEZONE)
Index: zconfig.h
===================================================================
RCS file: /usr/cvsroot/zaptel/zconfig.h,v
retrieving revision 1.10
diff -u -r1.10 zconfig.h
--- zconfig.h	2 Jul 2004 13:04:54 -0000	1.10
+++ zconfig.h	16 Jul 2004 21:47:03 -0000
@@ -62,6 +62,11 @@
  */
 /* #define NO_ECHOCAN_DISABLE */
 
+/* udev support */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#define CONFIG_ZAP_UDEV
+#endif
+
 /* We now use the linux kernel config to detect which options to use */
 /* You can still override them below */
 #if defined(CONFIG_HDLC) || defined(CONFIG_HDLC_MODULE)
Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.84
diff -u -r1.84 zaptel.c
--- zaptel.c	2 Jul 2004 13:04:54 -0000	1.84
+++ zaptel.c	16 Jul 2004 21:47:03 -0000
@@ -143,6 +143,12 @@
 static devfs_handle_t ctl;
 static devfs_handle_t timer;
 #endif
+
+/* udev necessary data structures.  Yeah! */
+#ifdef CONFIG_ZAP_UDEV
+static struct class_simple *zap_class = NULL;
+#endif
+
 /* There is a table like this in the PPP driver, too */
 
 static int deftaps = 64;
@@ -4165,6 +4171,14 @@
 	}
 #endif /* CONFIG_DEVFS_FS */
 
+#ifdef CONFIG_ZAP_UDEV
+	for (x = 0; x < span->channels; x++) {
+		char chan_name[50];
+		sprintf(chan_name, "zap%d", span->chans[x].channo);
+		class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name);
+	}
+#endif /* CONFIG_ZAP_UDEV */
+
 	if (debug)
 		printk("Registered Span %d ('%s') with %d channels\n", span->spanno, span->name, span->channels);
 	if (!master || prefmaster) {
@@ -4208,6 +4222,13 @@
 	}
 	devfs_unregister(span->dhandle);
 #endif /* CONFIG_DEVFS_FS */
+
+#ifdef CONFIG_ZAP_UDEV
+	for (x = 0; x < span->channels; x++) {
+		class_simple_device_remove(MKDEV(ZT_MAJOR, span->chans[x].channo));
+	}
+#endif /* CONFIG_ZAP_UDEV */
+
 	spans[span->spanno] = NULL;
 	span->spanno = 0;
 	span->flags &= ~ZT_FLAG_REGISTERED;
@@ -6078,6 +6099,15 @@
 #ifdef CONFIG_PROC_FS
 	proc_entries[0] = proc_mkdir("zaptel", NULL);
 #endif
+
+#ifdef CONFIG_ZAP_UDEV /* udev support functions */
+	zap_class = class_simple_create(THIS_MODULE, "zaptel");
+	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer");
+	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel");
+	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
+	class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");
+#endif /* CONFIG_ZAP_UDEV */
+
 #ifdef CONFIG_DEVFS_FS
 	{
 	umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO;
@@ -6127,6 +6157,13 @@
 	devfs_unregister(zaptel_devfs_dir);
 	devfs_unregister_chrdev(ZT_MAJOR, "zaptel");
 #else
+#ifdef CONFIG_ZAP_UDEV
+	class_simple_device_remove(MKDEV(ZT_MAJOR, 253)); /* timer */
+	class_simple_device_remove(MKDEV(ZT_MAJOR, 254)); /* channel */
+	class_simple_device_remove(MKDEV(ZT_MAJOR, 255)); /* pseudo */
+	class_simple_device_remove(MKDEV(ZT_MAJOR, 0)); /* ctl */
+	class_simple_destroy(zap_class);
+#endif /* CONFIG_ZAP_UDEV */
 	unregister_chrdev(ZT_MAJOR, "zaptel");
 #endif
 #ifdef CONFIG_ZAPTEL_WATCHDOG
