aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-ioctl.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2011-03-12 06:54:43 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:53:17 -0400
commit2d28b686adc18567b388362e1f7b86658cfd81fc (patch)
tree233ac5fb1aeb920cb0539719b1761c01ad109049 /drivers/media/video/v4l2-ioctl.c
parent7ebbc39fa0b469243b985e5e26755f1e6184213f (diff)
[media] v4l2-ioctl: add ctrl_handler to v4l2_fh
This is required to implement control events and is also needed to allow for per-filehandle control handlers. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-ioctl.c')
-rw-r--r--drivers/media/video/v4l2-ioctl.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 48b94fcb6a25..36a4a475ab22 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1420,7 +1420,9 @@ static long __video_do_ioctl(struct file *file,
1420 { 1420 {
1421 struct v4l2_queryctrl *p = arg; 1421 struct v4l2_queryctrl *p = arg;
1422 1422
1423 if (vfd->ctrl_handler) 1423 if (vfh && vfh->ctrl_handler)
1424 ret = v4l2_queryctrl(vfh->ctrl_handler, p);
1425 else if (vfd->ctrl_handler)
1424 ret = v4l2_queryctrl(vfd->ctrl_handler, p); 1426 ret = v4l2_queryctrl(vfd->ctrl_handler, p);
1425 else if (ops->vidioc_queryctrl) 1427 else if (ops->vidioc_queryctrl)
1426 ret = ops->vidioc_queryctrl(file, fh, p); 1428 ret = ops->vidioc_queryctrl(file, fh, p);
@@ -1440,7 +1442,9 @@ static long __video_do_ioctl(struct file *file,
1440 { 1442 {
1441 struct v4l2_control *p = arg; 1443 struct v4l2_control *p = arg;
1442 1444
1443 if (vfd->ctrl_handler) 1445 if (vfh && vfh->ctrl_handler)
1446 ret = v4l2_g_ctrl(vfh->ctrl_handler, p);
1447 else if (vfd->ctrl_handler)
1444 ret = v4l2_g_ctrl(vfd->ctrl_handler, p); 1448 ret = v4l2_g_ctrl(vfd->ctrl_handler, p);
1445 else if (ops->vidioc_g_ctrl) 1449 else if (ops->vidioc_g_ctrl)
1446 ret = ops->vidioc_g_ctrl(file, fh, p); 1450 ret = ops->vidioc_g_ctrl(file, fh, p);
@@ -1472,12 +1476,16 @@ static long __video_do_ioctl(struct file *file,
1472 struct v4l2_ext_controls ctrls; 1476 struct v4l2_ext_controls ctrls;
1473 struct v4l2_ext_control ctrl; 1477 struct v4l2_ext_control ctrl;
1474 1478
1475 if (!vfd->ctrl_handler && 1479 if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
1476 !ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls) 1480 !ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls)
1477 break; 1481 break;
1478 1482
1479 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value); 1483 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1480 1484
1485 if (vfh && vfh->ctrl_handler) {
1486 ret = v4l2_s_ctrl(vfh->ctrl_handler, p);
1487 break;
1488 }
1481 if (vfd->ctrl_handler) { 1489 if (vfd->ctrl_handler) {
1482 ret = v4l2_s_ctrl(vfd->ctrl_handler, p); 1490 ret = v4l2_s_ctrl(vfd->ctrl_handler, p);
1483 break; 1491 break;
@@ -1503,7 +1511,9 @@ static long __video_do_ioctl(struct file *file,
1503 struct v4l2_ext_controls *p = arg; 1511 struct v4l2_ext_controls *p = arg;
1504 1512
1505 p->error_idx = p->count; 1513 p->error_idx = p->count;
1506 if (vfd->ctrl_handler) 1514 if (vfh && vfh->ctrl_handler)
1515 ret = v4l2_g_ext_ctrls(vfh->ctrl_handler, p);
1516 else if (vfd->ctrl_handler)
1507 ret = v4l2_g_ext_ctrls(vfd->ctrl_handler, p); 1517 ret = v4l2_g_ext_ctrls(vfd->ctrl_handler, p);
1508 else if (ops->vidioc_g_ext_ctrls && check_ext_ctrls(p, 0)) 1518 else if (ops->vidioc_g_ext_ctrls && check_ext_ctrls(p, 0))
1509 ret = ops->vidioc_g_ext_ctrls(file, fh, p); 1519 ret = ops->vidioc_g_ext_ctrls(file, fh, p);
@@ -1517,10 +1527,13 @@ static long __video_do_ioctl(struct file *file,
1517 struct v4l2_ext_controls *p = arg; 1527 struct v4l2_ext_controls *p = arg;
1518 1528
1519 p->error_idx = p->count; 1529 p->error_idx = p->count;
1520 if (!vfd->ctrl_handler && !ops->vidioc_s_ext_ctrls) 1530 if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
1531 !ops->vidioc_s_ext_ctrls)
1521 break; 1532 break;
1522 v4l_print_ext_ctrls(cmd, vfd, p, 1); 1533 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1523 if (vfd->ctrl_handler) 1534 if (vfh && vfh->ctrl_handler)
1535 ret = v4l2_s_ext_ctrls(vfh->ctrl_handler, p);
1536 else if (vfd->ctrl_handler)
1524 ret = v4l2_s_ext_ctrls(vfd->ctrl_handler, p); 1537 ret = v4l2_s_ext_ctrls(vfd->ctrl_handler, p);
1525 else if (check_ext_ctrls(p, 0)) 1538 else if (check_ext_ctrls(p, 0))
1526 ret = ops->vidioc_s_ext_ctrls(file, fh, p); 1539 ret = ops->vidioc_s_ext_ctrls(file, fh, p);
@@ -1531,10 +1544,13 @@ static long __video_do_ioctl(struct file *file,
1531 struct v4l2_ext_controls *p = arg; 1544 struct v4l2_ext_controls *p = arg;
1532 1545
1533 p->error_idx = p->count; 1546 p->error_idx = p->count;
1534 if (!vfd->ctrl_handler && !ops->vidioc_try_ext_ctrls) 1547 if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
1548 !ops->vidioc_try_ext_ctrls)
1535 break; 1549 break;
1536 v4l_print_ext_ctrls(cmd, vfd, p, 1); 1550 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1537 if (vfd->ctrl_handler) 1551 if (vfh && vfh->ctrl_handler)
1552 ret = v4l2_try_ext_ctrls(vfh->ctrl_handler, p);
1553 else if (vfd->ctrl_handler)
1538 ret = v4l2_try_ext_ctrls(vfd->ctrl_handler, p); 1554 ret = v4l2_try_ext_ctrls(vfd->ctrl_handler, p);
1539 else if (check_ext_ctrls(p, 0)) 1555 else if (check_ext_ctrls(p, 0))
1540 ret = ops->vidioc_try_ext_ctrls(file, fh, p); 1556 ret = ops->vidioc_try_ext_ctrls(file, fh, p);
@@ -1544,7 +1560,9 @@ static long __video_do_ioctl(struct file *file,
1544 { 1560 {
1545 struct v4l2_querymenu *p = arg; 1561 struct v4l2_querymenu *p = arg;
1546 1562
1547 if (vfd->ctrl_handler) 1563 if (vfh && vfh->ctrl_handler)
1564 ret = v4l2_querymenu(vfh->ctrl_handler, p);
1565 else if (vfd->ctrl_handler)
1548 ret = v4l2_querymenu(vfd->ctrl_handler, p); 1566 ret = v4l2_querymenu(vfd->ctrl_handler, p);
1549 else if (ops->vidioc_querymenu) 1567 else if (ops->vidioc_querymenu)
1550 ret = ops->vidioc_querymenu(file, fh, p); 1568 ret = ops->vidioc_querymenu(file, fh, p);