Re: kworld atsc 110 remote

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

 



here is the patch .  I changed
-        mod_timer(&ir->timer, jiffies+HZ/10);
to
+       mod_timer(&ir->timer, jiffies+HZ/20);
to improve responsiveness.  polls twice as often.  Not sure where the
change should go though.  Has anyone actually got a repeat from this
card, cause for the life of me i can't.
         Hope this helps someone
                Jonathan

On 4/2/07, Nathan Faust <nfaust@xxxxxxxxxxxxxxxxxxxxx> wrote:
Jon,

Can you post your kernel patch with the fixes.
I'm probably using the one by Dwaine Garden "80th attempt...." post.
I would like any improvement in button response.

Thank you.
Nathan.
-------------------------------------------
Nathan Faust


-----Original Message-----
From: Jonathan Isom [mailto:jeisom@xxxxxxxxx]
Sent: Monday, April 02, 2007 11:13 AM
To: Nathan Faust
Cc: linux-dvb@xxxxxxxxxxx
Subject: Re:  kworld atsc 110 remote

Hello
    Yeah I have a modified patch that seems more responsive that
detects button presses
through gpio.  also the patch I found on the list (80th attempt....)
has some duplicate entries
in the key map that i think is causing some of the
problems(specifically presses being miss
detected as  other buttons.  so far (since last night) it seems
better. Though I'd like to use
lirc directly so any remote would work.  the lirc_i2c driver is very
similar to the saa7134's i2c
input driver, code wise , but I just get 1 byte codes like its hard
coded for there remote.
If the patch stays stable I'll post it.
                      later
                          Jonathan
On 4/2/07, Nathan Faust <nfaust@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Jon,
>
> Having the same card, the best I have done is:
> Apply the kernel patch to create an event input device for the ir
> sensor.
>         I'm still seeing some of the issues talked about with the
patch:
> delayed button presses the most         notable one.
> I created a udev rule to map /dev/input/event? -> /dev/input/irremote
>         KERNEL=="event*",ATTRS{modalias}=="input:b0018v0000p0000e0000-
>
e0,1,14,k71,72,73,74,80,9F,A3,A4,A5,A7,A8,D2,D9,16D,174,188,189,192,193,
> ramlsfw",SYMLINK="input/
>         irremote"
> I setup lirc in /etc/lirc/hardware.conf to read from the dev/input
> driver on /dev/input/irremote
>         # /etc/lirc/hardware.conf
>         #
>         # Arguments which will be used when launching lircd
>         LIRCD_ARGS=""
>         #Don't start lircmd even if there seems to be a good config
file
>         #START_LIRCMD=false
>         #Try to load appropriate kernel modules
>         LOAD_MODULES=false
>         # Run "lircd --driver=help" for a list of supported drivers.
>         DRIVER="dev/input"
>         # If DEVICE is set to /dev/lirc and devfs is in use
/dev/lirc/0
> will be
>         # automatically used instead
>         DEVICE="/dev/input/irremote"
>         MODULES=""
>         # Default configuration files for your hardware if any
>         LIRCD_CONF="/etc/lirc/lircd.conf"
>         LIRCMD_CONF=""
> And used the lircd.conf file from
> http://lirc.sourceforge.net/remotes/kworld/ATSC_110
> -------------------------------------------
> Nathan Faust
>
>
> -----Original Message-----
> From: linux-dvb-bounces@xxxxxxxxxxx
> [mailto:linux-dvb-bounces@xxxxxxxxxxx] On Behalf Of Jonathan Isom
> Sent: Sunday, April 01, 2007 9:24 PM
> To: linux-dvb@xxxxxxxxxxx
> Subject:  kworld atsc 110 remote
>
> Hello
>     I'm hoping some one can help me.  I'm trying to make lirc handle
> the remote control for the 110 but all the data i get from the card is
> from the remote that came with the card.  The codes i receive from the
> remote are 1 byte long and match the buttons mapping in the patch
> floating around.  I was wondering if maybe you have to init the ir
> controller to use it with another remote.
>             any ideas
>                   Jonathan
>
> _______________________________________________
> linux-dvb mailing list
> linux-dvb@xxxxxxxxxxx
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
>
>
>



diff -uprN b/linux/drivers/media/common/ir-keymaps.c a/linux/drivers/media/common/ir-keymaps.c
--- b/linux/drivers/media/common/ir-keymaps.c	2007-03-30 13:07:10.000000000 -0500
+++ a/linux/drivers/media/common/ir-keymaps.c	2007-04-02 02:56:42.040426917 -0500
@@ -1827,3 +1827,56 @@ IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTA
 };
 
 EXPORT_SYMBOL_GPL(ir_codes_tt_1500);
+
+IR_KEYTAB_TYPE ir_codes_kworld_atsc110[IR_KEYTAB_SIZE] = {
+        [ 0x00 ] = KEY_1,
+        [ 0x01 ] = KEY_2,
+        [ 0x02 ] = KEY_3,
+        [ 0x03 ] = KEY_4,
+        [ 0x04 ] = KEY_5,
+        [ 0x05 ] = KEY_6,
+        [ 0x06 ] = KEY_7,
+        [ 0x07 ] = KEY_8,
+        [ 0x08 ] = KEY_9,
+        [ 0x0a ] = KEY_0,
+        [ 0x09 ] = KEY_ESC,              /* UP ARROW */
+        [ 0x0c ] = KEY_POWER,            /* POWER */
+        [ 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 */
+        [ 0x0e ] = 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);
diff -uprN b/linux/drivers/media/video/ir-kbd-i2c.c a/linux/drivers/media/video/ir-kbd-i2c.c
--- b/linux/drivers/media/video/ir-kbd-i2c.c	2007-03-30 13:07:10.000000000 -0500
+++ a/linux/drivers/media/video/ir-kbd-i2c.c	2007-04-02 11:21:19.140426918 -0500
@@ -44,6 +44,8 @@
 #include <media/ir-kbd-i2c.h>
 #include "compat.h"
 
+#include "saa7134.h"
+#include "saa7134-reg.h"
 /* ----------------------------------------------------------------------- */
 /* insmod parameters                                                       */
 
@@ -61,6 +63,8 @@ MODULE_PARM_DESC(hauppauge, "Specify Hau
 
 /* ----------------------------------------------------------------------- */
 
+static int kworldatsc110 = 0; /* Both KNC1 and the Kworld ATSC110 cards use the same i2c address */
+
 static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
 {
 	unsigned char buf[3];
@@ -133,7 +137,27 @@ static int get_key_pv951(struct IR_i2c *
 
 static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
 {
-	unsigned char b;
+	unsigned char b=0;
+	int gpio;
+
+	/* <dev> is needed to access GPIO. Used by the saa_readl macro. */
+	struct saa7134_dev *dev = ir->c.adapter->algo_data;
+	if (dev == NULL) {
+	       dprintk (1,"get_key_knc1: gir->c.adapter->algo_data is NULL!\n");
+	       return -EIO;
+	}
+
+	/* rising SAA7134_GPIO_GPRESCAN reads the status */
+	saa_clearb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN);
+	saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN);
+
+	gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+       /* GPIO&0x100 is pulsed low when a button is pressed. Don't do
+          I2C receive if gpio&0x100 is not low. */
+
+	if( gpio & 0x100) {
+	         return 0;
+	 }
 
 	/* poll IR chip */
 	if (1 != i2c_master_recv(&ir->c,&b,1)) {
@@ -143,17 +167,15 @@ static int get_key_knc1(struct IR_i2c *i
 
 	/* 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 */
-
-	dprintk(2,"key %02x\n", b);
-
-	if (b == 0xff)
-		return 0;
+	   down. 0xfe and 0x80 sequences are sometimes interrupted by 0xFF */
 
-	if (b == 0xfe)
-		/* keep old data */
-		return 1;
+	dprintk(1,"key %02x\n", b);
 
+			
+       if ((b == 0xfe)||(b & 0x80))
+                /* keep old data */
+                return 1;
+	
 	*ir_key = b;
 	*ir_raw = b;
 	return 1;
@@ -280,7 +302,7 @@ static void ir_work(struct work_struct *
 	struct IR_i2c *ir = container_of(work, struct IR_i2c, work);
 #endif
 	ir_key_poll(ir);
-	mod_timer(&ir->timer, jiffies+HZ/10);
+	mod_timer(&ir->timer, jiffies+HZ/20);
 }
 
 /* ----------------------------------------------------------------------- */
@@ -363,10 +385,15 @@ static int ir_attach(struct i2c_adapter 
 		}
 		break;
 	case 0x30:
-		name        = "KNC One";
 		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:
@@ -468,8 +495,8 @@ static int ir_probe(struct i2c_adapter *
 	   That's why we probe 0x1a (~0x34) first. CB
 	*/
 
-	static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
-	static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 };
+	static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1 };
+	static const int probe_saa7134[] = { 0x7a, 0x30, 0x47, 0x71, -1 };
 	static const int probe_em28XX[] = { 0x30, 0x47, -1 };
 	const int *probe = NULL;
 	struct i2c_client c;
@@ -498,6 +525,30 @@ static int ir_probe(struct i2c_adapter *
 	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");
diff -uprN b/linux/drivers/media/video/saa7134/saa7134-cards.c a/linux/drivers/media/video/saa7134/saa7134-cards.c
--- b/linux/drivers/media/video/saa7134/saa7134-cards.c	2007-03-30 13:07:10.000000000 -0500
+++ a/linux/drivers/media/video/saa7134/saa7134-cards.c	2007-03-30 21:12:01.663329134 -0500
@@ -4346,6 +4346,9 @@ int saa7134_board_init1(struct saa7134_d
 	case SAA7134_BOARD_PINNACLE_PCTV_110i:
 	case SAA7134_BOARD_PINNACLE_PCTV_310i:
 	case SAA7134_BOARD_UPMOST_PURPLE_TV:
+	case SAA7134_BOARD_KWORLD_ATSC110:
+		dev->has_remote = SAA7134_REMOTE_I2C;
+		break;
 	case SAA7134_BOARD_HAUPPAUGE_HVR1110:
 		dev->has_remote = SAA7134_REMOTE_I2C;
 		break;
diff -uprN b/linux/drivers/media/video/saa7134/saa7134-i2c.c a/linux/drivers/media/video/saa7134/saa7134-i2c.c
--- b/linux/drivers/media/video/saa7134/saa7134-i2c.c	2007-03-30 13:07:10.000000000 -0500
+++ a/linux/drivers/media/video/saa7134/saa7134-i2c.c	2007-03-30 21:12:01.663329134 -0500
@@ -350,6 +350,7 @@ static int attach_inform(struct i2c_clie
 
 	switch (client->addr) {
 		case 0x7a:
+		case 0x30:
 		case 0x47:
 		case 0x71:
 		{
diff -uprN b/linux/include/media/ir-common.h a/linux/include/media/ir-common.h
--- b/linux/include/media/ir-common.h	2007-03-30 13:07:10.000000000 -0500
+++ a/linux/include/media/ir-common.h	2007-03-30 21:12:01.683329134 -0500
@@ -140,6 +140,7 @@ extern IR_KEYTAB_TYPE ir_codes_budget_ci
 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
 
_______________________________________________
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