From: Mauro Carvalho Chehab Date: Fri, 29 Jul 2011 14:31:13 +0000 (-0300) Subject: [media] az6007: Fix IR receive code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2d5161b7714ae75ac62cd58bf4c5c11ca6c2da59;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git [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 --- 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); #define AZ6007_I2C_WR 0xbd #define FX2_SCON1 0xc0 #define AZ6007_TS_THROUGH 0xc7 -#define AZ6007_READ_IR 0xc5 +#define AZ6007_READ_IR 0xb4 struct az6007_device_state { struct dvb_ca_en50221 ca; @@ -172,30 +172,45 @@ static struct rc_map_table rc_map_az6007_table[] = { /* remote control stuff (does not work with my box) */ static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state) { - return 0; -#if 0 + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; u8 key[10]; int i; - /* remove the following return to enabled remote querying */ + /* + * FIXME: remove the following return to enabled remote querying + * The driver likely needs proper locking to avoid troubles between + * this call and other concurrent calls. + */ + return 0; az6007_read(d->udev, AZ6007_READ_IR, 0, 0, key, 10); - deb_rc("remote query key: %x %d\n", key[1], key[1]); - if (key[1] == 0x44) { *state = REMOTE_NO_KEY_PRESSED; return 0; } - for (i = 0; i < ARRAY_SIZE(az6007_rc_keys); i++) - if (az6007_rc_keys[i].custom == key[1]) { + /* + * FIXME: need to make something useful with the keycodes and to + * convert it to the non-legacy mode. Yet, it is producing some + * debug info already, like: + * 88 04 eb 02 fd ff 00 82 63 82 (terratec IR) + * 88 04 eb 03 fc 00 00 82 63 82 (terratec IR) + * 88 80 7e 0d f2 ff 00 82 63 82 (another NEC-extended based IR) + * I suspect that the IR data is at bytes 1 to 4, and byte 5 is parity + */ + deb_rc("remote query key: %x %d\n", key[1], key[1]); + print_hex_dump_bytes("Remote: ", DUMP_PREFIX_NONE, key, 10); + + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { + if (rc5_custom(&keymap[i]) == key[1]) { + *event = keymap[i].keycode; *state = REMOTE_KEY_PRESSED; - *event = az6007_rc_keys[i].event; - break; + + return 0; } + } return 0; -#endif } #if 0