summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
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/media/video/pvrusb2/pvrusb2-hdw.c
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/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c9
1 files changed, 9 insertions, 0 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);