Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306232
b: refs/heads/master
c: 805e9b4
h: refs/heads/master
v: v3
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed May 7, 2012
1 parent 0a5d22d commit a9664d3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 55afeb8a4d3ffdf8de546d5de37aca5b229ca9a4
refs/heads/master: 805e9b4a06bf874c56e0811e9cca5e25cf465e42
58 changes: 56 additions & 2 deletions trunk/drivers/media/video/uvc/uvc_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,22 +1177,76 @@ static void uvc_ctrl_send_event(struct uvc_fh *handle,

list_for_each_entry(sev, &mapping->ev_subs, node) {
if (sev->fh && (sev->fh != &handle->vfh ||
(sev->flags & V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK)))
(sev->flags & V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK) ||
(changes & V4L2_EVENT_CTRL_CH_FLAGS)))
v4l2_event_queue_fh(sev->fh, &ev);
}
}

static void uvc_ctrl_send_slave_event(struct uvc_fh *handle,
struct uvc_control *master, u32 slave_id,
const struct v4l2_ext_control *xctrls, unsigned int xctrls_count)
{
struct uvc_control_mapping *mapping = NULL;
struct uvc_control *ctrl = NULL;
u32 changes = V4L2_EVENT_CTRL_CH_FLAGS;
unsigned int i;
s32 val = 0;

/*
* We can skip sending an event for the slave if the slave
* is being modified in the same transaction.
*/
for (i = 0; i < xctrls_count; i++) {
if (xctrls[i].id == slave_id)
return;
}

__uvc_find_control(master->entity, slave_id, &mapping, &ctrl, 0);
if (ctrl == NULL)
return;

if (__uvc_ctrl_get(handle->chain, ctrl, mapping, &val) == 0)
changes |= V4L2_EVENT_CTRL_CH_VALUE;

uvc_ctrl_send_event(handle, ctrl, mapping, val, changes);
}

static void uvc_ctrl_send_events(struct uvc_fh *handle,
const struct v4l2_ext_control *xctrls, unsigned int xctrls_count)
{
struct uvc_control_mapping *mapping;
struct uvc_control *ctrl;
u32 changes = V4L2_EVENT_CTRL_CH_VALUE;
unsigned int i;
unsigned int j;

for (i = 0; i < xctrls_count; ++i) {
ctrl = uvc_find_control(handle->chain, xctrls[i].id, &mapping);

for (j = 0; j < ARRAY_SIZE(mapping->slave_ids); ++j) {
if (!mapping->slave_ids[j])
break;
uvc_ctrl_send_slave_event(handle, ctrl,
mapping->slave_ids[j],
xctrls, xctrls_count);
}

/*
* If the master is being modified in the same transaction
* flags may change too.
*/
if (mapping->master_id) {
for (j = 0; j < xctrls_count; j++) {
if (xctrls[j].id == mapping->master_id) {
changes |= V4L2_EVENT_CTRL_CH_FLAGS;
break;
}
}
}

uvc_ctrl_send_event(handle, ctrl, mapping, xctrls[i].value,
V4L2_EVENT_CTRL_CH_VALUE);
changes);
}
}

Expand Down

0 comments on commit a9664d3

Please sign in to comment.