summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-02-03 15:06:09 -0600
committerMike Isely <isely@pobox.com>2008-02-03 15:06:09 -0600
commit485a24a1b0b1008a111335574af77eb34d766b1a (patch)
tree7f0e7bea137c384a1f85fd0579eb75662d0a5871 /linux/drivers/media/video
parent2e09fd71120e1f11684d02c958c3b01614052280 (diff)
downloadmediapointer-dvb-s2-485a24a1b0b1008a111335574af77eb34d766b1a.tar.gz
mediapointer-dvb-s2-485a24a1b0b1008a111335574af77eb34d766b1a.tar.bz2
pvrusb2: Dynamically control range of input selections
From: Mike Isely <isely@pobox.com> This follows from defining the available inputs as device attributes. This change causes the driver to adjust its list of inputs based on those attributes. Now, for example, the FM radio will appear as a choice only if the hardware supports an FM radio. Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c26
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h7
2 files changed, 29 insertions, 4 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 5b8d6bd33..10f7427e6 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -184,6 +184,7 @@ static const char *control_values_srate[] = {
static const char *control_values_input[] = {
[PVR2_CVAL_INPUT_TV] = "television", /*xawtv needs this name*/
+ [PVR2_CVAL_INPUT_DTV] = "dtv",
[PVR2_CVAL_INPUT_RADIO] = "radio",
[PVR2_CVAL_INPUT_SVIDEO] = "s-video",
[PVR2_CVAL_INPUT_COMPOSITE] = "composite",
@@ -369,6 +370,27 @@ static int ctrl_get_input(struct pvr2_ctrl *cptr,int *vp)
return 0;
}
+static int ctrl_check_input(struct pvr2_ctrl *cptr,int v)
+{
+ struct pvr2_hdw *hdw = cptr->hdw;
+ const struct pvr2_device_desc *dsc = hdw->hdw_desc;
+
+ switch (v) {
+ case PVR2_CVAL_INPUT_TV:
+ return dsc->flag_has_analogtuner != 0;
+ case PVR2_CVAL_INPUT_DTV:
+ return dsc->flag_has_digitaltuner != 0;
+ case PVR2_CVAL_INPUT_SVIDEO:
+ return dsc->flag_has_svideo != 0;
+ case PVR2_CVAL_INPUT_COMPOSITE:
+ return dsc->flag_has_composite != 0;
+ case PVR2_CVAL_INPUT_RADIO:
+ return dsc->flag_has_fmradio != 0;
+ default:
+ return 0;
+ }
+}
+
static int ctrl_set_input(struct pvr2_ctrl *cptr,int m,int v)
{
struct pvr2_hdw *hdw = cptr->hdw;
@@ -384,7 +406,8 @@ static int ctrl_set_input(struct pvr2_ctrl *cptr,int m,int v)
if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
hdw->freqSelector = 0;
hdw->freqDirty = !0;
- } else if (hdw->input_val == PVR2_CVAL_INPUT_TV) {
+ } else if ((hdw->input_val == PVR2_CVAL_INPUT_TV) ||
+ (hdw->input_val == PVR2_CVAL_INPUT_DTV)) {
hdw->freqSelector = 1;
hdw->freqDirty = !0;
}
@@ -805,6 +828,7 @@ static const struct pvr2_ctl_info control_defs[] = {
.name = "input",
.internal_id = PVR2_CID_INPUT,
.default_value = PVR2_CVAL_INPUT_TV,
+ .check_value = ctrl_check_input,
DEFREF(input),
DEFENUM(control_values_input),
},{
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index b5fb55952..26dcf39a8 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -41,9 +41,10 @@
/* Legal values for the INPUT state variable */
#define PVR2_CVAL_INPUT_TV 0
-#define PVR2_CVAL_INPUT_SVIDEO 1
-#define PVR2_CVAL_INPUT_COMPOSITE 2
-#define PVR2_CVAL_INPUT_RADIO 3
+#define PVR2_CVAL_INPUT_DTV 1
+#define PVR2_CVAL_INPUT_SVIDEO 2
+#define PVR2_CVAL_INPUT_COMPOSITE 3
+#define PVR2_CVAL_INPUT_RADIO 4
enum pvr2_config {
pvr2_config_empty, /* No configuration */