aboutsummaryrefslogtreecommitdiffstats
path: root/utils/common/media-info.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2018-11-29 16:09:54 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2018-11-29 16:09:54 +0100
commit6b861cec32436495418eeaaa6bf384c60dcd3a31 (patch)
tree885cfd50a6a5ca8c46b7ac26f281b9aa5f7a9180 /utils/common/media-info.cpp
parent8c5a3e1d74315d920327fc386867d2d611fb8768 (diff)
media-info: fix more checks around radio interfaces
Radio interfaces do not link to an entity, so link/entity checking should be skipped. Commit dce0945e8220 tried to fix this, but it was incomplete. This change completely skips the link and entity checks of an interface since radio interfaces are completely stand-alone at the moment. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/common/media-info.cpp')
-rw-r--r--utils/common/media-info.cpp43
1 files changed, 29 insertions, 14 deletions
diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
index eab93f60..033821ed 100644
--- a/utils/common/media-info.cpp
+++ b/utils/common/media-info.cpp
@@ -453,30 +453,45 @@ static __u32 read_topology(int media_fd, __u32 major, __u32 minor,
if (v2_links[i].source_id == iface.id)
break;
}
- if (i == topology.num_links && iface.intf_type != MEDIA_INTF_T_V4L_RADIO) {
+ bool is_radio = iface.intf_type == MEDIA_INTF_T_V4L_RADIO;
+
+ if (is_radio && i < topology.num_links) {
if (is_invalid)
*is_invalid = true;
- fprintf(stderr, "FAIL: could not find link for interface 0x%08x in topology\n",
+ fprintf(stderr, "FAIL: unexpectedly found link for radio interface 0x%08x in topology\n",
iface.id);
return MEDIA_ENT_F_UNKNOWN;
}
- __u32 ent_id = v2_links[i].sink_id;
- for (i = 0; i < topology.num_entities; i++) {
- if (v2_ents[i].id == ent_id)
- break;
- }
- if (i == topology.num_entities) {
- if (is_invalid)
- *is_invalid = true;
- fprintf(stderr, "FAIL: could not find entity 0x%08x in topology\n",
- ent_id);
- return MEDIA_ENT_F_UNKNOWN;
+ if (!is_radio) {
+ if (i == topology.num_links) {
+ if (is_invalid)
+ *is_invalid = true;
+ fprintf(stderr, "FAIL: could not find link for interface 0x%08x in topology\n",
+ iface.id);
+ return MEDIA_ENT_F_UNKNOWN;
+ }
+ __u32 ent_id = v2_links[i].sink_id;
+ for (i = 0; i < topology.num_entities; i++) {
+ if (v2_ents[i].id == ent_id)
+ break;
+ }
+ if (i == topology.num_entities) {
+ if (is_invalid)
+ *is_invalid = true;
+ fprintf(stderr, "FAIL: could not find entity 0x%08x in topology\n",
+ ent_id);
+ return MEDIA_ENT_F_UNKNOWN;
+ }
}
- media_v2_entity &ent = v2_ents[i];
printf("Interface Info:\n");
printf("\tID : 0x%08x\n", iface.id);
printf("\tType : %s\n", mi_ifacetype2s(iface.intf_type).c_str());
+
+ if (is_radio)
+ return MEDIA_ENT_F_UNKNOWN;
+
+ media_v2_entity &ent = v2_ents[i];
printf("Entity Info:\n");
printf("\tID : 0x%08x (%u)\n", ent.id, ent.id);
printf("\tName : %s\n", ent.name);

Privacy Policy