[linux-dvb] [PATCH] Geniatech DVB-S remote (Digistar) patch

marek mark_kiddy at wp.pl
Mon Aug 20 10:03:55 CEST 2007


Hi
this patch works for me -  tested with Geniatech DVB-S card and bundled 
remote (DigiStar).
Keymap included

Best regards,
Marek Kidawski
---------------------------

diff -u -r 
v4l-dvb-36c97fcac2a3_1/linux/drivers/media/common/ir-keymaps.c 
v4l-dvb-36c97fcac2a3/linux/drivers/media/common/ir-keymaps.c
--- v4l-dvb-36c97fcac2a3_1/linux/drivers/media/common/ir-keymaps.c      
2007-08-18 13:22:06.000000000 +0200
+++ v4l-dvb-36c97fcac2a3/linux/drivers/media/common/ir-keymaps.c        
2007-08-18 22:45:43.000000000 +0200
@@ -33,6 +33,56 @@
 
 EXPORT_SYMBOL_GPL(ir_codes_empty);
 
+/* Marek Kidawski <mark_kiddy at wp.pl> */
+IR_KEYTAB_TYPE ir_codes_digistar[IR_KEYTAB_SIZE] = {
+       [ 0x00 ] = KEY_0,         //'0'
+       [ 0x01 ] = KEY_1,         //'1'
+       [ 0x02 ] = KEY_2,         //'2'
+       [ 0x03 ] = KEY_3,         //'3'
+       [ 0x04 ] = KEY_4,         //'4'
+       [ 0x05 ] = KEY_5,         //'5'
+       [ 0x06 ] = KEY_6,         //'6'
+       [ 0x07 ] = KEY_7,         //'7'
+       [ 0x08 ] = KEY_8,         //'8'
+       [ 0x09 ] = KEY_9,         //'9'
+
+       [ 0x0c ] = KEY_POWER,       // 'power'
+
+       [ 0x25 ] = KEY_RED,         // 'red'
+       [ 0x14 ] = KEY_BLUE,        // 'blue'
+       [ 0x0f ] = KEY_YELLOW,      // 'yellow'
+
+       [ 0x21 ] = KEY_CHANNELDOWN, // 'channel -'
+       [ 0x20 ] = KEY_CHANNELUP,   // 'channel +'
+       [ 0x11 ] = KEY_VOLUMEDOWN,  // 'volume -'
+       [ 0x10 ] = KEY_VOLUMEUP,    // 'volume +'
+
+       [ 0x1f ] = KEY_RECORD,      // 'record'
+       [ 0x16 ] = KEY_PAUSE,       // 'pause'
+       [ 0x0b ] = KEY_STOP,        // 'stop'
+       [ 0x17 ] = KEY_PLAY,        // 'play'
+       [ 0x26 ] = KEY_REWIND,      // 'backward <<'
+       [ 0x27 ] = KEY_FASTFORWARD, // 'forward >>'
+
+       [ 0x2c ] = KEY_TEXT,        // 'teletext'
+       [ 0x2b ] = KEY_LIST,        // 'source'
+       [ 0x1e ] = KEY_INFO,        // 'osd'
+       [ 0x0e ] = KEY_GREEN,       // 'window'
+
+       [ 0x12 ] = KEY_KPPLUS,      // 'bright up'
+       [ 0x13 ] = KEY_KPMINUS,     // 'bright down'
+
+       [ 0x2d ] = KEY_ZOOM,        // '???'
+
+       [ 0x0a ] = KEY_SEARCH,      // '-/--'
+       [ 0x29 ] = KEY_F1,          // '???'
+
+       [ 0x0d ] = KEY_MUTE,         // 'mute / enter'
+       [ 0x38 ] = KEY_VIDEO         // 'tv / radio'
+};
+EXPORT_SYMBOL_GPL(ir_codes_digistar);
+
+
 /* Michal Majchrowicz <mmajchrowicz at gmail.com> */
 IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE] = {
        /* numeric */
diff -u -r v4l-dvb-36c97fcac2a3_1/linux/drivers/media/video/ir-kbd-i2c.c 
v4l-dvb-36c97fcac2a3/linux/drivers/media/video/ir-kbd-i2c.c
--- v4l-dvb-36c97fcac2a3_1/linux/drivers/media/video/ir-kbd-i2c.c       
2007-08-18 13:22:06.000000000 +0200
+++ v4l-dvb-36c97fcac2a3/linux/drivers/media/video/ir-kbd-i2c.c 
2007-08-18 22:59:33.000000000 +0200
@@ -253,6 +253,41 @@
 
 EXPORT_SYMBOL_GPL(get_key_pinnacle_color);
 
+
+
+                              
+static int get_key_geniatech(struct IR_i2c *ir, u32 *ir_key, u32 
*ir_raw)                             
+{
+       unsigned char buf;
+       int code, toggle;
+
+       /* poll IR chip */
+       if (1 != i2c_master_recv(&ir->c,&buf,1))
+               return -EIO;
+
+       code = buf & 0x7f;
+       toggle = (buf >> 7) & 1;
+
+        if ( ir->old == toggle )
+           /* the same key */
+           return 0;
+
+       /* continue only if mod 2 = 1 */            
+       if ( 1 != code % 2 )
+           return 0;
+           
+       code = (code - 1) / 2;
+           
+       dprintk(1, "DigiStar key=%d\n", code);
+       ir->old  = toggle;
+
+       /* return key */
+       *ir_key = code;
+       *ir_raw = code;
+       return 1;
+}
+
+
 /* 
----------------------------------------------------------------------- */
 
 static void ir_key_poll(struct IR_i2c *ir)
@@ -400,6 +435,19 @@
                        ir_type     = IR_TYPE_OTHER;
                }
                break;
+       case 0x33:
+               /* I don't know which other cards have IR under i2c=0x33 
but my geniatech has...
+               so I comment this line to prevent compiler warning
+               if (adap->id == I2C_HW_B_CX2388x) { */
+                       /* Handled by cx88-input */
+                       name        = "DigiStar remote";
+                       ir_type     = IR_TYPE_OTHER;
+                       ir->get_key = get_key_geniatech;
+                       ir_codes    = ir_codes_digistar;
+               /*
+               }
+               */
+               break;
        default:
                /* shouldn't happen */
                printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n", 
addr);
@@ -496,7 +544,8 @@
        static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
        static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 };
        static const int probe_em28XX[] = { 0x30, 0x47, -1 };
-       static const int probe_cx88[] = { 0x18, 0x71, -1 };
+       /* added 0x33 for Geniatech DVB-S receiver */
+       static const int probe_cx88[] = { 0x18, 0x71, 0x33, -1 };
        const int *probe = NULL;
        struct i2c_client c;
        unsigned char buf;
diff -u -r v4l-dvb-36c97fcac2a3_1/linux/include/media/ir-common.h 
v4l-dvb-36c97fcac2a3/linux/include/media/ir-common.h
--- v4l-dvb-36c97fcac2a3_1/linux/include/media/ir-common.h      
2007-08-18 13:22:06.000000000 +0200
+++ v4l-dvb-36c97fcac2a3/linux/include/media/ir-common.h        
2007-08-18 20:53:00.000000000 +0200
@@ -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_digistar[IR_KEYTAB_SIZE];
 
 #endif
---------------------------------------------------




More information about the linux-dvb mailing list