aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2010-12-26 08:23:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-31 10:46:21 -0500
commit9d1da730ee17e712c25c0b1e51653048f92d2385 (patch)
tree24fbd22e4543eb6544fd23d6df40df0c92988db8 /drivers/media/dvb
parentebce9a3331f4dd1f39856dc4b79f539eb25f7f64 (diff)
[media] DVB: IR support for TechnoTrend CT-3650
Based on Waling Dijkstra's discovery that the IR works the same as on the TT-1500, this patch has been rewritten to fit with the rc_core infrastructure. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/ttusb2.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c
index a6de489a6a39..0d4709ff9cbb 100644
--- a/drivers/media/dvb/dvb-usb/ttusb2.c
+++ b/drivers/media/dvb/dvb-usb/ttusb2.c
@@ -43,6 +43,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
43 43
44struct ttusb2_state { 44struct ttusb2_state {
45 u8 id; 45 u8 id;
46 u16 last_rc_key;
46}; 47};
47 48
48static int ttusb2_msg(struct dvb_usb_device *d, u8 cmd, 49static int ttusb2_msg(struct dvb_usb_device *d, u8 cmd,
@@ -128,6 +129,33 @@ static struct i2c_algorithm ttusb2_i2c_algo = {
128 .functionality = ttusb2_i2c_func, 129 .functionality = ttusb2_i2c_func,
129}; 130};
130 131
132/* command to poll IR receiver (copied from pctv452e.c) */
133#define CMD_GET_IR_CODE 0x1b
134
135/* IR */
136static int tt3650_rc_query(struct dvb_usb_device *d)
137{
138 int ret;
139 u8 rx[9]; /* A CMD_GET_IR_CODE reply is 9 bytes long */
140 struct ttusb2_state *st = d->priv;
141 ret = ttusb2_msg(d, CMD_GET_IR_CODE, NULL, 0, rx, sizeof(rx));
142 if (ret != 0)
143 return ret;
144
145 if (rx[8] & 0x01) {
146 /* got a "press" event */
147 st->last_rc_key = (rx[3] << 8) | rx[2];
148 deb_info("%s: cmd=0x%02x sys=0x%02x\n", __func__, rx[2], rx[3]);
149 rc_keydown(d->rc_dev, st->last_rc_key, 0);
150 } else if (st->last_rc_key) {
151 rc_keyup(d->rc_dev);
152 st->last_rc_key = 0;
153 }
154
155 return 0;
156}
157
158
131/* Callbacks for DVB USB */ 159/* Callbacks for DVB USB */
132static int ttusb2_identify_state (struct usb_device *udev, struct 160static int ttusb2_identify_state (struct usb_device *udev, struct
133 dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, 161 dvb_usb_device_properties *props, struct dvb_usb_device_description **desc,
@@ -345,6 +373,13 @@ static struct dvb_usb_device_properties ttusb2_properties_ct3650 = {
345 373
346 .size_of_priv = sizeof(struct ttusb2_state), 374 .size_of_priv = sizeof(struct ttusb2_state),
347 375
376 .rc.core = {
377 .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */
378 .rc_codes = RC_MAP_TT_1500,
379 .rc_query = tt3650_rc_query,
380 .allowed_protos = RC_TYPE_UNKNOWN,
381 },
382
348 .num_adapters = 1, 383 .num_adapters = 1,
349 .adapter = { 384 .adapter = {
350 { 385 {