Browse Source

Add support for VIDEOHUB_HOST and VIDEOHUB_PORT env variables.

Georgi Chorbadzhiyski 9 years ago
parent
commit
4175b91230
3 changed files with 21 additions and 1 deletions
  1. 1
    0
      ChangeLog
  2. 15
    0
      README
  3. 5
    1
      videohubctrl.c

+ 1
- 0
ChangeLog View File

@@ -8,6 +8,7 @@ xxxx-xx-xx : Version next
8 8
    and video output routing.
9 9
  * Add --list-device, --list-vinputs and --list-voutputs parameters.
10 10
  * Display last update time in --monitor.
11
+ * Add support for VIDEOHUB_HOST and VIDEOHUB_PORT env variables.
11 12
 
12 13
 2014-11-27 : Version 0.2
13 14
  * Fix port routing. Previously it was reversed and incorrect.

+ 15
- 0
README View File

@@ -102,6 +102,21 @@ Configuration:
102 102
   NOTE: For <in_X/out_X/in_Y> you may use port number or port name.
103 103
 
104 104
 
105
+Environment variables
106
+=====================
107
+
108
+The following environment variables are checked and used by the program
109
+if they are set:
110
+
111
+ VIDEOHUB_HOST
112
+    Sets the device host name. It is equivallent to using -h / --host
113
+    command line parameter.
114
+
115
+ VIDEOHUB_PORT
116
+    Sets the device port. It is equivallent to using -p / --port command
117
+    line parameter.
118
+
119
+
105 120
 Example usage
106 121
 =============
107 122
 

+ 5
- 1
videohubctrl.c View File

@@ -107,8 +107,12 @@ static struct run_cmds {
107 107
 static void parse_options(struct videohub_data *data, int argc, char **argv) {
108 108
 	int j, err = 0;
109 109
 	struct vcmd_entry *c = &parsed_cmds.entry[0];
110
+	// Check environment
111
+	data->dev_host = getenv("VIDEOHUB_HOST");
112
+	data->dev_port = getenv("VIDEOHUB_PORT");
110 113
 	// Set defaults
111
-	data->dev_port = "9990";
114
+	if (!data->dev_port)
115
+		data->dev_port = "9990";
112 116
 	while ((j = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
113 117
 		if (j == '?') // Invalid parameter
114 118
 			exit(EXIT_FAILURE);

Loading…
Cancel
Save