Skip to content

Commit

Permalink
Add support for CONFIGURATION command
Browse files Browse the repository at this point in the history
I have no idea what it does unfortunately.

Thanks to Yannick BARBEAUX for the report.
  • Loading branch information
Georgi Chorbadzhiyski committed Oct 20, 2017
1 parent 0e4a734 commit 1ffab2e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
const char *videohub_commands_text[NUM_COMMANDS] = {
[CMD_PROTOCOL_PREAMBLE] = "PROTOCOL PREAMBLE",
[CMD_VIDEOHUB_DEVICE] = "VIDEOHUB DEVICE",
[CMD_CONFIGURATION] = "CONFIGURATION",
[CMD_INPUT_LABELS] = "INPUT LABELS",
[CMD_OUTPUT_LABELS] = "OUTPUT LABELS",
[CMD_VIDEO_OUTPUT_LOCKS] = "VIDEO OUTPUT LOCKS",
Expand Down Expand Up @@ -51,6 +52,7 @@ const char *videohub_commands_text[NUM_COMMANDS] = {
struct videohub_commands videohub_commands[NUM_COMMANDS] = {
[CMD_PROTOCOL_PREAMBLE] = { .cmd = CMD_PROTOCOL_PREAMBLE , .type = PARSE_CUSTOM },
[CMD_VIDEOHUB_DEVICE] = { .cmd = CMD_VIDEOHUB_DEVICE , .type = PARSE_CUSTOM },
[CMD_CONFIGURATION] = { .cmd = CMD_CONFIGURATION , .type = PARSE_CUSTOM },
[CMD_INPUT_LABELS] = { .cmd = CMD_INPUT_LABELS , .type = PARSE_LABEL,
.ports1 = OFS(inputs),
.port_id1 = "video input",
Expand Down Expand Up @@ -322,6 +324,10 @@ bool parse_command(struct videohub_data *d, char *cmd) {
q("Please report this line to author's email: georgi@unixsol.org\n");
}
break;
case CMD_CONFIGURATION:
if ((p = parse_text(line, "Take Mode: "))) {
d->device.conf_take_mode = streq(p, "true");
}
case CMD_NAK:
ret = false;
break;
Expand Down
3 changes: 2 additions & 1 deletion cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

#include <stdbool.h>

#define NUM_COMMANDS 24
#define NUM_COMMANDS 25

enum vcmd {
CMD_PROTOCOL_PREAMBLE,
CMD_VIDEOHUB_DEVICE,
CMD_CONFIGURATION,
CMD_INPUT_LABELS,
CMD_OUTPUT_LABELS,
CMD_VIDEO_OUTPUT_LOCKS,
Expand Down
1 change: 1 addition & 0 deletions data.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
struct device_desc {
bool dev_present;
bool needs_fw_update;
bool conf_take_mode;
char protocol_ver[16];
char model_name[MAX_NAME_LEN];
char friendly_name[MAX_NAME_LEN];
Expand Down
3 changes: 3 additions & 0 deletions test/input-17.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Debug mode: true
Debug mode: yes
Power: both

CONFIGURATION:
Take Mode: true

INPUT LABELS:
0 Windows 1
1 Windows 2
Expand Down

0 comments on commit 1ffab2e

Please sign in to comment.