diff options
author | Mike Isely <isely@pobox.com> | 2006-06-25 19:04:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-26 23:17:31 -0400 |
commit | 1d9f8461f1a870571f9403a312c26deec3305be5 (patch) | |
tree | c677a3577f88655f872ee0f96b741ebfd1807b49 /drivers/media | |
parent | b46cfa805ed12c11fea0adc8e4058000c2e67314 (diff) |
V4L/DVB (4243): Exploit new V4L control features in pvrusb2
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 5 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 73 |
2 files changed, 76 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index e4484f95ea9e..d5df9fbeba2f 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -230,6 +230,11 @@ unsigned int pvr2_ctrl_get_v4lflags(struct pvr2_ctrl *cptr) | |||
230 | flags = cptr->info->get_v4lflags(cptr); | 230 | flags = cptr->info->get_v4lflags(cptr); |
231 | } | 231 | } |
232 | 232 | ||
233 | if (cptr->info->set_value) { | ||
234 | flags &= ~V4L2_CTRL_FLAG_READ_ONLY; | ||
235 | } else { | ||
236 | flags |= V4L2_CTRL_FLAG_READ_ONLY; | ||
237 | } | ||
233 | 238 | ||
234 | return flags; | 239 | return flags; |
235 | } | 240 | } |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 9fefcdf8ffab..5e8fd8630110 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
@@ -518,7 +518,13 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
518 | struct pvr2_ctrl *cptr; | 518 | struct pvr2_ctrl *cptr; |
519 | struct v4l2_queryctrl *vc = (struct v4l2_queryctrl *)arg; | 519 | struct v4l2_queryctrl *vc = (struct v4l2_queryctrl *)arg; |
520 | ret = 0; | 520 | ret = 0; |
521 | cptr = pvr2_hdw_get_ctrl_v4l(hdw,vc->id); | 521 | if (vc->id & V4L2_CTRL_FLAG_NEXT_CTRL) { |
522 | cptr = pvr2_hdw_get_ctrl_nextv4l( | ||
523 | hdw,(vc->id & ~V4L2_CTRL_FLAG_NEXT_CTRL)); | ||
524 | if (cptr) vc->id = pvr2_ctrl_get_v4lid(cptr); | ||
525 | } else { | ||
526 | cptr = pvr2_hdw_get_ctrl_v4l(hdw,vc->id); | ||
527 | } | ||
522 | if (!cptr) { | 528 | if (!cptr) { |
523 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 529 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
524 | "QUERYCTRL id=0x%x not implemented here", | 530 | "QUERYCTRL id=0x%x not implemented here", |
@@ -542,7 +548,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
542 | vc->step = 1; | 548 | vc->step = 1; |
543 | break; | 549 | break; |
544 | case pvr2_ctl_bool: | 550 | case pvr2_ctl_bool: |
545 | vc->type = V4L2_CTRL_TYPE_INTEGER; | 551 | vc->type = V4L2_CTRL_TYPE_BOOLEAN; |
546 | vc->minimum = 0; | 552 | vc->minimum = 0; |
547 | vc->maximum = 1; | 553 | vc->maximum = 1; |
548 | vc->step = 1; | 554 | vc->step = 1; |
@@ -593,6 +599,69 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
593 | break; | 599 | break; |
594 | } | 600 | } |
595 | 601 | ||
602 | case VIDIOC_G_EXT_CTRLS: | ||
603 | { | ||
604 | struct v4l2_ext_controls *ctls = | ||
605 | (struct v4l2_ext_controls *)arg; | ||
606 | struct v4l2_ext_control *ctrl; | ||
607 | unsigned int idx; | ||
608 | int val; | ||
609 | for (idx = 0; idx < ctls->count; idx++) { | ||
610 | ctrl = ctls->controls + idx; | ||
611 | ret = pvr2_ctrl_get_value( | ||
612 | pvr2_hdw_get_ctrl_v4l(hdw,ctrl->id),&val); | ||
613 | if (ret) { | ||
614 | ctls->error_idx = idx; | ||
615 | break; | ||
616 | } | ||
617 | /* Ensure that if read as a 64 bit value, the user | ||
618 | will still get a hopefully sane value */ | ||
619 | ctrl->value64 = 0; | ||
620 | ctrl->value = val; | ||
621 | } | ||
622 | break; | ||
623 | } | ||
624 | |||
625 | case VIDIOC_S_EXT_CTRLS: | ||
626 | { | ||
627 | struct v4l2_ext_controls *ctls = | ||
628 | (struct v4l2_ext_controls *)arg; | ||
629 | struct v4l2_ext_control *ctrl; | ||
630 | unsigned int idx; | ||
631 | for (idx = 0; idx < ctls->count; idx++) { | ||
632 | ctrl = ctls->controls + idx; | ||
633 | ret = pvr2_ctrl_set_value( | ||
634 | pvr2_hdw_get_ctrl_v4l(hdw,ctrl->id), | ||
635 | ctrl->value); | ||
636 | if (ret) { | ||
637 | ctls->error_idx = idx; | ||
638 | break; | ||
639 | } | ||
640 | } | ||
641 | break; | ||
642 | } | ||
643 | |||
644 | case VIDIOC_TRY_EXT_CTRLS: | ||
645 | { | ||
646 | struct v4l2_ext_controls *ctls = | ||
647 | (struct v4l2_ext_controls *)arg; | ||
648 | struct v4l2_ext_control *ctrl; | ||
649 | struct pvr2_ctrl *pctl; | ||
650 | unsigned int idx; | ||
651 | /* For the moment just validate that the requested control | ||
652 | actually exists. */ | ||
653 | for (idx = 0; idx < ctls->count; idx++) { | ||
654 | ctrl = ctls->controls + idx; | ||
655 | pctl = pvr2_hdw_get_ctrl_v4l(hdw,ctrl->id); | ||
656 | if (!pctl) { | ||
657 | ret = -EINVAL; | ||
658 | ctls->error_idx = idx; | ||
659 | break; | ||
660 | } | ||
661 | } | ||
662 | break; | ||
663 | } | ||
664 | |||
596 | case VIDIOC_LOG_STATUS: | 665 | case VIDIOC_LOG_STATUS: |
597 | { | 666 | { |
598 | pvr2_hdw_trigger_module_log(hdw); | 667 | pvr2_hdw_trigger_module_log(hdw); |