diff options
author | Mike Isely <isely@pobox.com> | 2008-04-22 14:45:39 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 14:07:47 -0300 |
commit | dbc40a0e582a88d2561d13d1fea4f3496bff9650 (patch) | |
tree | c914495caa3cf85c6487188ecc05a1aa3acfc0ed /drivers | |
parent | fdf256f3374d5060e3714651b45b8450b7dc4349 (diff) |
V4L/DVB (7303): pvrusb2: Ensure that default input selection is actually valid
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 9 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.h | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 94cb0a76e77..ae36948c6c1 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1875,6 +1875,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/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 59f385878ef..2919a1d9ed0 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -41,8 +41,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 { |