summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-08-31 18:55:03 -0500
committerMike Isely <isely@pobox.com>2008-08-31 18:55:03 -0500
commit596acdb938b1e1c2f61c0bddc1359ce91d3f4db2 (patch)
treed3599525ef49260a01783ab896a4b694998795f5 /linux/drivers/media
parenta397e1f70d7ece4029a16e5bda4f556467252a8c (diff)
downloadmediapointer-dvb-s2-596acdb938b1e1c2f61c0bddc1359ce91d3f4db2.tar.gz
mediapointer-dvb-s2-596acdb938b1e1c2f61c0bddc1359ce91d3f4db2.tar.bz2
pvrusb2: Be able to programmatically retrieve a control's default value
From: Mike Isely <isely@pobox.com> The pvrusb2 control mechanism up until now has used a constant int to hold a control's default value. This change makes it possible to retrieve the control's default through some other means, e.g. as a result of a query from lower level software. Priority: normal Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c10
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.h2
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h1
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c8
4 files changed, 15 insertions, 6 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index 3b982d963..fb2ed3cb7 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -135,13 +135,19 @@ int pvr2_ctrl_get_min(struct pvr2_ctrl *cptr)
/* Retrieve control's default value (any type) */
-int pvr2_ctrl_get_def(struct pvr2_ctrl *cptr)
+int pvr2_ctrl_get_def(struct pvr2_ctrl *cptr, int *valptr)
{
int ret = 0;
if (!cptr) return 0;
LOCK_TAKE(cptr->hdw->big_lock); do {
if (cptr->info->type == pvr2_ctl_int) {
- ret = cptr->info->default_value;
+ if (cptr->info->get_def_value) {
+ /* Comment to keep checkpatch.pl quiet */
+ ret = cptr->info->get_def_value(cptr, valptr);
+ } else {
+ /* Comment to keep checkpatch.pl quiet */
+ *valptr = cptr->info->default_value;
+ }
}
} while(0); LOCK_GIVE(cptr->hdw->big_lock);
return ret;
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.h b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.h
index 0371ae6e6..794ff9012 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.h
@@ -49,7 +49,7 @@ int pvr2_ctrl_get_max(struct pvr2_ctrl *);
int pvr2_ctrl_get_min(struct pvr2_ctrl *);
/* Retrieve control's default value (any type) */
-int pvr2_ctrl_get_def(struct pvr2_ctrl *);
+int pvr2_ctrl_get_def(struct pvr2_ctrl *, int *valptr);
/* Retrieve control's enumeration count (enum only) */
int pvr2_ctrl_get_cnt(struct pvr2_ctrl *);
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index 0453244b7..8bc966973 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -82,6 +82,7 @@ struct pvr2_ctl_info {
/* Control's implementation */
pvr2_ctlf_get_value get_value; /* Get its value */
+ pvr2_ctlf_get_value get_def_value; /* Get its default value */
pvr2_ctlf_get_value get_min_value; /* Get minimum allowed value */
pvr2_ctlf_get_value get_max_value; /* Get maximum allowed value */
pvr2_ctlf_set_value set_value; /* Set its value */
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 1619c2756..34276b296 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -534,7 +534,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
lmin = pvr2_ctrl_get_min(hcp);
lmax = pvr2_ctrl_get_max(hcp);
- ldef = pvr2_ctrl_get_def(hcp);
+ pvr2_ctrl_get_def(hcp, &ldef);
if (w == -1) {
w = ldef;
} else if (w < lmin) {
@@ -544,7 +544,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
}
lmin = pvr2_ctrl_get_min(vcp);
lmax = pvr2_ctrl_get_max(vcp);
- ldef = pvr2_ctrl_get_def(vcp);
+ pvr2_ctrl_get_def(vcp, &ldef);
if (h == -1) {
h = ldef;
} else if (h < lmin) {
@@ -605,6 +605,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
case VIDIOC_QUERYCTRL:
{
struct pvr2_ctrl *cptr;
+ int val;
struct v4l2_queryctrl *vc = (struct v4l2_queryctrl *)arg;
ret = 0;
if (vc->id & V4L2_CTRL_FLAG_NEXT_CTRL) {
@@ -628,7 +629,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
pvr2_ctrl_get_desc(cptr));
strlcpy(vc->name,pvr2_ctrl_get_desc(cptr),sizeof(vc->name));
vc->flags = pvr2_ctrl_get_v4lflags(cptr);
- vc->default_value = pvr2_ctrl_get_def(cptr);
+ pvr2_ctrl_get_def(cptr, &val);
+ vc->default_value = val;
switch (pvr2_ctrl_get_type(cptr)) {
case pvr2_ctl_enum:
vc->type = V4L2_CTRL_TYPE_MENU;