aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/az6007.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-29 10:31:13 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-21 10:45:53 -0500
commit2d5161b7714ae75ac62cd58bf4c5c11ca6c2da59 (patch)
tree98f38fd32567c4c22a1f8bd4305a8d18cedd8c18 /drivers/media/dvb/dvb-usb/az6007.c
parentba02473eaaaa9e579a4bdbe9f15a5ad777764580 (diff)
[media] az6007: Fix IR receive code
The code still needs to be commented, as there's a mutex missing at the az6007_read() call. A mutex there is needed, in order to prevent RC (or CI) calls while other operations are in progress. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/az6007.c')
-rw-r--r--drivers/media/dvb/dvb-usb/az6007.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/media/dvb/dvb-usb/az6007.c b/drivers/media/dvb/dvb-usb/az6007.c
index 912ba67bc393..c9743ee2ba75 100644
--- a/drivers/media/dvb/dvb-usb/az6007.c
+++ b/drivers/media/dvb/dvb-usb/az6007.c
@@ -49,7 +49,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
49#define AZ6007_I2C_WR 0xbd 49#define AZ6007_I2C_WR 0xbd
50#define FX2_SCON1 0xc0 50#define FX2_SCON1 0xc0
51#define AZ6007_TS_THROUGH 0xc7 51#define AZ6007_TS_THROUGH 0xc7
52#define AZ6007_READ_IR 0xc5 52#define AZ6007_READ_IR 0xb4
53 53
54struct az6007_device_state { 54struct az6007_device_state {
55 struct dvb_ca_en50221 ca; 55 struct dvb_ca_en50221 ca;
@@ -172,30 +172,45 @@ static struct rc_map_table rc_map_az6007_table[] = {
172/* remote control stuff (does not work with my box) */ 172/* remote control stuff (does not work with my box) */
173static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state) 173static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
174{ 174{
175 return 0; 175 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
176#if 0
177 u8 key[10]; 176 u8 key[10];
178 int i; 177 int i;
179 178
180 /* remove the following return to enabled remote querying */ 179 /*
180 * FIXME: remove the following return to enabled remote querying
181 * The driver likely needs proper locking to avoid troubles between
182 * this call and other concurrent calls.
183 */
184 return 0;
181 185
182 az6007_read(d->udev, AZ6007_READ_IR, 0, 0, key, 10); 186 az6007_read(d->udev, AZ6007_READ_IR, 0, 0, key, 10);
183 187
184 deb_rc("remote query key: %x %d\n", key[1], key[1]);
185
186 if (key[1] == 0x44) { 188 if (key[1] == 0x44) {
187 *state = REMOTE_NO_KEY_PRESSED; 189 *state = REMOTE_NO_KEY_PRESSED;
188 return 0; 190 return 0;
189 } 191 }
190 192
191 for (i = 0; i < ARRAY_SIZE(az6007_rc_keys); i++) 193 /*
192 if (az6007_rc_keys[i].custom == key[1]) { 194 * FIXME: need to make something useful with the keycodes and to
195 * convert it to the non-legacy mode. Yet, it is producing some
196 * debug info already, like:
197 * 88 04 eb 02 fd ff 00 82 63 82 (terratec IR)
198 * 88 04 eb 03 fc 00 00 82 63 82 (terratec IR)
199 * 88 80 7e 0d f2 ff 00 82 63 82 (another NEC-extended based IR)
200 * I suspect that the IR data is at bytes 1 to 4, and byte 5 is parity
201 */
202 deb_rc("remote query key: %x %d\n", key[1], key[1]);
203 print_hex_dump_bytes("Remote: ", DUMP_PREFIX_NONE, key, 10);
204
205 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
206 if (rc5_custom(&keymap[i]) == key[1]) {
207 *event = keymap[i].keycode;
193 *state = REMOTE_KEY_PRESSED; 208 *state = REMOTE_KEY_PRESSED;
194 *event = az6007_rc_keys[i].event; 209
195 break; 210 return 0;
196 } 211 }
212 }
197 return 0; 213 return 0;
198#endif
199} 214}
200 215
201#if 0 216#if 0