|
@@ -11,17 +11,17 @@
|
|
#include "util.h"
|
|
#include "util.h"
|
|
|
|
|
|
int
|
|
int
|
|
-setup_link(libmegapixels_camera *camera, uint32_t source_entity_id, uint32_t sink_entity_id, int enabled)
|
|
|
|
|
|
+setup_link(libmegapixels_camera *camera, uint32_t source_entity_id, uint32_t sink_entity_id,
|
|
|
|
+ uint16_t source_index, uint16_t sink_index, int enabled)
|
|
{
|
|
{
|
|
struct media_link_desc link = {};
|
|
struct media_link_desc link = {};
|
|
link.flags = (enabled > 0) ? MEDIA_LNK_FL_ENABLED : 0;
|
|
link.flags = (enabled > 0) ? MEDIA_LNK_FL_ENABLED : 0;
|
|
link.source.entity = source_entity_id;
|
|
link.source.entity = source_entity_id;
|
|
- link.source.index = 0;
|
|
|
|
|
|
+ link.source.index = source_index;
|
|
link.sink.entity = sink_entity_id;
|
|
link.sink.entity = sink_entity_id;
|
|
- link.sink.index = 0;
|
|
|
|
|
|
+ link.sink.index = sink_index;
|
|
|
|
|
|
if (xioctl(camera->media_fd, MEDIA_IOC_SETUP_LINK, &link) == -1) {
|
|
if (xioctl(camera->media_fd, MEDIA_IOC_SETUP_LINK, &link) == -1) {
|
|
- log_error("Could not setup link: %s\n", strerror(errno));
|
|
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
@@ -107,7 +107,7 @@ load_entity_ids(libmegapixels_camera *camera)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- setup_link(camera, source_entity, sink_entity, 0);
|
|
|
|
|
|
+ setup_link(camera, source_entity, sink_entity, 0, 0, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
@@ -187,7 +187,7 @@ libmegapixels_select_mode(libmegapixels_camera *camera, libmegapixels_mode *mode
|
|
struct v4l2_subdev_format subdev_fmt = {};
|
|
struct v4l2_subdev_format subdev_fmt = {};
|
|
switch (cmd->type) {
|
|
switch (cmd->type) {
|
|
case LIBMEGAPIXELS_CMD_LINK:
|
|
case LIBMEGAPIXELS_CMD_LINK:
|
|
- if (setup_link(camera, cmd->entity_from_id, cmd->entity_to_id, 1) != 0) {
|
|
|
|
|
|
+ if (setup_link(camera, cmd->entity_from_id, cmd->entity_to_id, cmd->pad_from, cmd->pad_to, 1) != 0) {
|
|
log_error("Could not link %d -> %d [%s -> %s] \n", cmd->entity_from_id, cmd->entity_to_id,
|
|
log_error("Could not link %d -> %d [%s -> %s] \n", cmd->entity_from_id, cmd->entity_to_id,
|
|
cmd->entity_from,
|
|
cmd->entity_from,
|
|
cmd->entity_to);
|
|
cmd->entity_to);
|