[PATCH] add a command line option for the interpreter_ready field

Philipp Zabel philipp.zabel at gmail.com
Sun Jun 3 13:42:37 CEST 2007


Hi,

The HTC Universal's modem is turned on when the tty is opened, so while
the generic machine plugin could be used otherwise, the
interpreter_ready variable has to be set to zero. Instead of adding
another slightly different generic machine plugin, interpreter_ready
could be overridden by a command line option.

regards
Philipp

Index: gsm/src/gsmd/gsmd.c
===================================================================
--- gsm.orig/src/gsmd/gsmd.c	2007-06-03 11:57:43.000000000 +0200
+++ gsm/src/gsmd/gsmd.c	2007-06-03 11:57:45.000000000 +0200
@@ -311,6 +311,7 @@
 	{ "leak-report", 0, NULL, 'L' },
 	{ "vendor", 1, NULL, 'v' },
 	{ "machine", 1, NULL, 'm' },
+	{ "wait", 1, NULL, 'w' },
 	{ 0, 0, 0, 0 }
 };
 
@@ -333,6 +334,7 @@
 	       "\t-l file\t--logfile file\tSpecify a logfile to log to\n"
 	       "\t-v\t--vendor v\tSpecify GSM modem vendor plugin\n"
 	       "\t-m\t--machine m\tSpecify GSM modem machine plugin\n"
+	       "\t-w\t--wait m\tWait for the AT Interpreter Ready message\n"
 	       );
 }
 
@@ -362,6 +364,7 @@
 	char *logfile = "syslog";
 	char *vendor_name = NULL;
 	char *machine_name = NULL;
+	int wait = -1;
 
 	signal(SIGTERM, sig_handler);
 	signal(SIGINT, sig_handler);
@@ -374,7 +377,7 @@
 	print_header();
 
 	/*FIXME: parse commandline, set daemonize, device, ... */
-	while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:", opts, NULL)) != -1) {
+	while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:w:", opts, NULL)) != -1) {
 		switch (argch) {
 		case 'V':
 			/* FIXME */
@@ -411,6 +414,9 @@
 		case 'm':
 			machine_name = optarg;
 			break;
+		case 'w':
+			wait = atoi(optarg);
+			break;
 		}
 	}
 
@@ -455,6 +461,9 @@
 		exit(1);
 	}
 
+	if (wait >= 0)
+		g.interpreter_ready = !wait;
+
 	if (atcmd_init(&g, fd) < 0) {
 		fprintf(stderr, "can't initialize UART device\n");
 		exit(1);




More information about the gsmd-devel mailing list