Fw: 80th Attempt at Kworld ATSC110 IR Remote Patch - Please Review

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Here is the polling patch from Henry....   Does this improve the
> responsiveness of the remote.
> Personally, I never had a problem with the default values that I had..
>

Dwaine,

I have applied this patch from Henry Wong, along with your original patch,
to the 2.6.17 kernel and I can confirm that responsiveness has greatly
improved.

I have also compiled yours and Henry's work into a patch that applies
cleanly to the latest build of v4l source (eedd95da0715).

Hope this is of some help.  Thanks.

/*********************************************************************/
--- a/linux/drivers/media/common/ir-keymaps.c   2007-06-28
10:30:22.000000000 -0400
+++ b/linux/drivers/media/common/ir-keymaps.c   2007-06-29
08:53:51.000000000 -0400
@@ -1503,6 +1503,60 @@

 EXPORT_SYMBOL_GPL(ir_codes_hauppauge_new);

+IR_KEYTAB_TYPE ir_codes_kworld_atsc110[IR_KEYTAB_SIZE] = {
+        [ 0x0 ] = KEY_1,
+        [ 0x1 ] = KEY_2,
+        [ 0x2 ] = KEY_3,
+        [ 0x3 ] = KEY_4,
+        [ 0x4 ] = KEY_5,
+        [ 0x5 ] = KEY_6,
+        [ 0x6 ] = KEY_7,
+        [ 0x7 ] = KEY_8,
+        [ 0x8 ] = KEY_9,
+        [ 0xa ] = KEY_0,
+        [ 0x9 ] = KEY_ESC,              /* UP ARROW */
+        [ 0xc ] = KEY_POWER,            /* POWER */
+        [ 0x0a ] = KEY_MUTE,            /* MUTE */
+        [ 0x0b ] = KEY_SEARCH,                /* SEARCH */
+        [ 0x0d ] = KEY_EPG,             /* GUIDE */
+        [ 0x1b ] = KEY_RECORD,          /* RECORD */
+        [ 0x16 ] = KEY_PAUSE,           /* PAUSE */
+        [ 0x1a ] = KEY_STOP,            /* STOP */
+        [ 0x1d ] = KEY_VOLUMEDOWN,      /* VOLUME- */
+        [ 0x1c ] = KEY_VOLUMEUP,        /* VOLUME+ */
+        [ 0x1f ] = KEY_CHANNELDOWN,     /* CHANNEL/PAGE- */
+        [ 0x1e ] = KEY_CHANNELUP,       /* CHANNEL/PAGE+ */
+        [ 0x10 ] = KEY_UP,              /* KEY_SCROLLUP */
+        [ 0x12 ] = KEY_LEFT,            /* KEY_BACK */
+        [ 0xe  ] = KEY_ENTER,           /* KEY_ENTER */
+        [ 0x13 ] = KEY_RIGHT,           /* KEY_FORWARD */
+        [ 0x11 ] = KEY_DOWN,            /* KEY_SCROLLDOWN */
+        [ 0x14 ] = KEY_MUTE,            /* MUTE */
+        [ 0x15 ] = KEY_AUDIO,           /* STEREO */
+        [ 0x16 ] = KEY_VIDEO,           /* SOURCE */
+        [ 0x17 ] = KEY_ZOOM,            /* ZOOM */
+        [ 0x18 ] = KEY_PRINT,           /* SHUTDOWN */
+        [ 0X19 ] = KEY_T,               /* TIMESHIFT */
+        [ 0x44 ] = KEY_PLAYPAUSE,       /* PAUSE/PLAY */
+        [ 0x45 ] = KEY_STOP,            /* STOP */
+        [ 0x40 ] = KEY_REWIND,          /* REWIND */
+        [ 0x41 ] = KEY_FORWARD,         /* FASTFORWARD */
+        [ 0x42 ] = KEY_PREVIOUSSONG,    /* PREVIOUS */
+        [ 0x43 ] = KEY_NEXTSONG,        /* NEXT */
+
+        // buttons a-h
+        [ 0x48 ] = KEY_A,
+        [ 0x49 ] = KEY_B,
+        [ 0x4a ] = KEY_C,
+        [ 0x4b ] = KEY_D,
+        [ 0x4c ] = KEY_E,
+        [ 0x4d ] = KEY_F,
+        [ 0x4e ] = KEY_G,
+        [ 0x4f ] = KEY_H
+};
+
+EXPORT_SYMBOL_GPL(ir_codes_kworld_atsc110);
+
 IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE] = {
        [ 0x1d ] = KEY_SWITCHVIDEOMODE, /* switch inputs */
        [ 0x2a ] = KEY_FRONT,
--- a/linux/drivers/media/video/ir-kbd-i2c.c    2007-06-28
10:30:22.000000000 -0400
+++ b/linux/drivers/media/video/ir-kbd-i2c.c    2007-06-29
09:05:56.000000000 -0400
@@ -60,8 +60,11 @@
 #define dprintk(level, fmt, arg...)    if (debug >= level) \
        printk(KERN_DEBUG DEVNAME ": " fmt , ## arg)

+static int polling_interval = 100; /* ms */
+
 /*
-----------------------------------------------------------------------
*/

+static int kworldatsc110 = 0; /* Both KNC1 and the Kworld ATSC110 cards
use the same i2c address */
 static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
                               int size, int offset)
 {
@@ -155,11 +158,14 @@

        /* it seems that 0xFE indicates that a button is still hold
           down, while 0xff indicates that no button is hold
-          down. 0xfe sequences are sometimes interrupted by 0xFF */
+          down. 0xfe and 0x80 sequences are sometimes interrupted by 0xFF */

        dprintk(2,"key %02x\n", b);

-       if (b == 0xff)
+       /* KNC1 card            = 0xfe */
+       /* Kworld ATSC110 card  = 0x80 */
+
+       if ((b == 0xfe)||(b & 0x80))
                return 0;

        if (b == 0xfe)
@@ -293,7 +299,7 @@
 #endif

        ir_key_poll(ir);
-       mod_timer(&ir->timer, jiffies + msecs_to_jiffies(100));
+       mod_timer(&ir->timer, jiffies + polling_interval*HZ/1000);
 }

 /*
-----------------------------------------------------------------------
*/
@@ -376,10 +382,17 @@
                }
                break;
        case 0x30:
