Browse Source

Update monitor at least once every 10 seconds and display the time.

Georgi Chorbadzhiyski 9 years ago
parent
commit
d664f6372b
2 changed files with 10 additions and 1 deletions
  1. 1
    0
      ChangeLog
  2. 9
    1
      videohubctrl.c

+ 1
- 0
ChangeLog View File

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

+ 9
- 1
videohubctrl.c View File

@@ -259,13 +259,21 @@ int main(int argc, char **argv) {
259 259
 		//print_device_settings(data);
260 260
 	} else if (show_monitor) {
261 261
 		while (1) {
262
+			int sleeps = 0;
262 263
 			printf("\e[2J\e[H"); // Clear screen
264
+			time_t now = time(NULL);
265
+			struct tm *tm = localtime(&now);
266
+			printf("Last update: %s\n", asctime(tm));
263 267
 			print_device_info(data);
264 268
 			print_device_video_inputs(data);
265 269
 			print_device_video_outputs(data);
266 270
 			fflush(stdout);
267 271
 			do {
268
-				sleep(1);
272
+				usleep(500000);
273
+				if (++sleeps >= 20) {
274
+					char *ping_cmd = "PING:\n\n";
275
+					fdwrite(data->dev_fd, ping_cmd, strlen(ping_cmd));
276
+				}
269 277
 			} while (read_device_command_stream(data) == 0);
270 278
 		}
271 279
 	} else if (show_list) {

Loading…
Cancel
Save