[media] af9015: remote controller fixes
authorAntti Palosaari <crope@iki.fi>
Wed, 25 Jul 2012 00:21:04 +0000 (21:21 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:40 +0000 (07:56 -0300)
1)
AF9015 remote controller query will fail rarely due to register
access failures and dvb_usb_v2 will stop rc polling when error
returned. Add logic to allow errors until two consecutive errors
occurs.

2)
Remote controller key map was not loaded in case of key map was set as
a device property. Fix it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb-v2/af9015.c
drivers/media/dvb/dvb-usb-v2/af9015.h

index bbe1d33821950d8a83986eef06e763255e073074..10363f6b5234aebb86f60b5c20af35c2ab1063be 100644 (file)
@@ -1232,11 +1232,19 @@ static int af9015_rc_query(struct dvb_usb_device *d)
        }
 
        state->rc_repeat = buf[6];
+       state->rc_failed = false;
 
 error:
-       if (ret)
+       if (ret) {
                err("%s: failed:%d", __func__, ret);
 
+               /* allow random errors as dvb-usb will stop polling on error */
+               if (!state->rc_failed)
+                       ret = 0;
+
+               state->rc_failed = true;
+       }
+
        return ret;
 }
 
@@ -1249,8 +1257,9 @@ static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
                return 0;
 
        /* try to load remote based module param */
-       rc->map_name = af9015_rc_setup_match(dvb_usb_af9015_remote,
-                       af9015_rc_setup_modparam);
+       if (!rc->map_name)
+               rc->map_name = af9015_rc_setup_match(dvb_usb_af9015_remote,
+                               af9015_rc_setup_modparam);
 
        /* try to load remote based eeprom hash */
        if (!rc->map_name)
index b41ee73b26dc357716b3f7dd6cf1a211b1685ea0..c6b304d962ad3fcaa2368010ea3f85335b1e7f59 100644 (file)
@@ -139,6 +139,7 @@ struct af9015_state {
        u8 rc_repeat;
        u32 rc_keycode;
        u8 rc_last[4];
+       bool rc_failed;
        u8 dual_mode;
        u8 seq; /* packet sequence number */
        u16 mt2060_if1[2];