Browse Source

Display where each input is being routed.

Now both sides of a connection are seen:
  input  -> output(s)
  output <- input
Georgi Chorbadzhiyski 9 years ago
parent
commit
f7eb956180
4 changed files with 52 additions and 28 deletions
  1. 1
    0
      ChangeLog
  2. 23
    21
      README
  3. 26
    6
      display.c
  4. 2
    1
      videohubctrl.1

+ 1
- 0
ChangeLog View File

@@ -2,6 +2,7 @@
2 2
 2014-11-29 : Version 0.4-dev
3 3
  * Add videohubctrl(1) man page.
4 4
  * Add all, install, uninstall and help Makefile targets.
5
+ * Display where each input is being routed.
5 6
 
6 7
 2014-11-28 : Version 0.3
7 8
  * Rename -v / --verbose parameter to -d / --debug.

+ 23
- 21
README View File

@@ -152,26 +152,28 @@ Device info
152 152
   -----------------------------------------------------------
153 153
 
154 154
 Video inputs
155
-  ---------------------------------
156
-  | ## | Video input name         |
157
-  ---------------------------------
158
-  |  1 | Windows 1                |
159
-  |  2 | Windows 2                |
160
-  |  3 | Windows 3                |
161
-  |  4 | Windows 4 HD             |
162
-  |  5 | Input 5                  |
163
-  |  6 | Input 6                  |
164
-  |  7 | Input 7                  |
165
-  |  8 | Input 8                  |
166
-  |  9 | Input 9                  |
167
-  | 10 | Input 10                 |
168
-  | 11 | Input 11                 |
169
-  | 12 | DPlay1                   |
170
-  | 13 | DPlay2                   |
171
-  | 14 | Input 14                 |
172
-  | 15 | Input 15                 |
173
-  | 16 | Loopback                 |
174
-  ---------------------------------
155
+  ----------------------------------------------------------------
156
+  | ## | Video input name         | n | Routed to output         |
157
+  ----------------------------------------------------------------
158
+  |  1 | Windows 1                | 2 | Enc1 3                   |
159
+  |    |                          | . | Enc1 4                   |
160
+  |  2 | Windows 2                | 1 | Enc1 2                   |
161
+  |  3 | Windows 3                | 1 | Enc1 1                   |
162
+  |  4 | Windows 4 HD             | 2 | Output 8                 |
163
+  |    |                          | . | Enc2 1                   |
164
+  |  5 | Input 5                  | 1 | Output 5                 |
165
+  |  6 | Input 6                  | 1 | Output 6                 |
166
+  |  7 | Input 7                  | 1 | Output 7                 |
167
+  |  8 | Input 8                  | 0 | -                        |
168
+  |  9 | Input 9                  | 0 | -                        |
169
+  | 10 | Input 10                 | 1 | Output 10                |
170
+  | 11 | Input 11                 | 1 | Output 11                |
171
+  | 12 | DPlay1                   | 1 | Output 13                |
172
+  | 13 | DPlay2                   | 1 | Denc                     |
173
+  | 14 | Input 14                 | 1 | Output 14                |
174
+  | 15 | Input 15                 | 1 | Output 15                |
175
+  | 16 | Loopback                 | 1 | Loopback                 |
176
+  ----------------------------------------------------------------
175 177
 
176 178
 Video outputs
177 179
   ----------------------------------------------------------------
@@ -184,7 +186,7 @@ Video outputs
184 186
   |  5 |   | Output 5                 | Input 5                  |
185 187
   |  6 |   | Output 6                 | Input 6                  |
186 188
   |  7 |   | Output 7                 | Input 7                  |
187
-  |  8 |   | Output 8                 | Input 8                  |
189
+  |  8 |   | Output 8                 | Windows 4 HD             |
188 190
   |  9 | L | Enc2 1                   | Windows 4 HD             |
189 191
   | 10 |   | Output 10                | Input 10                 |
190 192
   | 11 |   | Output 11                | Input 11                 |

+ 26
- 6
display.c View File

@@ -45,18 +45,38 @@ void print_device_info(struct videohub_data *d) {
45 45
 }
46 46
 
47 47
 void print_device_video_inputs(struct videohub_data *d) {
48
-	unsigned int i, len = 33;
48
+	unsigned int i, r, len = 64;
49 49
 	if (!d->device.num_video_inputs)
50 50
 		return;
51 51
 	printf("Video inputs\n");
52 52
 	printf_line(len);
53
-	printf("  | ## | %-24s |\n", "Video input name");
53
+	printf("  | ## | %-24s | n | %-24s |\n", "Video input name", "Routed to output");
54 54
 	printf_line(len);
55 55
 	for(i = 0; i < d->device.num_video_inputs; i++) {
56
-		printf("  | %2d | %-24s |\n",
57
-			i + 1,
58
-			d->inputs[i].name
59
-		);
56
+		unsigned int num_outputs = 0, routed_to = 0;
57
+		for(r = 0; r < d->device.num_video_outputs; r++) {
58
+			if (d->outputs[r].routed_to == i) {
59
+				num_outputs++;
60
+				if (num_outputs == 1)
61
+					routed_to = r; // The first output
62
+			}
63
+		}
64
+		printf("  | %2d | %-24s | %d | ", i + 1, d->inputs[i].name, num_outputs);
65
+		if (num_outputs == 0) {
66
+			printf("%-24s |\n", "-");
67
+		} else {
68
+			printf("%-24s |\n", d->outputs[routed_to].name);
69
+			bool first_skipped = false;
70
+			for(r = 0; r < d->device.num_video_outputs; r++) {
71
+				if (d->outputs[r].routed_to == i) {
72
+					if (!first_skipped) {
73
+						first_skipped = true;
74
+						continue;
75
+					}
76
+					printf("  | %2s | %-24s | %s | %-24s |\n", " ", " ", ".", d->outputs[r].name);
77
+				}
78
+			}
79
+		}
60 80
 	}
61 81
 	printf_line(len);
62 82
 	printf("\n");

+ 2
- 1
videohubctrl.1 View File

@@ -45,7 +45,8 @@ Show the command line that will restore the device to it's configuration.
45 45
 Display main device info including model, number of ports, etc.
46 46
 .TP
47 47
 \fB\-\-list\-vinputs\fR
48
-Display device video inputs and their names.
48
+Display device video inputs and their names, how many outputs an input
49
+is being routed to and a list of the outputs.
49 50
 .TP
50 51
 \fB\-\-list\-voutputs\fR
51 52
 Display device video outputs, their names, locking status and which

Loading…
Cancel
Save