ret = uvc_meta_v4l2_try_format(file, fh, format); if (ret < 0) return ret;
/* * We could in principle switch at any time, also during streaming. * Metadata buffers would still be perfectly parseable, but it's more * consistent and cleaner to disallow that.
*/
mutex_lock(&stream->mutex);
if (vb2_is_busy(&stream->meta.queue.queue))
ret = -EBUSY; else
stream->meta.format = fmt->dataformat;
entity = uvc_meta_find_msxu(dev); if (!entity) return 0;
/* * USB requires buffers aligned in a special way, simplest way is to * make sure that query_ctrl will work is to kmalloc() them.
*/
data = kmalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM;
/* Check if the metadata is already enabled. */
ret = uvc_query_ctrl(dev, UVC_GET_CUR, entity->id, dev->intfnum,
MSXU_CONTROL_METADATA, data, sizeof(*data)); if (ret) return 0;
if (*data) {
dev->quirks |= UVC_QUIRK_MSXU_META; return 0;
}
/* * 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.
*/
ret = uvc_query_ctrl(dev, UVC_GET_MAX, entity->id, dev->intfnum,
MSXU_CONTROL_METADATA, data, sizeof(*data)); if (ret || !*data) return 0;
/* * If we can set MSXU_CONTROL_METADATA, the device will report * metadata.
*/
ret = uvc_query_ctrl(dev, UVC_SET_CUR, entity->id, dev->intfnum,
MSXU_CONTROL_METADATA, data, sizeof(*data)); if (!ret)
dev->quirks |= UVC_QUIRK_MSXU_META;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.