if (!data)
return -ENOMEM;
- /* Check if the metadata is already enabled. */
+ /*
+ * Check if the metadata is already enabled, or if the device always
+ * returns metadata.
+ */
ret = uvc_query_ctrl(dev, UVC_GET_CUR, entity->id, dev->intfnum,
MSXU_CONTROL_METADATA, data, sizeof(*data));
if (ret)
}
/*
- * We have seen devices that require 1 to enable the metadata, others
- * requiring a value != 1 and others requiring a value >1. Luckily for
- * us, the value from GET_MAX seems to work all the time.
+ * Set the value of MSXU_CONTROL_METADATA to the value reported by
+ * GET_MAX to enable production of MSXU metadata. The GET_MAX request
+ * reports the maximum size of the metadata, if its value is 0 then MSXU
+ * metadata is not supported. For more information, see
+ * https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5#2229-metadata-control
*/
ret = uvc_query_ctrl(dev, UVC_GET_MAX, entity->id, dev->intfnum,
MSXU_CONTROL_METADATA, data, sizeof(*data));