summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dib0700_devices.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-08-01 09:37:23 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 16:43:50 -0300
commit0ffd1ab34a00b1e92af50ef11e696839f4cf642b (patch)
treea9465fffab8d37fe22ab64cc7df95f121a073823 /drivers/media/dvb/dvb-usb/dib0700_devices.c
parent5af935cc96a291f90799bf6a2587d87329a91699 (diff)
V4L/DVB: dib0700: properly implement IR change_protocol
This patch implements change_protocol callback. With this change, there's no need for an extra modprobe parameter to specify the protocol. When a table is loaded (either from in-kernel rc-map tables or via ir-keytable program), the driver will automatically change the protocol, in order to work with the given table. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dib0700_devices.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c118
1 files changed, 100 insertions, 18 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index ee2a84beb55..f634d2e784b 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -486,8 +486,6 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
int i;
struct dib0700_state *st = d->priv;
-printk("%s\n", __func__);
-
if (st->fw_version >= 0x10200) {
/* For 1.20 firmware , We need to keep the RC polling
callback so we can reuse the input device setup in
@@ -511,8 +509,8 @@ printk("%s\n", __func__);
dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
d->last_event = 0;
- switch (dvb_usb_dib0700_ir_proto) {
- case 0:
+ switch (d->props.rc.core.protocol) {
+ case IR_TYPE_NEC:
/* NEC protocol sends repeat code as 0 0 0 FF */
if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
(key[3] == 0xff))
@@ -1873,7 +1871,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc.core = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -1903,7 +1907,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc.core = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -1958,7 +1968,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc.core = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -1996,7 +2012,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -2068,7 +2090,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -2108,7 +2136,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -2172,7 +2206,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -2215,7 +2255,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_NEC_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -2280,7 +2326,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
.num_adapters = 1,
@@ -2312,7 +2364,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
.num_adapters = 1,
@@ -2376,7 +2434,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
.num_adapters = 1,
@@ -2416,7 +2480,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_NEC_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
.num_adapters = 2,
@@ -2461,7 +2531,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
.num_adapters = 1,
@@ -2494,7 +2570,13 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
- .rc_query = dib0700_rc_query_old_firmware
+ .rc_query = dib0700_rc_query_old_firmware,
+ .rc_props = {
+ .allowed_protos = IR_TYPE_RC5 |
+ IR_TYPE_RC6 |
+ IR_TYPE_NEC,
+ .change_protocol = dib0700_change_protocol,
+ },
},
},
};