d/v4l2: Expose more information

This commit is contained in:
Jakob Bornecrantz 2020-09-06 13:31:10 +01:00 committed by Jakob Bornecrantz
parent fa2748637a
commit bd257500b8
4 changed files with 19 additions and 3 deletions

View file

@ -0,0 +1 @@
v4l2: Expose more information through new fields in XRT interface.

View file

@ -740,7 +740,11 @@ v4l2_fs_node_destroy(struct xrt_frame_node *node)
}
struct xrt_fs *
v4l2_fs_create(struct xrt_frame_context *xfctx, const char *path)
v4l2_fs_create(struct xrt_frame_context *xfctx,
const char *path,
const char *product,
const char *manufacturer,
const char *serial)
{
struct v4l2_fs *vid = U_TYPED_CALLOC(struct v4l2_fs);
vid->base.enumerate_modes = v4l2_fs_enumerate_modes;
@ -753,6 +757,10 @@ v4l2_fs_create(struct xrt_frame_context *xfctx, const char *path)
vid->ll = debug_get_log_option_v4l2_log();
vid->fd = -1;
snprintf(vid->base.product, sizeof(vid->base.product), "%s", product);
snprintf(vid->base.manufacturer, sizeof(vid->base.manufacturer), "%s", manufacturer);
snprintf(vid->base.serial, sizeof(vid->base.serial), "%s", serial);
int fd = open(path, O_RDWR, 0);
if (fd < 0) {
V4L2_ERROR(vid, "Can not open '%s'", path);

View file

@ -58,13 +58,19 @@ struct v4l2_source_descriptor
uint32_t rate;
};
/*!
* Create a v4l2 frameserver
*
* @ingroup drv_v4l2
*/
struct xrt_fs *
v4l2_fs_create(struct xrt_frame_context *xfctx, const char *path);
v4l2_fs_create(struct xrt_frame_context *xfctx,
const char *path,
const char *product,
const char *manufacturer,
const char *serial);
#ifdef __cplusplus

View file

@ -758,7 +758,8 @@ open_video_device(struct xrt_prober *xp,
return -1;
}
struct xrt_fs *xfs = v4l2_fs_create(xfctx, pdev->v4ls[0].path);
struct xrt_fs *xfs =
v4l2_fs_create(xfctx, pdev->v4ls[0].path, pdev->usb.product, pdev->usb.manufacturer, pdev->usb.serial);
if (xfs == NULL) {
return -1;
}