Re: Patch for Leadtek Winfast TV USB II Deluxe (with IR)

2009-11-04 Thread Mauro Carvalho Chehab
Hi Magnus,

Em Thu, 29 Oct 2009 14:41:15 +0100
Magnus Alm magnus@gmail.com escreveu:

 Hi!
 
 I managed to get the remote working now in both in Ubuntu 9.04 (kernel
 2.6.28-16) and Ubuntu 9.10 (kernel 2.6.31-14).
 
 There is one difference tho, in the 2.6.28-16 kernel the remote
 doesn't do anything without configuring lirc.
 In 2.6.31-14 I can for example adjust volume in X and use the numeric
 keys to change channels in tvtime without lirc.
 Don't know why, it just works like that.
 
 I've added 3 different examples for a patch as attachment, since the
 remote can be enabled different ways.
 (They also changes the basic config for my board.)
 
 ex1.patch only works for kernel 2.6.31.
 
 ex2.patch works for both 2.6.31 and 2.6.28 but can in the future cause
 problems for boards that would like to use adress 0x1f (0x3e) for IR.
 (Because of the case 0x1f for my board.)
 
 ex3.patch is a combination of ex1 and ex2. where it is depending on if
 kernel version is higher or lower than 2.6.30.
 
 Dunno which one that would be most suitable.

The better is to follow what's specified at the InfraRed section of the API
spec:
http://www.linuxtv.org/downloads/v4l-dvb-apis/ch17.html

It is up to the userspace apps to adopt the standard.

Also, you can easily replace the table at userspace or use lirc.

 Another thing is that my board finds an IR device at 0x18 (0x30), but
 ir-polling doesn't work at that address, so if any board in the future
 needs that added
 0x1f needs to stand before 0x18.
 This is for the funtion in em28xx-cards if kernel higher than 2.6.30:
 
   const unsigned short addr_list[] = {
0x1f, 0x30, 0x47, I2C_CLIENT_END   
   };
 
 or in  ir-kbd-i2c for kernel lower than 2.6.30:
 
 static const int probe_em28XX[] = { 0x1f, 0x30, 0x47, -1 };

Please send a patch for it.

 
 I guess you also might have objections in how I'm naming stuff like
 get_key_lwtu2d, maybe it's a bit obscure...

Yes, it is. Please choose a better name ;)

Also, please don't add two separate functions (one for 2.6.30 or lower and
another for upper kernels).

The most important thing is to send the patches at -p1 format, and to send
your Signed-off-by. Please read 
http://www.linuxtv.org/hg/v4l-dvb/raw-file/tip/README.patches

For more info about how to submit a patch.



Cheers,
Mauro
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Patch for Leadtek Winfast TV USB II Deluxe (with IR)

2009-10-29 Thread Magnus Alm
Hi!

I managed to get the remote working now in both in Ubuntu 9.04 (kernel
2.6.28-16) and Ubuntu 9.10 (kernel 2.6.31-14).

There is one difference tho, in the 2.6.28-16 kernel the remote
doesn't do anything without configuring lirc.
In 2.6.31-14 I can for example adjust volume in X and use the numeric
keys to change channels in tvtime without lirc.
Don't know why, it just works like that.

I've added 3 different examples for a patch as attachment, since the
remote can be enabled different ways.
(They also changes the basic config for my board.)

ex1.patch only works for kernel 2.6.31.

ex2.patch works for both 2.6.31 and 2.6.28 but can in the future cause
problems for boards that would like to use adress 0x1f (0x3e) for IR.
(Because of the case 0x1f for my board.)

ex3.patch is a combination of ex1 and ex2. where it is depending on if
kernel version is higher or lower than 2.6.30.

Dunno which one that would be most suitable.

Another thing is that my board finds an IR device at 0x18 (0x30), but
ir-polling doesn't work at that address, so if any board in the future
needs that added
0x1f needs to stand before 0x18.
This is for the funtion in em28xx-cards if kernel higher than 2.6.30:

const unsigned short addr_list[] = {
 0x1f, 0x30, 0x47, I2C_CLIENT_END   
};

or in  ir-kbd-i2c for kernel lower than 2.6.30:

static const int probe_em28XX[] = { 0x1f, 0x30, 0x47, -1 };


I guess you also might have objections in how I'm naming stuff like
get_key_lwtu2d, maybe it's a bit obscure...


/Magnus Alm
--- org/v4l-dvb/linux/include/media/ir-common.h	2009-10-29 13:03:42.515061680 +0100
+++ ex1/v4l-dvb/linux/include/media/ir-common.h	2009-10-26 12:00:00.0 +0100
@@ -179,4 +179,5 @@
 extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
 extern struct ir_scancode_table ir_codes_videomate_s350_table;
 extern struct ir_scancode_table ir_codes_gadmei_rm008z_table;
+extern struct ir_scancode_table ir_codes_lwtu2d_table;
 #endif
--- org/v4l-dvb/linux/drivers/media/common/ir-keymaps.c	2009-10-29 13:03:41.525062396 +0100
+++ ex1/v4l-dvb/linux/drivers/media/common/ir-keymaps.c	2009-10-27 16:51:08.267566000 +0100
@@ -3302,3 +3302,42 @@
 	.size = ARRAY_SIZE(ir_codes_gadmei_rm008z),
 };
 EXPORT_SYMBOL_GPL(ir_codes_gadmei_rm008z_table);
+
+static struct ir_scancode ir_codes_lwtu2d[] = {
+	{ 0x70, KEY_POWER2},		/* POWER OFF*/
+	{ 0x72, KEY_MODE}, 		/* TV/FM */
+	{ 0x21, KEY_CHANNEL},		/* CHANNEL SURF */
+	{ 0x73, KEY_ZOOM},		/* FULLSECREEN */
+	{ 0x39, KEY_CLOSE},		/* MINIMIZE */
+	{ 0x66, KEY_INFO},		/* DISPLAY */
+	{ 0x61, KEY_PREVIOUS},		/* RECALL */
+	{ 0x64, KEY_MUTE},		/* MUTE */
+	
+	{ 0x75, KEY_1},
+	{ 0x76, KEY_2},
+	{ 0x77, KEY_3},
+	{ 0x79, KEY_4},
+	{ 0x7a, KEY_5},
+	{ 0x7b, KEY_6},
+	{ 0x7d, KEY_7},
+	{ 0x7e, KEY_8},
+	{ 0x7f, KEY_9},
+	{ 0x62, KEY_0},
+	{ 0x31, KEY_DOT},		/* '.' */
+	{ 0x63, KEY_ENTER},		/* ENTER */
+
+	{ 0x35, KEY_TIME},		/* TIMESHIFT */
+	{ 0x38, KEY_CAMERA},		/* SNAPSHOT */
+	{ 0x37, KEY_RECORD},		/* RECORD */
+	{ 0x3a, KEY_TV2},		/* PIP */
+
+	{ 0x74, KEY_VOLUMEUP},		/* VOLUMEUP */
+	{ 0x78, KEY_VOLUMEDOWN},	/* VOLUMEDOWN */
+	{ 0x7c, KEY_CHANNELUP},		/* CHANNELUP */
+	{ 0x60, KEY_CHANNELDOWN},	/* CHANNELDOWN */
+};
+struct ir_scancode_table ir_codes_lwtu2d_table = {
+	.scan = ir_codes_lwtu2d,
+	.size = ARRAY_SIZE(ir_codes_lwtu2d),
+};
+EXPORT_SYMBOL_GPL(ir_codes_lwtu2d_table);
--- org/v4l-dvb/linux/drivers/media/video/ir-kbd-i2c.c	2009-10-29 13:03:42.155062472 +0100
+++ ex1/v4l-dvb/linux/drivers/media/video/ir-kbd-i2c.c	2009-10-29 13:28:02.705063253 +0100
@@ -416,6 +416,7 @@
 		ir_codes= ir_codes_pv951_table;
 		break;
 	case 0x18:
+	case 0x1f:
 	case 0x1a:
 		name= Hauppauge;
 		ir-get_key = get_key_haup;
--- org/v4l-dvb/linux/drivers/media/video/em28xx/em28xx-cards.c	2009-10-29 13:03:42.045061311 +0100
+++ ex1/v4l-dvb/linux/drivers/media/video/em28xx/em28xx-cards.c	2009-10-29 13:48:43.285519588 +0100
@@ -466,22 +466,31 @@
 		.name = Leadtek Winfast USB II Deluxe,
 		.valid= EM28XX_BOARD_NOT_VALIDATED,
 		.tuner_type   = TUNER_PHILIPS_FM1216ME_MK3,
-		.tda9887_conf = TDA9887_PRESENT,
+		.has_ir_i2c   = 1,
+		.tvaudio_addr = 0x58,	
+		.tda9887_conf = TDA9887_PRESENT |
+TDA9887_PORT2_ACTIVE |
+TDA9887_QSS,
 		.decoder  = EM28XX_SAA711X,
-		.input= { {
+		.adecoder = EM28XX_TVAUDIO,
+  		.input= { {
 			.type = EM28XX_VMUX_TELEVISION,
-			.vmux = SAA7115_COMPOSITE2,
-			.amux = EM28XX_AMUX_VIDEO,
-		}, {
+			.vmux = SAA7115_COMPOSITE4,
+			.amux = EM28XX_AMUX_AUX,
+  		}, {
 			.type = EM28XX_VMUX_COMPOSITE1,
-			.vmux = SAA7115_COMPOSITE0,
+			.vmux = SAA7115_COMPOSITE5,
 			.amux = EM28XX_AMUX_LINE_IN,
-		}, {
+  		}, {
 			.type = EM28XX_VMUX_SVIDEO,
-			.vmux = SAA7115_COMPOSITE0,
+			.vmux = SAA7115_SVIDEO3,
 			.amux = EM28XX_AMUX_LINE_IN,
-		} },
-	},
+  		} },
+			.radio	  = {
+			.type