summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-02-03 15:18:31 -0600
committerMike Isely <isely@pobox.com>2008-02-03 15:18:31 -0600
commitf3e045ef46cb94caca73cc25f89aaffce242eef8 (patch)
treed2df7427fccd0db5e18ee3c6458779f632ffe7b6 /linux/drivers
parent5d58c6ee93fb3a28009f441ec50991f7ab4e4e72 (diff)
downloadmediapointer-dvb-s2-f3e045ef46cb94caca73cc25f89aaffce242eef8.tar.gz
mediapointer-dvb-s2-f3e045ef46cb94caca73cc25f89aaffce242eef8.tar.bz2
pvrusb2: Ensure that default input selection is actually valid
From: Mike Isely <isely@pobox.com> Previously the pvrusb2 driver just started with the default input to be "television". But if the device doesn't support an analog tuner then this default must be different. New logic here selects a reasonable default based on the actual valid set of available inputs. Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c9
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h4
2 files changed, 11 insertions, 2 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 779dd289b..b8ee5aefe 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -1886,6 +1886,15 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
cptr = hdw->controls + idx;
cptr->info = control_defs+idx;
}
+
+ /* Ensure that default input choice is a valid one. */
+ m = hdw->input_avail_mask;
+ if (m) for (idx = 0; idx < (sizeof(m) << 3); idx++) {
+ if (!((1 << idx) & m)) continue;
+ hdw->input_val = idx;
+ break;
+ }
+
/* Define and configure additional controls from cx2341x module. */
hdw->mpeg_ctrl_info = kzalloc(
sizeof(*(hdw->mpeg_ctrl_info)) * MPEGDEF_COUNT, GFP_KERNEL);
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 17349a54d..8c328ca11 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -42,8 +42,8 @@
/* Legal values for the INPUT state variable */
#define PVR2_CVAL_INPUT_TV 0
#define PVR2_CVAL_INPUT_DTV 1
-#define PVR2_CVAL_INPUT_SVIDEO 2
-#define PVR2_CVAL_INPUT_COMPOSITE 3
+#define PVR2_CVAL_INPUT_COMPOSITE 2
+#define PVR2_CVAL_INPUT_SVIDEO 3
#define PVR2_CVAL_INPUT_RADIO 4
enum pvr2_config {