Re: kworld DVB-T 220RF - remote control

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

 



Am Dienstag, den 17.10.2006, 12:50 -0700 schrieb Henry Wong:
> hermann pitton wrote:
> > Mike likely will need the signed-off-by Henry Wong, CCed.
> >   
> 
> Hi,
> 
> Sorry, I'm not really familiar with how the project is managed. What
> does this mean?
> (If you have time, I'd like to know how the development model works :)
> 
> If it means that I should test the final patch and somehow "approve" it,
> unfortunately I no longer have my MSI TV tuner card =)
> 
> 
> I noticed there were some comments about "repeating keys". I don't
> believe this is possible, at least with the MSI TV@nywhere Plus remote.
> The remote control really only sends a signal when a key is initially
> depressed. It does not send a signal when a key is released, and doesn't
> do anything regardless of whether the key is held down or not.
> 
> Thanks!
> 

Hello Henry,

thanks for your reply!

I realized after people started working with your code, we forgot to ask
you for your sign-off on your initial patch, solely our mistake.

Here is a link to it on a mail archive, which I forgot to add in my
previous mail.
http://marc.theaimsgroup.com/?l=linux-video&m=113435030232464&w=2

The development model is detailed on the v4l-wiki. For the case of the
sign-off needed especially here.
http://linuxtv.org/v4lwiki/index.php/SubmittingPatches

Should be enough if you reply with your
Signed-off-by: your name <email>

Is also already in saa7134-input.c in your comment above the keycodes.
Or send it as a followup to your original mail from Dec. 2005.

Then people can start to review and work with it.

Thanks again for your contribution!

For reference your original patch is attached.
Hope the mailer is nice to it. Usually it is.

Thanks,
Hermann






Index: linux/drivers/media/video/ir-kbd-i2c.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/ir-kbd-i2c.c,v
retrieving revision 1.30
diff -u -r1.30 ir-kbd-i2c.c
--- linux/drivers/media/video/ir-kbd-i2c.c	8 Dec 2005 21:02:56 -0000	1.30
+++ linux/drivers/media/video/ir-kbd-i2c.c	12 Dec 2005 01:03:52 -0000
@@ -95,6 +95,8 @@
 #define dprintk(level, fmt, arg...)	if (debug >= level) \
 	printk(KERN_DEBUG DEVNAME ": " fmt , ## arg)
 
+static int polling_interval = 100; /* ms */
+
 /* ----------------------------------------------------------------------- */
 
 static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
@@ -269,7 +271,7 @@
 {
 	struct IR_i2c *ir = data;
 	ir_key_poll(ir);
-	mod_timer(&ir->timer, jiffies+HZ/10);
+	mod_timer(&ir->timer, jiffies + polling_interval*HZ/1000);
 }
 
 /* ----------------------------------------------------------------------- */
@@ -340,6 +342,9 @@
 		ir_codes    = ir_codes_rc5_tv;
 		break;
 	case 0x30:
+		if (adap->id == I2C_HW_SAA7134) /* Handled by saa7134-input */
+			polling_interval = 50; /* ms */
+
 		name        = "KNC One";
 		ir->get_key = get_key_knc1;
 		ir_type     = IR_TYPE_OTHER;
@@ -431,7 +436,7 @@
 	*/
 
 	static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
-	static const int probe_saa7134[] = { 0x7a, 0x47, -1 };
+	static const int probe_saa7134[] = { 0x7a, 0x47, 0x30, -1 };
 	static const int probe_em28XX[] = { 0x30, 0x47, -1 };
 	const int *probe = NULL;
 	struct i2c_client c;
@@ -456,7 +461,36 @@
 	c.adapter = adap;
 	for (i = 0; -1 != probe[i]; i++) {
 		c.addr = probe[i];
-		rc = i2c_master_recv(&c,&buf,0);
+		
+		/* Special case for MSI TV@nywhere Plus remote */
+		if (c.adapter->id == I2C_HW_SAA7134 && probe[i] == 0x30)
+		{
+			struct i2c_client c2;
+
+			memset (&c2, 0, sizeof(c2));
+			c2.adapter = c.adapter;
+
+			/* MSI TV@nywhere Plus' controller doesn't seem to
+			respond to probes unless we read something from an
+			existing device. Weird... */
+						
+			/* Find a device that responds. If none found, oh well. */
+			for (c2.addr=127; c2.addr >= 0; c2.addr--)
+			{
+				if (0 == i2c_master_recv(&c2,&buf,0))
+					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--;
+		}
+		else
+		{
+			rc = i2c_master_recv(&c,&buf,0);
+		}
+		
 		dprintk(1,"probe 0x%02x @ %s: %s\n",
 			probe[i], adap->name,
 			(0 == rc) ? "yes" : "no");
Index: linux/drivers/media/video/saa7134/saa7134-cards.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/saa7134/saa7134-cards.c,v
retrieving revision 1.117
diff -u -r1.117 saa7134-cards.c
--- linux/drivers/media/video/saa7134/saa7134-cards.c	8 Dec 2005 02:46:36 -0000	1.117
+++ linux/drivers/media/video/saa7134/saa7134-cards.c	12 Dec 2005 01:03:53 -0000
@@ -2531,8 +2531,8 @@
 			.amux   = LINE1,
 		}},
 	},
-	[SAA7134_BOARD_MSI_TVATANYWHERE_PLUS] = {
-		.name           = "MSI TV@Anywhere plus",
+	[SAA7134_BOARD_MSI_TVANYWHERE_PLUS] = {
+		.name           = "MSI TV@nywhere Plus",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_TDA8290,
 		.radio_type     = UNSET,
@@ -3030,7 +3030,7 @@
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x1462,
 		.subdevice    = 0x6231,
-		.driver_data  = SAA7134_BOARD_MSI_TVATANYWHERE_PLUS,
+		.driver_data  = SAA7134_BOARD_MSI_TVANYWHERE_PLUS,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
@@ -3216,6 +3216,7 @@
 	/* i2c remotes */
 	case SAA7134_BOARD_PINNACLE_PCTV_110i:
 	case SAA7134_BOARD_UPMOST_PURPLE_TV:
+	case SAA7134_BOARD_MSI_TVANYWHERE_PLUS:
 		dev->has_remote = SAA7134_REMOTE_I2C;
 		break;
 	}
Index: linux/drivers/media/video/saa7134/saa7134-i2c.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/saa7134/saa7134-i2c.c,v
retrieving revision 1.27
diff -u -r1.27 saa7134-i2c.c
--- linux/drivers/media/video/saa7134/saa7134-i2c.c	18 Oct 2005 14:16:40 -0000	1.27
+++ linux/drivers/media/video/saa7134/saa7134-i2c.c	12 Dec 2005 01:03:54 -0000
@@ -347,6 +347,7 @@
 	switch (client->addr) {
 		case 0x7a:
 		case 0x47:
+		case 0x30:
 		{
 			struct IR_i2c *ir = i2c_get_clientdata(client);
 			d1printk("%s i2c IR detected (%s).\n",
Index: linux/drivers/media/video/saa7134/saa7134-input.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/saa7134/saa7134-input.c,v
retrieving revision 1.46
diff -u -r1.46 saa7134-input.c
--- linux/drivers/media/video/saa7134/saa7134-input.c	7 Dec 2005 12:30:28 -0000	1.46
+++ linux/drivers/media/video/saa7134/saa7134-input.c	12 Dec 2005 01:03:54 -0000
@@ -533,6 +533,69 @@
 	[ 0x1e ] = KEY_PAUSE,
 };
 
+/* 
+  Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card
+  is marked "KS003". The controller is I2C at address 0x30, but does not seem to respond
+  to probes until a read is performed from a valid device. (I don't know why.)
+  Henry Wong <henry@xxxxxxxxxxxxxx>
+*/
+static IR_KEYTAB_TYPE msi_tvanywhere_plus_codes[IR_KEYTAB_SIZE] = {
+
+/*
+    POWER   SOURCE  SCAN    MUTE    
+    TV/FM   1       2       3
+    CH+     4       5       6
+    CH-     7       8       9
+    >>(12)  0       +(16)   RECALL(19)
+    <<(4)   RECORD  STOP    PLAY
+
+        MINIMIZE(15)   ZOOM(25)
+	
+                  CH+
+           VOL-         VOL+
+                  CH-
+		  
+        SNAPSHOT(26)     MTS(13)
+	
+    <<(4)  FUNCTION  >>(12) RESET(29)
+*/
+	[    2 ] = KEY_KP0,
+	[    1 ] = KEY_KP1,
+	[   11 ] = KEY_KP2,
+	[   27 ] = KEY_KP3,
+	[    5 ] = KEY_KP4,
+	[    9 ] = KEY_KP5,
+	[   21 ] = KEY_KP6,
+	[    6 ] = KEY_KP7,
+	[   10 ] = KEY_KP8,
+	[   18 ] = KEY_KP9,
+
+	[    0 ] = KEY_RECORD,
+	[    3 ] = KEY_RADIO,          /* FM Radio */
+	[    4 ] = KEY_BACK,
+	[    7 ] = KEY_TUNER,          /* Source */
+	[    8 ] = KEY_STOP,
+	[   12 ] = KEY_FORWARD,
+	[   13 ] = KEY_LANGUAGE,       /* MTS */
+	[   14 ] = KEY_MENU,           /* Function */
+	[   15 ] = KEY_CLOSE,          /* Minimize */
+	[   16 ] = KEY_KPPLUS,         /* + */
+ 	[   17 ] = KEY_PLAY,
+	[   19 ] = KEY_AGAIN,          /* Recall */
+	[   20 ] = KEY_VOLUMEDOWN,
+	[   22 ] = KEY_VOLUMEUP,
+	[   23 ] = KEY_CHANNELDOWN,
+	[   24 ] = KEY_MUTE,
+	[   25 ] = KEY_ZOOM,
+	[   26 ] = KEY_SHUFFLE,        /* Snapshot */
+	[   28 ] = KEY_SEARCH,	       /* Scan */
+	[   29 ] = KEY_RESTART,        /* Reset */
+ 	[   30 ] = KEY_POWER,
+	[   31 ] = KEY_CHANNELUP
+};
+
+
+
 
 /* -------------------- GPIO generic keycode builder -------------------- */
 
@@ -566,6 +629,48 @@
 }
 
 /* --------------------- Chip specific I2C key builders ----------------- */
+static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char b;
+	int rc;
+	int gpio;
+
+	/* We need this to access GPIO. Used by the saa_readl macro. */
+	struct saa7134_dev *dev = ir->c.adapter->algo_data;
+	if (dev == NULL) {
+		dprintk ("ir->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&0x40 is pulsed low when a button is pressed. Don't do
+	   I2C receive if gpio&0x40 is not low. */
+	if (gpio & 0x40) 
+		return 0;	/* No button press */
+
+
+	/* GPIO says there is a button press. Get it. */
+	if (1 != (rc=i2c_master_recv(&ir->c,&b,1))) {
+		dprintk("read error %d\n", rc);
+		return -EIO;
+	}
+
+	/* No button press */
+	if (b == 0xFF)
+		return 0;
+	
+	/* Button pressed */
+	dprintk ("get_key_msi_tvanywhere_plus key=0x%x\n", b);
+
+	*ir_key = b;
+	*ir_raw = b;
+	return 1;
+}
 
 static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
 {
@@ -805,6 +910,11 @@
 		ir->get_key   = get_key_purpletv;
 		ir->ir_codes  = ir_codes_purpletv;
 		break;
+	case SAA7134_BOARD_MSI_TVANYWHERE_PLUS:
+		snprintf(ir->c.name, sizeof(ir->c.name), "MSI TV@nywhere Plus");
+		ir->get_key   = get_key_msi_tvanywhere_plus;
+		ir->ir_codes  = msi_tvanywhere_plus_codes;
+		break;
 	default:
 		dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board);
 		break;
Index: linux/drivers/media/video/saa7134/saa7134.h
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/saa7134/saa7134.h,v
retrieving revision 1.85
diff -u -r1.85 saa7134.h
--- linux/drivers/media/video/saa7134/saa7134.h	7 Dec 2005 14:17:03 -0000	1.85
+++ linux/drivers/media/video/saa7134/saa7134.h	12 Dec 2005 01:03:54 -0000
@@ -215,7 +215,7 @@
 #define SAA7134_BOARD_SEDNA_PC_TV_CARDBUS     79
 #define SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV 80
 #define SAA7134_BOARD_PHILIPS_TIGER  81
-#define SAA7134_BOARD_MSI_TVATANYWHERE_PLUS  82
+#define SAA7134_BOARD_MSI_TVANYWHERE_PLUS  82
 #define SAA7134_BOARD_CINERGY250PCI 83
 
 #define SAA7134_MAXBOARDS 8
_______________________________________________
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