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

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

 



There is a mistake in the first attached patch file.  Here is the correct version.
I'll stop spaming the list now. 8*)



diff -U 3 -H -d -r -N -- a/linux/drivers/media/common/ir-keymaps.c b/linux/drivers/media/common/ir-keymaps.c
--- a/linux/drivers/media/common/ir-keymaps.c	2007-01-13 16:59:28.000000000 -0500
+++ b/linux/drivers/media/common/ir-keymaps.c	2007-01-13 17:05:03.000000000 -0500
@@ -1828,3 +1828,57 @@
 };
 
 EXPORT_SYMBOL_GPL(ir_codes_tt_1500);
+
+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);
diff -U 3 -H -d -r -N -- a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c
--- a/linux/drivers/media/video/ir-kbd-i2c.c	2007-01-13 16:59:28.000000000 -0500
+++ b/linux/drivers/media/video/ir-kbd-i2c.c	2007-01-13 18:27:54.000000000 -0500
@@ -62,6 +62,8 @@
 
 /* ----------------------------------------------------------------------- */
 
+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];
@@ -144,14 +146,17 @@
 
 	/* 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)
 		return 0;
 
-	if (b == 0xfe)
+        /* KNC1 card            = 0xfe */
+        /* Kworld ATSC110 card  = 0x80 */
+
+	if ((b == 0xfe)||(b & 0x80))
 		/* keep old data */
 		return 1;
 
@@ -364,10 +369,15 @@
 		}
 		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:
@@ -469,8 +479,8 @@
 	   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;
@@ -499,6 +509,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");
diff -U 3 -H -d -r -N -- a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c
--- a/linux/drivers/media/video/saa7134/saa7134-cards.c	2007-01-13 16:59:28.000000000 -0500
+++ b/linux/drivers/media/video/saa7134/saa7134-cards.c	2007-01-13 17:11:20.000000000 -0500
@@ -4175,6 +4175,9 @@
 	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 -U 3 -H -d -r -N -- a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c
--- a/linux/drivers/media/video/saa7134/saa7134-i2c.c	2007-01-13 16:59:28.000000000 -0500
+++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c	2007-01-13 17:12:42.000000000 -0500
@@ -350,6 +350,7 @@
 
 	switch (client->addr) {
 		case 0x7a:
+		case 0x30:
 		case 0x47:
 		case 0x71:
 		{
diff -U 3 -H -d -r -N -- a/linux/include/media/ir-common.h b/linux/include/media/ir-common.h
--- a/linux/include/media/ir-common.h	2007-01-13 16:59:28.000000000 -0500
+++ b/linux/include/media/ir-common.h	2007-01-13 17:03:46.000000000 -0500
@@ -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
 
_______________________________________________
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