aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp15
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.h1
-rw-r--r--utils/v4l2-compliance/v4l2-test-media.cpp16
3 files changed, 26 insertions, 6 deletions
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 30fcf6c..60ee2fe 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -596,6 +596,10 @@ static int testCap(struct node *node)
memcmp(vcap.bus_info, "platform:", 9) &&
memcmp(vcap.bus_info, "rmi4:", 5))
return fail("missing bus_info prefix ('%s')\n", vcap.bus_info);
+ if (!node->media_bus_info.empty() &&
+ node->media_bus_info != std::string((const char *)vcap.bus_info))
+ warn("media bus_info '%s' differs from V4L2 bus_info '%s'\n",
+ node->media_bus_info.c_str(), vcap.bus_info);
fail_on_test((vcap.version >> 16) < 3);
fail_on_test(check_0(vcap.reserved, sizeof(vcap.reserved)));
caps = vcap.capabilities;
@@ -805,13 +809,14 @@ void testNode(struct node &node, struct node &expbuf_node, media_type type,
if (!node.is_media())
media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
- if (!node.is_v4l2()) {
- int fd = node.is_media() ? node.g_fd() : media_fd;
- if (fd >= 0) {
- struct media_device_info mdinfo;
+ int fd = node.is_media() ? node.g_fd() : media_fd;
+ if (fd >= 0) {
+ struct media_device_info mdinfo;
- if (!ioctl(fd, MEDIA_IOC_DEVICE_INFO, &mdinfo))
+ if (!ioctl(fd, MEDIA_IOC_DEVICE_INFO, &mdinfo)) {
+ if (!node.is_v4l2())
driver = mdinfo.driver;
+ node.media_bus_info = mdinfo.bus_info;
}
}
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index 540078b..f353b6f 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -113,6 +113,7 @@ struct base_node {
unsigned priv_compound_controls;
unsigned codec_mask;
__u32 media_version;
+ std::string media_bus_info;
media_entity_desc entity;
media_pad_desc *pads;
media_link_desc *links;
diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
index ae5f0c8..b2322e5 100644
--- a/utils/v4l2-compliance/v4l2-test-media.cpp
+++ b/utils/v4l2-compliance/v4l2-test-media.cpp
@@ -47,7 +47,21 @@ int testMediaDeviceInfo(struct node *node)
fail_on_test(check_string(mdinfo.driver, sizeof(mdinfo.driver)));
fail_on_test(mdinfo.model[0] && check_string(mdinfo.model, sizeof(mdinfo.model)));
fail_on_test(mdinfo.serial[0] && check_string(mdinfo.serial, sizeof(mdinfo.serial)));
- fail_on_test(mdinfo.bus_info[0] && check_string(mdinfo.bus_info, sizeof(mdinfo.bus_info)));
+ if (!mdinfo.bus_info[0]) {
+ warn("empty bus_info\n");
+ } else {
+ fail_on_test(check_string(mdinfo.bus_info, sizeof(mdinfo.bus_info)));
+ // Check for valid prefixes
+ if (memcmp(mdinfo.bus_info, "usb-", 4) &&
+ memcmp(mdinfo.bus_info, "PCI:", 4) &&
+ memcmp(mdinfo.bus_info, "PCIe:", 5) &&
+ memcmp(mdinfo.bus_info, "ISA:", 4) &&
+ memcmp(mdinfo.bus_info, "I2C:", 4) &&
+ memcmp(mdinfo.bus_info, "parport", 7) &&
+ memcmp(mdinfo.bus_info, "platform:", 9) &&
+ memcmp(mdinfo.bus_info, "rmi4:", 5))
+ return fail("missing bus_info prefix ('%s')\n", mdinfo.bus_info);
+ }
fail_on_test(mdinfo.media_version == 0);
if (mdinfo.media_version != MEDIA_API_VERSION)
fail_on_test(mdinfo.driver_version != mdinfo.media_version);

Privacy Policy