-               name        = "KNC One";
+               if (adap->id == I2C_HW_SAA7134) /* Handled by
saa7134-input */
+                       polling_interval = 50; /* ms */
                ir->get_key = get_key_knc1;
                ir_type     = IR_TYPE_OTHER;
-               ir_codes    = ir_codes_empty;
+               if (kworldatsc110 == 1) {
+                       name        = "Kworld ATSC110";
+                       ir_codes    = ir_codes_kworld_atsc110;
+               } else {
+                       name        = "KNC One";
+                       ir_codes    = ir_codes_empty;
+               }
                break;
        case 0x7a:
        case 0x47:
@@ -494,7 +507,7 @@
        */

        static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
-       static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 };
+       static const int probe_saa7134[] = { 0x7a, 0x30, 0x47, 0x71, -1 };
        static const int probe_em28XX[] = { 0x30, 0x47, -1 };
        static const int probe_cx88[] = { 0x18, 0x71, -1 };
        const int *probe = NULL;
@@ -527,6 +540,30 @@
        for (i = 0; -1 != probe[i]; i++) {
                c.addr = probe[i];
                rc = i2c_master_recv(&c,&buf,0);
+
+               /* Special case for Kworld ATSC110 remote */
+               if (c.adapter->id == I2C_HW_SAA7134 && probe[i] == 0x30)
+               {
+                       struct i2c_client c2;
+
+                       memset (&c2, 0, sizeof(c2));
+                       c2.adapter = c.adapter;
+
+                       for (c2.addr=127; c2.addr > 0; c2.addr--) {
+                               if (0 == i2c_master_recv(&c2,&buf,0)) {
+                                       dprintk(1,"Found another device,
at addr 0x%02x\n", c2.addr);
+                                       break;
+                               }
+                       }
+
+                       /* Now do the probe. The controller does not respond
+                          to 0-byte reads, so we use a 1-byte read
instead. */
+                       rc = i2c_master_recv(&c,&buf,1);
+                       rc--;
+                       kworldatsc110 = 1;
+               } else {
+                       rc = i2c_master_recv(&c,&buf,0);
+               }
                dprintk(1,"probe 0x%02x @ %s: %s\n",
                        probe[i], adap->name,
                        (0 == rc) ? "yes" : "no");
--- a/linux/drivers/media/video/saa7134/saa7134-cards.c 2007-06-28
10:30:22.000000000 -0400
+++ b/linux/drivers/media/video/saa7134/saa7134-cards.c 2007-06-29
08:51:45.000000000 -0400
@@ -4508,6 +4508,9 @@
        case SAA7134_BOARD_HAUPPAUGE_HVR1110:
                dev->has_remote = SAA7134_REMOTE_I2C;
                break;
+        case SAA7134_BOARD_KWORLD_ATSC110:
+                dev->has_remote = SAA7134_REMOTE_I2C;
+                break;
        case SAA7134_BOARD_AVERMEDIA_A169_B:
        case SAA7134_BOARD_MD7134_BRIDGE_2:
                printk("%s: %s: dual saa713x broadcast decoders\n"
--- a/linux/drivers/media/video/saa7134/saa7134-i2c.c   2007-06-28
10:30:22.000000000 -0400
+++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c   2007-06-29
08:51:45.000000000 -0400
@@ -350,6 +350,7 @@

        switch (client->addr) {
                case 0x7a:
+               case 0x30:
                case 0x47:
                case 0x71:
                {
--- a/linux/include/media/ir-common.h   2007-06-28 10:30:22.000000000 -0400
+++ b/linux/include/media/ir-common.h   2007-06-29 08:56:48.000000000 -0400
@@ -140,6 +140,7 @@
 extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE];
 extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE];
 extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE];
+extern IR_KEYTAB_TYPE ir_codes_kworld_atsc110[IR_KEYTAB_SIZE];

 #endif

/*********************************************************************/



Bryan Bueter



_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux