Message ID | 1413108191-32510-4-git-send-email-olli.salonen@iki.fi (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 10/12/2014 01:03 PM, Olli Salonen wrote: > Added an option disable_rc that can be used to disable the IR receiver polling for this module. > > Signed-off-by: Olli Salonen <olli.salonen@iki.fi> > --- > drivers/media/usb/dvb-usb-v2/dvbsky.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c > index 5c7387a..71a3324 100644 > --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c > +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c > @@ -25,6 +25,10 @@ > #define DVBSKY_MSG_DELAY 0/*2000*/ > #define DVBSKY_BUF_LEN 64 > > +static int dvb_usb_dvbsky_disable_rc; > +module_param_named(disable_rc, dvb_usb_dvbsky_disable_rc, int, 0644); > +MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver."); > + > DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); > > struct dvbsky_state { > @@ -218,6 +222,10 @@ static int dvbsky_rc_query(struct dvb_usb_device *d) > > static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) > { > + if (dvb_usb_dvbsky_disable_rc) > + return 0; > + > + rc->map_name = RC_MAP_DVBSKY; > rc->allowed_protos = RC_BIT_RC5; > rc->query = dvbsky_rc_query; > rc->interval = 300; > @@ -450,7 +458,7 @@ static struct dvb_usb_device_properties dvbsky_s960_props = { > > static const struct usb_device_id dvbsky_id_table[] = { > { DVB_USB_DEVICE(0x0572, 0x6831, > - &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, > + &dvbsky_s960_props, "DVBSky S960/S860", NULL) }, Why you removed default keytable too? > { } > }; > MODULE_DEVICE_TABLE(usb, dvbsky_id_table); >
On 12.10.2014 13:12, Antti Palosaari wrote: >> static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct >> dvb_usb_rc *rc) >> { >> + if (dvb_usb_dvbsky_disable_rc) >> + return 0; >> + >> + rc->map_name = RC_MAP_DVBSKY; >> rc->allowed_protos = RC_BIT_RC5; >> rc->query = dvbsky_rc_query; >> rc->interval = 300; >> @@ -450,7 +458,7 @@ static struct dvb_usb_device_properties >> dvbsky_s960_props = { >> >> static const struct usb_device_id dvbsky_id_table[] = { >> { DVB_USB_DEVICE(0x0572, 0x6831, >> - &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, >> + &dvbsky_s960_props, "DVBSky S960/S860", NULL) }, > > Why you removed default keytable too? > I initially thought that it would make sense to set all RC related parameters in the get_rc_config function. Of couse I could set RC_MAP_DVBSKY as default map and then set it to NULL only if the remote controller is disabled. Now that I think of it, it's probably better to do it this way. The next DVBSky OEM device might come with another remote controller, and we don't want to implement the map selection logic into the get_rc_config. In general I did not see many modules with IR disable function. Is this the right way to implement it? I noticed that dvb-usb-v2 had an option to disable IR polling, but that will disable it for all dvb-usb-v2 modules. I have 2 adapters in my HTPC setup and want to disable the IR only for the device that uses the dvbsky module. -olli -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 5c7387a..71a3324 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -25,6 +25,10 @@ #define DVBSKY_MSG_DELAY 0/*2000*/ #define DVBSKY_BUF_LEN 64 +static int dvb_usb_dvbsky_disable_rc; +module_param_named(disable_rc, dvb_usb_dvbsky_disable_rc, int, 0644); +MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver."); + DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct dvbsky_state { @@ -218,6 +222,10 @@ static int dvbsky_rc_query(struct dvb_usb_device *d) static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { + if (dvb_usb_dvbsky_disable_rc) + return 0; + + rc->map_name = RC_MAP_DVBSKY; rc->allowed_protos = RC_BIT_RC5; rc->query = dvbsky_rc_query; rc->interval = 300; @@ -450,7 +458,7 @@ static struct dvb_usb_device_properties dvbsky_s960_props = { static const struct usb_device_id dvbsky_id_table[] = { { DVB_USB_DEVICE(0x0572, 0x6831, - &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, + &dvbsky_s960_props, "DVBSky S960/S860", NULL) }, { } }; MODULE_DEVICE_TABLE(usb, dvbsky_id_table);
Added an option disable_rc that can be used to disable the IR receiver polling for this module. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> --- drivers/media/usb/dvb-usb-v2/dvbsky.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)