[linux-dvb] TwinhanDTV Cab-CI (mantis vp-2033) remote controller patch

Marko Ristola marko.ristola at kolumbus.fi
Mon Apr 23 22:19:41 CEST 2007


Hi,

I tested with VDR. VDR responded for the remote control!
I used /dev/input/eventX as a VDR remote control device.
At least the numerical buttons worked for me.

I didn't have to do almost any code changes to make it compilable and 
workable for me.
Only thing was:
ln -s /lib/modules/2.6.20-1.2944.fc6 /lib/modules/2.6.20

Great work, Slavov and Manu.

Regards,
Marko

Kristian Slavov wrote:
> ARGH.. I'm hopeless...
>
> Here's the patch.
>
>
>
> Kristian Slavov wrote:
>> Marko Ristola wrote:
>>>
>>> Hi,
>>>
>>> If I understood correctly, you intended to attach your patch into 
>>> your email.
>>> Unfortunately there was no such patch.
>>
>> Oops.
>>
>>
>>> I figured out via WWW that the remote control
>>> interface is on Mantis chip and it is an UART for applications.
>>> But that's not enough to make it work.
>>
>>
>> I had much more brute force kind of an approach. Dumped iomem while 
>> pressing keys, and figured out that the content of address 0xe8 was 
>> changing consistently. Also noticed that IRQ-1 is used to signal (at 
>> least) this event.
>>
>>
>>> Kristian Slavov wrote:
>>>> Hi all,
>>>>
>>>> I've included a patch to enable the RC receiver of the 
>>>> aforementioned dvb-c card. The patch is against Manu's repository 
>>>> [1], and includes
>>>> 2 patches from Marko (inversion [2] and gpio_set_bits [3]).
>>>>
>>>> Tested with vdr 1.4.1 and remote plugin.
>>>>
>>>> [1] http://jusst.de/manu/mantis-v4l-dvb.tar.bz2
>>>> [2] http://www.mail-archive.com/linux-dvb@linuxtv.org/msg21939.html
>>>> [3] http://www.mail-archive.com/linux-dvb@linuxtv.org/msg22459.html
>>>>
>>
>> BR,
>
>
> ------------------------------------------------------------------------
>
> diff -Naur v4l-dvb/linux/drivers/media/common/ir-keymaps.c v4l-dvb-edits/linux/drivers/media/common/ir-keymaps.c
> --- v4l-dvb/linux/drivers/media/common/ir-keymaps.c	2007-02-22 15:20:06.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/common/ir-keymaps.c	2007-04-16 19:13:57.000000000 +0300
> @@ -64,6 +64,7 @@
>  };
>  
>  EXPORT_SYMBOL_GPL(ir_codes_proteus_2309);
> +
>  /* Matt Jesson <dvb at jesson.eclipse.co.uk */
>  IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE] = {
>  	[ 0x28 ] = KEY_0,         //'0' / 'enter'
> @@ -1827,3 +1828,69 @@
>  };
>  
>  EXPORT_SYMBOL_GPL(ir_codes_tt_1500);
> +
> +/* Twinhan CAB-CI 2033 */
> +IR_KEYTAB_TYPE ir_codes_mantis_vp2033[IR_KEYTAB_SIZE] = {
> +        [ 0x29 ] = KEY_POWER,
> +        [ 0x28 ] = KEY_FAVORITES,
> +        [ 0x30 ] = KEY_TEXT,
> +        [ 0x17 ] = KEY_INFO,          // Preview 
> +        [ 0x23 ] = KEY_EPG,
> +        [ 0x3b ] = KEY_F22,           // Record List
> +
> +        [ 0x3c ] = KEY_1, 
> +        [ 0x3e ] = KEY_2,
> +        [ 0x39 ] = KEY_3,
> +        [ 0x36 ] = KEY_4,
> +        [ 0x22 ] = KEY_5,
> +        [ 0x20 ] = KEY_6,
> +        [ 0x32 ] = KEY_7,
> +        [ 0x26 ] = KEY_8,
> +        [ 0x24 ] = KEY_9,
> +        [ 0x2a ] = KEY_0,
> +
> +        [ 0x33 ] = KEY_CANCEL,
> +        [ 0x2c ] = KEY_BACK,
> +        [ 0x15 ] = KEY_CLEAR,
> +        [ 0x3f ] = KEY_TAB,
> +        [ 0x10 ] = KEY_ENTER,
> +        [ 0x14 ] = KEY_UP,
> +        [ 0x0d ] = KEY_RIGHT,
> +        [ 0x0e ] = KEY_DOWN,
> +        [ 0x11 ] = KEY_LEFT,
> +
> +        [ 0x21 ] = KEY_VOLUMEUP,
> +        [ 0x35 ] = KEY_VOLUMEDOWN,
> +        [ 0x3d ] = KEY_CHANNELDOWN,
> +        [ 0x3a ] = KEY_CHANNELUP,
> +        [ 0x2e ] = KEY_RECORD,
> +        [ 0x2b ] = KEY_PLAY,
> +        [ 0x13 ] = KEY_PAUSE,
> +        [ 0x25 ] = KEY_STOP,
> +
> +        [ 0x1f ] = KEY_REWIND,
> +        [ 0x2d ] = KEY_FASTFORWARD,
> +        [ 0x1e ] = KEY_PREVIOUS,        // Replay |<
> +        [ 0x1d ] = KEY_NEXT,            // Skip   >|
> +
> +        [ 0x0b ] = KEY_CAMERA,          // Capture
> +        [ 0x0f ] = KEY_LANGUAGE,         // SAP
> +        [ 0x18 ] = KEY_MODE,             // PIP
> +        [ 0x12 ] = KEY_ZOOM,            // Full screen,
> +        [ 0x1c ] = KEY_SUBTITLE,
> +        [ 0x2f ] = KEY_MUTE,
> +        [ 0x16 ] = KEY_F20,              // L/R,
> +        [ 0x38 ] = KEY_F21,              // Hibernate,
> +
> +        [ 0x37 ] = KEY_SWITCHVIDEOMODE, // A/V
> +        [ 0x31 ] = KEY_AGAIN,           // Recall,
> +        [ 0x1a ] = KEY_KPPLUS,          // Zoom+,
> +        [ 0x19 ] = KEY_KPMINUS,         // Zoom-,
> +        [ 0x27 ] = KEY_RED,
> +        [ 0x0C ] = KEY_GREEN,
> +        [ 0x01 ] = KEY_YELLOW,
> +        [ 0x00 ] = KEY_BLUE,
> +
> +};
> +
> +EXPORT_SYMBOL_GPL(ir_codes_mantis_vp2033);
> diff -Naur v4l-dvb/linux/drivers/media/dvb/frontends/cu1216.c v4l-dvb-edits/linux/drivers/media/dvb/frontends/cu1216.c
> --- v4l-dvb/linux/drivers/media/dvb/frontends/cu1216.c	2007-02-23 17:03:16.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/frontends/cu1216.c	2007-04-16 19:43:36.000000000 +0300
> @@ -68,7 +68,6 @@
>  
>  
>  static u32 AC_uSysClk;
> -static u8  li_Iq, li_oldIq = 0, uc_Gain, uc_oldGain = 0;
>  
>  static void  cu1216_set_symbolRate(struct dvb_frontend *fe, u16 uFreqSymb);
>  static void  cu1216_set_QAM(struct dvb_frontend *fe, u8  bQAM);
> @@ -332,7 +331,7 @@
>  	if (sync & 8)
>  		*status |= FE_HAS_LOCK;
>  
> -	 return 0;
> +        return 0;
>  #else
>  	u8  uc_Index11 = 0x0;
>  	u8  uc_Read;
> @@ -464,7 +463,7 @@
>  		break;
>  	}
>  
> -    return 0;
> +        return 0;
>  }
>  
>  
> @@ -534,6 +533,7 @@
>  	}
>  
>  	return 0;
> +
>  }
>  
>  static int cu1216_read_snr (struct dvb_frontend *fe, u16 *SNRvalue)
> @@ -800,16 +800,16 @@
>  {
>  	struct cu1216_state *state = fe->demodulator_priv;
>  
> -	u8 i;
>  	u8 QamSize = 0;
>  	u32 ErrRate[3];
> +        u8  li_Iq, li_oldIq = 0, uc_Gain, uc_oldGain = 0;
>  	fe_status_t value;
>  	int status = -EINVAL;
>  
> -	printk("[%s]:frequency = %d , symbol = %d , qam = %d .\n",
> +	printk("[%s]:frequency = %d , symbol = %d , qam = %d, inversion = %d .\n",
>  		__func__,
>  		params->frequency , params->u.qam.symbol_rate,
> -		params->u.qam.modulation);
> +		params->u.qam.modulation, params->inversion );
>  
>  	switch (params->u.qam.modulation) {
>  	case QPSK   :
> @@ -835,9 +835,6 @@
>  		break;
>  	}
>  
> -	if (li_oldIq >= 2)
> -		li_oldIq = 0;
> -
>  //	cu1216_reset(fe);
>  //	FIXME ! need to do a Bridge RESET from here
>  //	state->config->fe_reset(fe);
> @@ -862,59 +859,56 @@
>  	//Write QAM
>  	cu1216_set_QAM(fe, QamSize);
>  
> -	for (i = li_oldIq; i < li_oldIq + 2; i++) {
> -		li_Iq = i % 2;
> -
> -		for (uc_Gain = 1; uc_Gain < 4; uc_Gain++) {
> -			cu1216_set_IQ(fe, li_Iq);
> +	li_Iq = (params->inversion == INVERSION_ON)? 1:0;
>  
> -			cu1216_set_gain(fe, uc_Gain);
> -
> -			//udelay(50);
> -			delay_us_interruptible(5);
> -
> -			if (cu1216_read_status(fe, &value) == 0) {
> -
> -				li_oldIq   = li_Iq;
> -				uc_oldGain = uc_Gain;
> -				ErrRate[0] = cu1216_read_errRate(fe);
> -
> -				if (uc_Gain < 3) {
> -					cu1216_set_gain(fe, uc_Gain+1);
> -					//udelay(50);
> -					delay_us_interruptible(5);
> -					ErrRate[1] = cu1216_read_errRate(fe);
> -
> -					if (ErrRate[0] > ErrRate[1]) {
> -						cu1216_set_gain(fe , uc_Gain);
> -						//udelay(50);
> -						delay_us_interruptible(5);
> -
> -					} else {
> -						uc_oldGain = uc_Gain + 1;
> -						uc_Gain = uc_Gain + 1;
> -
> -						if (uc_Gain < 3) {
> -							cu1216_set_gain(fe, uc_Gain + 1);
> -
> -							//udelay(50);
> -							delay_us_interruptible(5);
> -							ErrRate[2] = cu1216_read_errRate(fe);
> -
> -							if (ErrRate[1] > ErrRate[2]) {
> -								cu1216_set_gain(fe , uc_oldGain);
> -
> -								//udelay(50);
> -								delay_us_interruptible(5);
> -							} else {
> -								uc_oldGain = uc_Gain + 1;
> -							}
> -						}
> -					}
> -				}
> -				goto ret;
> -			}
> -		}
> +        for (uc_Gain = 1; uc_Gain < 4; uc_Gain++) {
> +                cu1216_set_IQ(fe, li_Iq);
> +          
> +                cu1216_set_gain(fe, uc_Gain);
> +
> +                //udelay(50);
> +                delay_us_interruptible(5);
> +
> +                if (cu1216_read_status(fe, &value) == 0) {
> +                        
> +                        uc_oldGain = uc_Gain;
> +                        ErrRate[0] = cu1216_read_errRate(fe);
> +                        
> +                        if (uc_Gain < 3) {
> +                                cu1216_set_gain(fe, uc_Gain+1);
> +                                //udelay(50);
> +                                delay_us_interruptible(5);
> +                                ErrRate[1] = cu1216_read_errRate(fe);
> +                                
> +                                if (ErrRate[0] > ErrRate[1]) {
> +                                        cu1216_set_gain(fe , uc_Gain);
> +
> +                                        //udelay(50);
> +                                        delay_us_interruptible(5);
> +                                } else {
> +                                        uc_oldGain = uc_Gain + 1;
> +                                        uc_Gain = uc_Gain + 1;
> +                                        
> +                                        if (uc_Gain < 3) {
> +                                                cu1216_set_gain(fe, uc_Gain + 1);
> +                                                
> +                                                //udelay(50);
> +                                                delay_us_interruptible(5);
> +
> +                                                ErrRate[2] = cu1216_read_errRate(fe);
> +                                                if (ErrRate[1] > ErrRate[2]) {
> +                                                        cu1216_set_gain(fe , uc_oldGain);
> +                                                        
> +                                                        //udelay(50);
> +                                                        delay_us_interruptible(5);
> +                                                } else {
> +                                                        uc_oldGain = uc_Gain + 1;
> +                                                }
> +                                        }
> +                                }
> +                        }
> +                        goto ret;
> +                }
>  	}
>  
>  	status = -1;
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/Makefile v4l-dvb-edits/linux/drivers/media/dvb/mantis/Makefile
> --- v4l-dvb/linux/drivers/media/dvb/mantis/Makefile	2007-02-23 17:02:51.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/Makefile	2007-04-04 23:34:33.000000000 +0300
> @@ -1,6 +1,6 @@
>  mantis-objs = mantis_core.o mantis_dma.o mantis_pci.o mantis_i2c.o	\
>  	mantis_dvb.o mantis_vp1033.o mantis_vp1034.o mantis_vp2033.o	\
> -	mantis_vp3030.o
> +	mantis_vp3030.o mantis_rc.o
>  
>  obj-$(CONFIG_DVB_MANTIS) += mantis.o
>  
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/mantis_common.h v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_common.h
> --- v4l-dvb/linux/drivers/media/dvb/mantis/mantis_common.h	2007-02-23 18:20:05.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_common.h	2007-04-16 19:22:36.000000000 +0300
> @@ -26,6 +26,8 @@
>  #include <linux/kernel.h>
>  #include <linux/pci.h>
>  #include <linux/mutex.h>
> +#include <linux/input.h>
> +#include <media/ir-common.h>
>  
>  #include "dvbdev.h"
>  #include "dvb_demux.h"
> @@ -69,11 +71,25 @@
>  #define MANTIS_TS_204		1
>  
>  struct mantis_hwconfig {
> -	char			*model_name;
> -	char			*dev_type;
> -	u32			ts_size;
> +        char                    *model_name;
> +        char                    *dev_type;
> +        u32                     ts_size;
> +        IR_KEYTAB_TYPE          *ir_codes;
>  };
>  
> +struct mantis_ir {
> +        struct input_dev        *rc_dev;
> +        char                    rc_name[80];
> +        char                    rc_phys[80];
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
> +        struct work_struct      rc_query_work;
> +#else
> +        struct delayed_work     rc_query_work;
> +#endif
> +        u32                     ir_last_code;
> +        struct ir_input_state   ir;
> +};    
> +
>  struct mantis_pci {
>  	/*	PCI stuff		*/
>  	u16			vendor_id;
> @@ -134,6 +150,9 @@
>  
>  	 /*	A12 A13 A14		*/
>  	int			gpio_status;
> +
> +        /*       RC                     */
> +        struct mantis_ir        ir;
>  };
>  
>  extern unsigned int verbose;
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/mantis_core.c v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_core.c
> --- v4l-dvb/linux/drivers/media/dvb/mantis/mantis_core.c	2007-02-23 17:01:41.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_core.c	2007-04-05 20:44:10.000000000 +0300
> @@ -154,6 +154,10 @@
>  		dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DVB init failed");
>  		return err;
>  	}
> +        if ((err = mantis_rc_init(mantis)) < 0) {
> +                dprintk(verbose, MANTIS_DEBUG, 1, "mantis RC init failed");
> +                return err;
> +        }
>  
>  	return 0;
>  }
> @@ -172,22 +176,22 @@
>  	return 0;
>  }
>  
> +// Turn the given bit on or off.
>  void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)
>  {
> -	u32 reg;
> +	u32 currVal;
> +	u32 newVal;
>  
> -	if (value)
> -		reg = 0x0000;
> +	currVal = mmread(MANTIS_GPIF_ADDR);
> +	
> +	if ( value )
> +	  newVal = currVal | ( 1 << bitpos );
>  	else
> -		reg = 0xffff;
> -
> -	reg = (value << bitpos);
> +	  newVal = currVal & ( ~ ( 1 << bitpos ) );
>  
> -	mmwrite(mmread(MANTIS_GPIF_ADDR) | reg, MANTIS_GPIF_ADDR);
> +	mmwrite(newVal, MANTIS_GPIF_ADDR);
>  	mmwrite(0x00, MANTIS_GPIF_DOUT);
>  	udelay(100);
> -	mmwrite(mmread(MANTIS_GPIF_ADDR) | reg, MANTIS_GPIF_ADDR);
> -	mmwrite(0x00, MANTIS_GPIF_DOUT);
>  }
>  
>  
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/mantis_core.h v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_core.h
> --- v4l-dvb/linux/drivers/media/dvb/mantis/mantis_core.h	2007-02-23 17:01:44.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_core.h	2007-04-04 23:32:43.000000000 +0300
> @@ -53,6 +53,8 @@
>  extern int mantis_i2c_exit(struct mantis_pci *mantis);
>  extern int mantis_core_init(struct mantis_pci *mantis);
>  extern int mantis_core_exit(struct mantis_pci *mantis);
> +extern int mantis_rc_init(struct mantis_pci *mantis);
> +extern int mantis_rc_exit(struct mantis_pci *mantis);
>  //extern void mantis_fe_powerup(struct mantis_pci *mantis);
>  //extern void mantis_fe_powerdown(struct mantis_pci *mantis);
>  //extern void mantis_fe_reset(struct dvb_frontend *fe);
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/mantis_dvb.c v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_dvb.c
> --- v4l-dvb/linux/drivers/media/dvb/mantis/mantis_dvb.c	2007-02-23 17:36:36.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_dvb.c	2007-04-04 23:35:02.000000000 +0300
> @@ -188,6 +188,7 @@
>  	dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, &mantis->demux.dmx);
>  	tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) mantis);
>  	mantis_frontend_init(mantis);
> +
>  	return 0;
>  
>  	/*	Error conditions ..	*/
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/mantis_pci.c v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_pci.c
> --- v4l-dvb/linux/drivers/media/dvb/mantis/mantis_pci.c	2007-02-23 17:02:00.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_pci.c	2007-04-16 19:34:28.000000000 +0300
> @@ -62,13 +62,16 @@
>  	}
>  	stat = mmread(MANTIS_INT_STAT);
>  	mask = mmread(MANTIS_INT_MASK);
> +
>  	mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
>  	if (!(stat & mask))
>  		return IRQ_NONE;
>  
>  	mantis->mantis_int_stat = stat;
> -	mantis->mantis_int_mask = mask;
> -	dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask);
> +        mantis->mantis_int_mask = mask;
> +        dprintk(verbose, MANTIS_DEBUG, 0, "==== Interrupts[%08x/%08x]= [", 
> +                stat, mask);
> +
>  	if (stat & MANTIS_INT_RISCEN) {
>  		dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
>  	}
> @@ -82,8 +85,9 @@
>  		dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
>  	}
>  	if (stat & MANTIS_INT_IRQ1) {
> -		dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
> -	}
> +                mantis->ir.ir_last_code = mmread(0xe8);
> +                dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
> +        }
>  	if (stat & MANTIS_INT_OCERR) {
>  		dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
>  	}
> @@ -245,6 +249,7 @@
>  		dprintk(verbose, MANTIS_ERROR, 1, "Aeio, Mantis NULL ptr");
>  		return;
>  	}
> +        mantis_rc_exit(mantis);
>  	mantis_core_exit(mantis);
>  	dprintk(verbose, MANTIS_ERROR, 1, "Removing -->Mantis irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p",
>  		pdev->irq, mantis->latency, mantis->mantis_addr,
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/mantis_rc.c v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_rc.c
> --- v4l-dvb/linux/drivers/media/dvb/mantis/mantis_rc.c	1970-01-01 02:00:00.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_rc.c	2007-04-16 19:32:29.000000000 +0300
> @@ -0,0 +1,92 @@
> +#include <linux/bitops.h>
> +#include "mantis_common.h"
> +#include "mantis_core.h"
> +
> +#include "dmxdev.h"
> +#include "dvbdev.h"
> +#include "dvb_demux.h"
> +#include "dvb_frontend.h"
> +#include "mantis_vp1033.h"
> +#include "mantis_vp1034.h"
> +#include "mantis_vp2033.h"
> +#include "mantis_vp3030.h"
> +
> +#define POLL_FREQ (HZ/10)
> +
> +void mantis_query_rc(struct work_struct *work)
> +{
> +        struct mantis_pci *mantis =
> +                container_of(work, struct mantis_pci, ir.rc_query_work.work);
> +        struct ir_input_state *ir = &mantis->ir.ir;
> +
> +        u32 lastkey = mantis->ir.ir_last_code;
> +
> +        if (lastkey != -1) {
> +                ir_input_keydown(mantis->ir.rc_dev, ir, lastkey, 0);
> +                mantis->ir.ir_last_code = -1;
> +        } else {
> +                ir_input_nokey(mantis->ir.rc_dev, ir);
> +        }
> +        schedule_delayed_work(&mantis->ir.rc_query_work, POLL_FREQ);
> +}
> +
> +
> +int mantis_rc_init(struct mantis_pci *mantis)
> +{
> +        struct input_dev *rc_dev;
> +        struct mantis_ir *mir = &mantis->ir;
> +        struct ir_input_state *ir = &mir->ir;
> +        int i, err;
> +
> +        if (!mantis->hwconfig->ir_codes) {
> +                dprintk(verbose, MANTIS_DEBUG, 1, "No RC codes available");
> +                return 0;
> +        }
> +
> +        mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK);
> +
> +        rc_dev = input_allocate_device();
> +        if (!rc_dev) {
> +                dprintk(verbose, MANTIS_ERROR, 1, "dvb_rc_init failed");
> +                return -ENOENT;
> +        }
> +
> +        mir->rc_dev = rc_dev;
> +
> +        snprintf(mir->rc_name, sizeof(mir->rc_name), 
> +                 "Mantis %s IR Receiver", mantis->hwconfig->model_name);
> +        snprintf(mir->rc_phys, sizeof(mir->rc_phys), 
> +                 "pci-%s/ir0", pci_name(mantis->pdev));
> +
> +        rc_dev->name = mir->rc_name;
> +        rc_dev->phys = mir->rc_phys;
> +
> +        ir_input_init(rc_dev, ir, IR_TYPE_OTHER, mantis->hwconfig->ir_codes);
> +
> +        rc_dev->id.bustype = BUS_PCI;
> +        rc_dev->id.vendor  = mantis->vendor_id;
> +        rc_dev->id.product = mantis->device_id;
> +        rc_dev->id.version = 1;
> +        rc_dev->cdev.dev = &mantis->pdev->dev;
> +
> +        INIT_DELAYED_WORK(&mir->rc_query_work, mantis_query_rc);
> +
> +        err = input_register_device(rc_dev);
> +        if (err) {
> +                dprintk(verbose, MANTIS_ERROR, 1, "rc registering failed");
> +                return -ENOENT;
> +        }
> +
> +        schedule_delayed_work(&mir->rc_query_work, POLL_FREQ);
> +        return 0;
> +}
> +
> +int mantis_rc_exit(struct mantis_pci *mantis)
> +{
> +        mmwrite(mmread(MANTIS_INT_MASK) & (~MANTIS_INT_IRQ1), MANTIS_INT_MASK);
> +
> +        cancel_delayed_work(&mantis->ir.rc_query_work);
> +        input_unregister_device(mantis->ir.rc_dev);
> +        dprintk(verbose, MANTIS_DEBUG, 1, "RC unregistered");
> +        return 0;
> +}
> diff -Naur v4l-dvb/linux/drivers/media/dvb/mantis/mantis_vp2033.c v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_vp2033.c
> --- v4l-dvb/linux/drivers/media/dvb/mantis/mantis_vp2033.c	2007-02-23 17:02:28.000000000 +0200
> +++ v4l-dvb-edits/linux/drivers/media/dvb/mantis/mantis_vp2033.c	2007-04-05 18:53:35.000000000 +0300
> @@ -28,6 +28,7 @@
>  	.model_name	= MANTIS_MODEL_NAME,
>  	.dev_type	= MANTIS_DEV_TYPE,
>  	.ts_size	= MANTIS_TS_188,
> +        .ir_codes       = ir_codes_mantis_vp2033,
>  };
>  
>  struct cu1216_config philips_cu1216_config = {
> diff -Naur v4l-dvb/linux/include/media/ir-common.h v4l-dvb-edits/linux/include/media/ir-common.h
> --- v4l-dvb/linux/include/media/ir-common.h	2007-02-22 15:20:10.000000000 +0200
> +++ v4l-dvb-edits/linux/include/media/ir-common.h	2007-04-06 15:49:10.000000000 +0300
> @@ -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_mantis_vp2033[IR_KEYTAB_SIZE];
>  
>  #endif
>  
>   




More information about the linux-dvb mailing list