Commit 3d023ff2 authored by Hans Verkuil's avatar Hans Verkuil

media: vivid: add instance number to input/output names

Add the instance number before the input or output number.
So "HDMI 1" becomes "HDMI 000-1".

This is helps identifying which input or output belongs to
which vivid instance.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 17763960
...@@ -1073,13 +1073,13 @@ int vidioc_enum_input(struct file *file, void *priv, ...@@ -1073,13 +1073,13 @@ int vidioc_enum_input(struct file *file, void *priv,
inp->type = V4L2_INPUT_TYPE_CAMERA; inp->type = V4L2_INPUT_TYPE_CAMERA;
switch (dev->input_type[inp->index]) { switch (dev->input_type[inp->index]) {
case WEBCAM: case WEBCAM:
snprintf(inp->name, sizeof(inp->name), "Webcam %u", snprintf(inp->name, sizeof(inp->name), "Webcam %03u-%u",
dev->input_name_counter[inp->index]); dev->inst, dev->input_name_counter[inp->index]);
inp->capabilities = 0; inp->capabilities = 0;
break; break;
case TV: case TV:
snprintf(inp->name, sizeof(inp->name), "TV %u", snprintf(inp->name, sizeof(inp->name), "TV %03u-%u",
dev->input_name_counter[inp->index]); dev->inst, dev->input_name_counter[inp->index]);
inp->type = V4L2_INPUT_TYPE_TUNER; inp->type = V4L2_INPUT_TYPE_TUNER;
inp->std = V4L2_STD_ALL; inp->std = V4L2_STD_ALL;
if (dev->has_audio_inputs) if (dev->has_audio_inputs)
...@@ -1087,16 +1087,16 @@ int vidioc_enum_input(struct file *file, void *priv, ...@@ -1087,16 +1087,16 @@ int vidioc_enum_input(struct file *file, void *priv,
inp->capabilities = V4L2_IN_CAP_STD; inp->capabilities = V4L2_IN_CAP_STD;
break; break;
case SVID: case SVID:
snprintf(inp->name, sizeof(inp->name), "S-Video %u", snprintf(inp->name, sizeof(inp->name), "S-Video %03u-%u",
dev->input_name_counter[inp->index]); dev->inst, dev->input_name_counter[inp->index]);
inp->std = V4L2_STD_ALL; inp->std = V4L2_STD_ALL;
if (dev->has_audio_inputs) if (dev->has_audio_inputs)
inp->audioset = (1 << ARRAY_SIZE(vivid_audio_inputs)) - 1; inp->audioset = (1 << ARRAY_SIZE(vivid_audio_inputs)) - 1;
inp->capabilities = V4L2_IN_CAP_STD; inp->capabilities = V4L2_IN_CAP_STD;
break; break;
case HDMI: case HDMI:
snprintf(inp->name, sizeof(inp->name), "HDMI %u", snprintf(inp->name, sizeof(inp->name), "HDMI %03u-%u",
dev->input_name_counter[inp->index]); dev->inst, dev->input_name_counter[inp->index]);
inp->capabilities = V4L2_IN_CAP_DV_TIMINGS; inp->capabilities = V4L2_IN_CAP_DV_TIMINGS;
if (dev->edid_blocks == 0 || if (dev->edid_blocks == 0 ||
dev->dv_timings_signal_mode[dev->input] == NO_SIGNAL) dev->dv_timings_signal_mode[dev->input] == NO_SIGNAL)
......
...@@ -966,16 +966,16 @@ int vidioc_enum_output(struct file *file, void *priv, ...@@ -966,16 +966,16 @@ int vidioc_enum_output(struct file *file, void *priv,
out->type = V4L2_OUTPUT_TYPE_ANALOG; out->type = V4L2_OUTPUT_TYPE_ANALOG;
switch (dev->output_type[out->index]) { switch (dev->output_type[out->index]) {
case SVID: case SVID:
snprintf(out->name, sizeof(out->name), "S-Video %u", snprintf(out->name, sizeof(out->name), "S-Video %03u-%u",
dev->output_name_counter[out->index]); dev->inst, dev->output_name_counter[out->index]);
out->std = V4L2_STD_ALL; out->std = V4L2_STD_ALL;
if (dev->has_audio_outputs) if (dev->has_audio_outputs)
out->audioset = (1 << ARRAY_SIZE(vivid_audio_outputs)) - 1; out->audioset = (1 << ARRAY_SIZE(vivid_audio_outputs)) - 1;
out->capabilities = V4L2_OUT_CAP_STD; out->capabilities = V4L2_OUT_CAP_STD;
break; break;
case HDMI: case HDMI:
snprintf(out->name, sizeof(out->name), "HDMI %u", snprintf(out->name, sizeof(out->name), "HDMI %03u-%u",
dev->output_name_counter[out->index]); dev->inst, dev->output_name_counter[out->index]);
out->capabilities = V4L2_OUT_CAP_DV_TIMINGS; out->capabilities = V4L2_OUT_CAP_DV_TIMINGS;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment