[linux-dvb] Patch : key codes for Winfast DTV dongle IR remote

Vincent Penne ziggy at sashipa.com
Fri Jan 19 14:32:07 CET 2007


Hi all,

this patch provides key codes for the IR remote of the Winfast DTV dongle.

Additionally, I changed the part of the code where the size of the 
dibusb_rc_keys array is hardcoded in several places. What I did was to 
define an exported variable in dibusb-common.c, containing the size of 
the array. It is then used in the other places during the module init 
code to fill in the rc_key_map_size entries. I am not sure at all it is 
the best way to do it, but at least now you can change that table at 
will without worrying to update the rest of the code.

Finally, I have problems with timing for key repeat for this remote. 
I'll make more test, but I think that the rc_interval value need to be 
tuned for this model.

Cheers,

 Vincent Penne.
-------------- next part --------------
diff -ru src.orig/linux/drivers/media/dvb/dvb-usb/dibusb-common.c src/linux/drivers/media/dvb/dvb-usb/dibusb-common.c
--- src.orig/linux/drivers/media/dvb/dvb-usb/dibusb-common.c	2006-12-09 20:41:27.000000000 +0100
+++ src/linux/drivers/media/dvb/dvb-usb/dibusb-common.c	2007-01-17 15:41:52.000000000 +0100
@@ -437,8 +438,64 @@
 	{ 0x80, 0x4d, KEY_0 },
 	{ 0x80, 0x4e, KEY_ENTER },
 	{ 0x80, 0x4f, KEY_VOLUMEDOWN },
+
+
+	/* winfast dtv dongle */
+	{ 0x03,0x05/*, 0x0B, 0x04,0x00,0x1e*/,  KEY_1 },
+	{ 0x03,0x06/*, 0x0B, 0x04,0x00,0x1f*/,  KEY_2 },
+	{ 0x03,0x07/*, 0x0B, 0x04,0x00,0x20*/,  KEY_3 },
+	{ 0x03,0x09/*, 0x0B, 0x04,0x00,0x21*/,  KEY_4 },
+	{ 0x03,0x0A/*, 0x0B, 0x04,0x00,0x22*/,  KEY_5 },
+	{ 0x03,0x0B/*, 0x0B, 0x04,0x00,0x23*/,  KEY_6 },
+	{ 0x03,0x0D/*, 0x0B, 0x04,0x00,0x24*/,  KEY_7 },
+	{ 0x03,0x0E/*, 0x0B, 0x04,0x00,0x25*/,  KEY_8 },
+	{ 0x03,0x0F/*, 0x0B, 0x04,0x00,0x26*/,  KEY_9 },
+	{ 0x03,0x12/*, 0x0B, 0x04,0x00,0x27*/,  KEY_0 },
+	{ 0x03,0x41/*, 0x0B, 0x04,0x00,0x37*/,  KEY_DOT },
+	{ 0x03,0xF0/*, 0x0B, 0x04,0x00,0x29*/,  KEY_ESC },
+	{ 0x03,0xFF/*, 0x0B, 0x04,0x00,0x51*/,  KEY_DOWN },
+	{ 0x03,0xFE/*, 0x0B, 0x04,0x00,0x52*/,  KEY_UP },
+	{ 0x03,0xFD/*, 0x0B, 0x04,0x00,0x4f*/,  KEY_RIGHT },
+	{ 0x03,0xFC/*, 0x0B, 0x04,0x00,0x50*/,  KEY_LEFT },
+	{ 0x03,0x13/*, 0x07, 0x04,0x00,0x28*/,  KEY_ENTER },
+	{ 0x03,0xF1/*, 0x04, 0x03,0x82,0x00*/,  KEY_SLEEP },
+	{ 0x03,0xF2/*, 0x04, 0x01,0x09,0x02*/,  KEY_PROPS },
+	{ 0x03,0xF3/*, 0x04, 0x01,0x24,0x02*/,  KEY_BACK },
+	{ 0x03,0x43/*, 0x04, 0x01,0xb0,0x00*/,  KEY_PLAY },
+	{ 0x03,0xF4/*, 0x04, 0x01,0xb1,0x00*/,  KEY_PAUSE },
+	{ 0x03,0x47/*, 0x04, 0x01,0xb2,0x00*/,  KEY_RECORD },
+	{ 0x03,0x55/*, 0x0C, 0x01,0xb3,0x00*/,  KEY_FASTFORWARD },
+	{ 0x03,0x54/*, 0x0C, 0x01,0xb4,0x00*/,  KEY_REWIND },
+	{ 0x03,0x44/*, 0x04, 0x01,0xb5,0x00*/,  KEY_NEXTSONG },
+	{ 0x03,0x42/*, 0x04, 0x01,0xb6,0x00*/,  KEY_PREVIOUSSONG },
+	{ 0x03,0x46/*, 0x04, 0x01,0xb7,0x00*/,  KEY_STOP },
+	{ 0x03,0x04/*, 0x00, 0x01,0xe9,0x00*/,  KEY_VOLUMEUP },
+	{ 0x03,0x08/*, 0x00, 0x01,0xea,0x00*/,  KEY_VOLUMEDOWN },
+	{ 0x03,0x14/*, 0x04, 0x01,0xe2,0x00*/,  KEY_MUTE },
+	{ 0x03,0x4F/*, 0x04, 0x01,0x8d,0x00*/,  KEY_MENU },
+	{ 0x03,0x0C/*, 0x07, 0x01,0x9c,0x00*/,  KEY_CHANNELUP },
+	{ 0x03,0x10/*, 0x07, 0x01,0x9d,0x00*/,  KEY_CHANNELDOWN },
+	{ 0x03,0x51/*, 0x04, 0x02,0x80,0x00*/,  KEY_CHANNEL }, // Surf.
+	{ 0x03,0x1B/*, 0x04, 0x02,0x81,0x00*/,  KEY_F13 }, //SAP
+	{ 0x03,0x4A/*, 0x04, 0x02,0x82,0x00*/,  KEY_F14 }, //PIP
+	{ 0x03,0x45/*, 0x04, 0x02,0x83,0x00*/,  KEY_F15 }, //TimeShifting
+	{ 0x03,0x48/*, 0x04, 0x02,0x84,0x00*/,  KEY_F16 }, //SnapShot
+	{ 0x03,0x11/*, 0x04, 0x02,0x85,0x00*/,  KEY_F17 }, //Recall
+	{ 0x03,0x16/*, 0x04, 0x02,0x86,0x00*/,  KEY_F18 }, //Display
+	{ 0x03,0x1E/*, 0x04, 0x02,0x87,0x00*/,  KEY_VIDEO }, //Video In
+	{ 0x03,0x03/*, 0x04, 0x02,0x88,0x00*/,  KEY_F19 }, //FullScreen
+	{ 0x03,0x50/*, 0x04, 0x02,0x89,0x00*/,  KEY_CANCEL }, //Cancel
+	{ 0x03,0x49/*, 0x04, 0x02,0x8A,0x00*/,  KEY_F20 }, //BossKey
+	{ 0x03,0x40/*, 0x04, 0x02,0x8B,0x00*/,  KEY_SLEEP }, //Sleep
+	{ 0x03,0x1F/*, 0x04, 0x02,0x8C,0x00*/,  KEY_F21 }, //Teletext     ...
+	{ 0x03,0x53/*, 0x04, 0x02,0x8D,0x00*/,  KEY_LANGUAGE }, //DVD Language ...
+	{ 0x03,0x52/*, 0x04, 0x02,0x8E,0x00*/,  KEY_SUBTITLE }, //DVD Subtitle ...
+	{ 0x03,0x00/*, 0x04, 0x02,0x8F,0x00*/,  KEY_POWER }, //Power        ...
+
 };
+int dibusb_rc_keys_num = sizeof(dibusb_rc_keys) / sizeof(dibusb_rc_keys[0]);
 EXPORT_SYMBOL(dibusb_rc_keys);
+EXPORT_SYMBOL(dibusb_rc_keys_num);
 
 int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
diff -ru src.orig/linux/drivers/media/dvb/dvb-usb/dibusb.h src/linux/drivers/media/dvb/dvb-usb/dibusb.h
--- src.orig/linux/drivers/media/dvb/dvb-usb/dibusb.h	2006-12-09 20:41:27.000000000 +0100
+++ src/linux/drivers/media/dvb/dvb-usb/dibusb.h	2007-01-12 08:37:01.000000000 +0100
@@ -124,6 +124,7 @@
 //#define DEFAULT_RC_INTERVAL 100000
 
 extern struct dvb_usb_rc_key dibusb_rc_keys[];
+extern int dibusb_rc_keys_num;
 extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *);
 extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *);
 
diff -ru src.orig/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c src/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c
--- src.orig/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c	2006-12-09 20:41:27.000000000 +0100
+++ src/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c	2007-01-17 15:34:54.000000000 +0100
@@ -188,7 +188,7 @@
 
 	.rc_interval      = DEFAULT_RC_INTERVAL,
 	.rc_key_map       = dibusb_rc_keys,
-	.rc_key_map_size  = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
+	.rc_key_map_size  = 0, /* FIXME --> VP fixed by filling in this in the module init code, using the exported variable dibusb_rc_keys_num */
 	.rc_query         = dibusb_rc_query,
 
 	.i2c_algo         = &dibusb_i2c_algo,
@@ -272,7 +272,7 @@
 
 	.rc_interval      = DEFAULT_RC_INTERVAL,
 	.rc_key_map       = dibusb_rc_keys,
-	.rc_key_map_size  = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
+	.rc_key_map_size  = 0, /* FIXME --> VP fixed by filling in this in the module init code, using the exported variable dibusb_rc_keys_num */
 	.rc_query         = dibusb_rc_query,
 
 	.i2c_algo         = &dibusb_i2c_algo,
@@ -336,7 +336,7 @@
 
 	.rc_interval      = DEFAULT_RC_INTERVAL,
 	.rc_key_map       = dibusb_rc_keys,
-	.rc_key_map_size  = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
+	.rc_key_map_size  = 0, /* FIXME --> VP fixed by filling in this in the module init code, using the exported variable dibusb_rc_keys_num */
 	.rc_query         = dibusb_rc_query,
 
 	.i2c_algo         = &dibusb_i2c_algo,
@@ -393,7 +393,7 @@
 
 	.rc_interval      = DEFAULT_RC_INTERVAL,
 	.rc_key_map       = dibusb_rc_keys,
-	.rc_key_map_size  = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
+	.rc_key_map_size  = 0, /* FIXME --> VP fixed by filling in this in the module init code, using the exported variable dibusb_rc_keys_num */
 	.rc_query         = dibusb_rc_query,
 
 	.i2c_algo         = &dibusb_i2c_algo,
@@ -424,6 +424,13 @@
 static int __init dibusb_module_init(void)
 {
 	int result;
+
+	/* VP fill in dibusb keys map size */
+	dibusb1_1_properties.rc_key_map_size = dibusb_rc_keys_num;
+	dibusb1_1_an2235_properties.rc_key_map_size = dibusb_rc_keys_num;
+	dibusb2_0b_properties.rc_key_map_size = dibusb_rc_keys_num;
+	artec_t1_usb2_properties.rc_key_map_size = dibusb_rc_keys_num;
+
 	if ((result = usb_register(&dibusb_driver))) {
 		err("usb_register failed. Error number %d",result);
 		return result;
diff -ru src.orig/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c src/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c
--- src.orig/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c	2006-12-09 20:41:27.000000000 +0100
+++ src/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c	2007-01-17 15:35:59.000000000 +0100
@@ -76,9 +76,9 @@
 	},
 	.power_ctrl       = dibusb2_0_power_ctrl,
 
	.rc_interval      = DEFAULT_RC_INTERVAL,
 	.rc_key_map       = dibusb_rc_keys,
-	.rc_key_map_size  = 111, /* FIXME */
+	.rc_key_map_size  = 0, /* FIXME --> VP fixed by filling in this in the module init code, using the exported variable dibusb_rc_keys_num */
 	.rc_query         = dibusb_rc_query,
 
 	.i2c_algo         = &dibusb_i2c_algo,
@@ -134,6 +134,10 @@
 static int __init dibusb_mc_module_init(void)
 {
 	int result;
+
+	/* VP fill in dibusb keys map size */
+	dibusb_mc_properties.rc_key_map_size = dibusb_rc_keys_num;
+
 	if ((result = usb_register(&dibusb_mc_driver))) {
 		err("usb_register failed. Error number %d",result);
 		return result;


More information about the linux-dvb mailing list