[svn-commits] dbailey: tools/trunk r5800 - /tools/trunk/fxstest.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 22 09:45:31 CST 2009


Author: dbailey
Date: Thu Jan 22 09:45:31 2009
New Revision: 5800

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=5800
Log:
Alec Davis change to modify vmwi test to use new ioctl call structure and enhance functionality
(issue #14104)
Reported by: alecdavis
Patches:
      mwiioctl_structure_fxstest.diff.txt uploaded by dbailey (license )
Tested by: alecdavis, dbailey


Modified:
    tools/trunk/fxstest.c

Modified: tools/trunk/fxstest.c
URL: http://svn.digium.com/svn-view/dahdi/tools/trunk/fxstest.c?view=diff&rev=5800&r1=5799&r2=5800
==============================================================================
--- tools/trunk/fxstest.c (original)
+++ tools/trunk/fxstest.c Thu Jan 22 09:45:31 2009
@@ -45,6 +45,8 @@
 	DAHDI_TONE_CONGESTION,
 	DAHDI_TONE_DIALRECALL,
 };
+
+struct dahdi_vmwi_info mwisend_setting; /*!< Which VMWI methods to use */
 
 int main(int argc, char *argv[])
 {
@@ -59,7 +61,9 @@
 		       "       tones - plays a series of tones\n"
 		       "       polarity - tests polarity reversal\n"
 		       "       ring - rings phone\n"
-		       "       vmwi - toggles VMWI lamp\n");
+		       "       vmwi - toggles VMWI LED lamp\n"
+		       "       hvdc - toggles VMWI HV lamp\n"
+		       "       neon - toggles VMWI NEON lamp\n");
 		exit(1);
 	}
 	fd = open(argv[1], O_RDWR);
@@ -68,26 +72,39 @@
 		exit(1);
 	}
 	
-	if (!strcasecmp(argv[2], "vmwi")) {
-		fprintf(stderr, "Twiddling vmwi...\n");
-		x = DAHDI_VMWI_LREV | 1;
-		res = ioctl(fd, DAHDI_VMWI, &x);
-		if (res) {
-			fprintf(stderr, "Unable to set VMWI...\n");
+	if ( !strcasecmp(argv[2], "neon") || !strcasecmp(argv[2], "vmwi") || !strcasecmp(argv[2], "hvdc")) {
+		fprintf(stderr, "Twiddling %s ...\n", argv[2]);
+
+		if ( !strcasecmp(argv[2], "vmwi") ) {
+			mwisend_setting.vmwi_type = DAHDI_VMWI_LREV;
+		} else if ( !strcasecmp(argv[2], "neon") ) {
+			mwisend_setting.vmwi_type = DAHDI_VMWI_HVAC;
+		} else if ( !strcasecmp(argv[2], "hvdc") ) {
+			mwisend_setting.vmwi_type = DAHDI_VMWI_HVDC;
+		}
+
+		mwisend_setting.messages = 1;
+		res = ioctl(fd, DAHDI_VMWI, &mwisend_setting);
+		if (res) {
+			fprintf(stderr, "Unable to set %s ...\n", argv[2]);
 		} else {
 			fprintf(stderr, "Set 1 Voice Message...\n");
+
 			sleep(5);
-			x = DAHDI_VMWI_LREV | 2;
-			ioctl(fd, DAHDI_VMWI, &x);
+			mwisend_setting.messages = 2;
+			ioctl(fd, DAHDI_VMWI, &mwisend_setting);
 			fprintf(stderr, "Set 2 Voice Messages...\n");
+
 			sleep(5);
-			x = DAHDI_VMWI_LREV;
-			ioctl(fd, DAHDI_VMWI, &x);
+			mwisend_setting.messages = 0;
+			ioctl(fd, DAHDI_VMWI, &mwisend_setting);
 			fprintf(stderr, "Set No Voice messages...\n");
 			sleep(2);
+
+			mwisend_setting.vmwi_type = 0;
 		}
 	} else if (!strcasecmp(argv[2], "ring")) {
-					fprintf(stderr, "Ringing phone...\n");
+		fprintf(stderr, "Ringing phone...\n");
 		x = DAHDI_RING;
 		res = ioctl(fd, DAHDI_HOOK, &x);
 		if (res) {




More information about the svn-commits mailing list