[mythtv-users] Dvico MCE style remote + LIRC?

Buzz buzz at oska.com
Mon Aug 29 12:38:28 UTC 2005


All,
Attached (and below) is a diff (to the current lirc CVS codebase 0.7.3-CVS )
that gets the 'DViCO Fusion Remote MCE'  Remote control working fully
(different to the original DViCO remote).  Thanks to Andrew Speer
[mailto:andrew.speer at isolutions.com.au] for the original hack/patch that I
based this on.

If anyone on the lirc list is listening... Can this be included in the
distribution?


To make it work:
1) Check out the current lirc CVS code:
 cd ~
 cvs -d:pserver:anonymous at cvs.sourceforge.net:/cvsroot/lirc login
 cvs -z8 -d:pserver:anonymous at cvs.sourceforge.net:/cvsroot/lirc co lirc
 cd lirc

2) apply the attached patch :
 cd ~/lirc
 patch -p1 < ~/dvico_mce.diff

3) build lirc:
 cd ~/lirc
 ./autogen.sh
 ./setup.sh 
 # when prompted: 
 #	choose 1(driver configuration)->
 #	8(USB devices)->
 #	DViCO Fusion Remote MCE->OK->
 #	3(Save config and run configure)-> OK
 make
 make install
 
4) test lircd with:
 lircd -n --device=/dev/hiddev0 
 # (or wherever your linux puts the usb device it assigned to it, maybe
/dev/usb/hiddev0 )
 irw

5) any problems, PLEASE contact me! If you try it and it works, I'm
interested too!.

Good Luck,
David Bussenschutt.


PS: Sorry for the cross-post, but I'm posting this to the lirc list as it's
a patch to their code-base, AND posting to the myth-users list as that list
seems to have more Fusion/MCE related traffic and interest.

----------------------------------------------------------------------------
-----------------

diff --exclude=CVS -c -rN lirc/configure.in lirc-dvico_mce_new/configure.in
*** lirc/configure.in	2005-08-29 22:25:20.000000000 +1000
--- lirc-dvico_mce_new/configure.in	2005-08-29 21:40:29.000000000 +1000
***************
*** 141,146 ****
--- 141,147 ----
  	(bw6130) \
  	(creative) \
  	(dvico) \
+ 	(dvico_mce) \
  	(ea65) \
  	(exaudio) \
  	(irreal) \
***************
*** 244,249 ****
--- 245,256 ----
    possible_drivers="${possible_drivers} (devinput)"
    ]
  )
+ dnl dvico_mce driver requires linux input device api
+ AC_CHECK_HEADERS(linux/input.h,[
+   AC_DEFINE(HAVE_LINUX_DEVINPUT)
+   possible_drivers="${possible_drivers} (dvico_mce)"
+   ]
+ )
  dnl dsp driver requires linux soundcard api
  AC_CHECK_HEADERS(sys/soundcard.h,[
    AC_DEFINE(HAVE_SOUNDCARD)
***************
*** 261,268 ****
                            bestbuy2, breakoutbox, bte, bw6130, caraca,
                            chronos, cmdir, comX, cph06x, creative,
                            creative_infracd, devinput, digimatrix, dsp,
!                           dvico, ea65, exaudio, flyvideo, gvbctv5pci,
!                           hauppauge, hauppauge_dvb,
                            hercules_smarttv_stereo, igorplugusb, imon,
                            imon_pad, imon_rsc, irdeo, irdeo_remote,
                            irman, irreal, it87, knc_one, kworld,
--- 268,275 ----
                            bestbuy2, breakoutbox, bte, bw6130, caraca,
                            chronos, cmdir, comX, cph06x, creative,
                            creative_infracd, devinput, digimatrix, dsp,
!                           dvico, dvico_mce, ea65, exaudio, flyvideo,
!                           gvbctv5pci, hauppauge, hauppauge_dvb,
                            hercules_smarttv_stereo, igorplugusb, imon,
                            imon_pad, imon_rsc, irdeo, irdeo_remote,
                            irman, irreal, it87, knc_one, kworld,
***************
*** 352,357 ****
--- 359,367 ----
  	dvico)
  		hw_module="${hw_module} hw_hiddev.o"
  		;;
+ 	dvico_mce)
+ 		hw_module="${hw_module} hw_dvico_mce.o"
+ 		;;
  	ea65)
  		hw_module="${hw_module} hw_ea65.o serial.o"
  		;;
***************
*** 665,670 ****
--- 675,687 ----
    lircd_conf="dvico/lircd.conf.fusionHDTV"
  fi
  
+ if test "$driver" = "dvico_mce"; then
+   lirc_driver="none"
+   hw_module="hw_dvico_mce.o"
+   HW_DEFAULT="hw_dvico_mce"
+   lircd_conf="dvico/lircd.conf.fusion_dvico_mce"
+ fi
+ 
  if test "$driver" = "ea65"; then
    lirc_driver="none"
    hw_module="hw_ea65.o  serial.o"
diff --exclude=CVS -c -rN lirc/daemons/hw_dvico_mce.c
lirc-dvico_mce_new/daemons/hw_dvico_mce.c
*** lirc/daemons/hw_dvico_mce.c	1970-01-01 10:00:00.000000000 +1000
--- lirc-dvico_mce_new/daemons/hw_dvico_mce.c	2005-08-29
20:58:14.000000000 +1000
***************
*** 0 ****
--- 1,137 ----
+
/***************************************************************************
*
+  ** hw_dvico_mce.c
***********************************************************
+
****************************************************************************
+  *
+  * receive Fusion MCE Remote keycodes input via /dev/hiddev0
+  * (code is based on hw_devinput.c )
+  * 
+  * Copyright (C) 2002 Oliver Endriss <o.endriss at gmx.de> 
+  *				- devinput.
+  * Copyright (C) 2005 Andrew Speer <andrew.speer at isolutions.com.au> 
+  *				- original patch against devinput.c
+  * Copyright (c) 2005 David Bussenschutt <buzz at oska.com>
+  *				-this file, and integration to lirc codebase
+  *
+  * Distribute under GPL version 2 or later.
+  *
+  */
+ 
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+ 
+ #include <stdio.h>
+ #include <sys/fcntl.h>
+ 
+ #include <linux/input.h>
+ 
+ #include "hardware.h"
+ #include "ir_remote.h"
+ #include "lircd.h"
+ #include "receive.h"
+ 
+ 
+ static int dvico_mce_init();
+ static int dvico_mce_deinit(void);
+ static int dvico_mce_decode(struct ir_remote *remote,
+ 			   ir_code *prep, ir_code *codep, ir_code *postp,
+ 			   int *repeat_flagp, lirc_t *remaining_gapp);
+ static char *dvico_mce_rec(struct ir_remote *remotes);
+ 
+ struct hardware hw_dvico_mce=
+ {
+ 	"/dev/hiddev0",		/* "device" */
+ 	-1,			/* fd (device) */
+ 	LIRC_CAN_REC_LIRCCODE,	/* features */
+ 	0,			/* send_mode */
+ 	LIRC_MODE_LIRCCODE,	/* rec_mode */
+ 	32,			/* code_length */
+ 	dvico_mce_init,		/* init_func */
+ 	NULL,			/* config_func */
+ 	dvico_mce_deinit,	/* deinit_func */
+ 	NULL,			/* send_func */
+ 	dvico_mce_rec,		/* rec_func */
+ 	dvico_mce_decode,	/* decode_func */
+ 	NULL,                   /* ioctl_func */
+ 	NULL,			/* readdata */
+ 	"fusion_mce"
+ };
+ 
+ static ir_code code;
+ static int repeat_flag=0;
+ 
+ int dvico_mce_init()
+ {
+ 	logprintf(LOG_INFO, "initializing '%s'", hw.device);
+ 	
+ 	if ((hw.fd = open(hw.device, O_RDONLY)) < 0) {
+ 		logprintf(LOG_ERR, "unable to open '%s'", hw.device);
+ 		return 0;
+ 	}
+ 	
+ #ifdef EVIOCGRAB
+ 	if (ioctl(hw.fd, EVIOCGRAB, 1) == -1)
+ 	{
+ 		logprintf(LOG_WARNING, "can't get exclusive access to events
"
+ 			  "comming from `%s' interface",
+ 			  hw.device);
+ 	}
+ #endif
+ 			
+ 	return 1;
+ }
+ 
+ 
+ int dvico_mce_deinit(void)
+ {
+ 	logprintf(LOG_INFO, "closing '%s'", hw.device);
+ 	close(hw.fd);
+ 	hw.fd=-1;
+ 	return 1;
+ }
+ 
+ 
+ int dvico_mce_decode(struct ir_remote *remote,
+ 		    ir_code *prep, ir_code *codep, ir_code *postp,
+ 		    int *repeat_flagp, lirc_t *remaining_gapp)
+ {
+ 	logprintf(LOG_DEBUG, "dvico_mce_decode");
+ 
+         if(!map_code(remote,prep,codep,postp,
+                      0,0,hw_dvico_mce.code_length,code,0,0))
+         {
+                 return(0);
+         }
+ 	
+ 	*repeat_flagp = repeat_flag;
+ 	*remaining_gapp = 0;
+ 	
+ 	return 1;
+ }
+ 
+ 
+ char *dvico_mce_rec(struct ir_remote *remotes)
+ {
+ 	struct input_event event;
+ 	int rd;
+ 
+ 
+ 	logprintf(LOG_DEBUG, "dvico_mce_rec");
+ 	
+ 	rd = read(hw.fd, &event, sizeof event);
+ 	if (rd != sizeof event) {
+ 		logprintf(LOG_ERR, "error reading '%s'", hw.device);
+ 		return 0;
+ 	}
+ 
+ 	logprintf(LOG_DEBUG, "time %ld.%06ld  type %d  code %d  value %d",
+ 		event.time.tv_sec, event.time.tv_usec,
+ 		event.type, event.code, event.value);
+ 	
+ 	code = event.value & 0x7fff;
+ 	repeat_flag = (event.value & 0x8000) ? 1 : 0;
+ 
+ 	logprintf(LOG_DEBUG, "code %.8llx", code);
+ 
+ 	return decode_all(remotes);
+ }
diff --exclude=CVS -c -rN lirc/daemons/hw-types.c
lirc-dvico_mce_new/daemons/hw-types.c
*** lirc/daemons/hw-types.c	2005-08-29 22:25:23.000000000 +1000
--- lirc-dvico_mce_new/daemons/hw-types.c	2005-08-29
19:58:02.000000000 +1000
***************
*** 18,23 ****
--- 18,24 ----
  extern struct hardware hw_devinput;
  extern struct hardware hw_dsp;
  extern struct hardware hw_dvico;
+ extern struct hardware hw_dvico_mce;
  extern struct hardware hw_ea65;
  extern struct hardware hw_irman;
  extern struct hardware hw_livedrive_midi;
***************
*** 90,95 ****
--- 91,97 ----
  	&hw_dsp,
  #endif
  	&hw_dvico,
+ 	&hw_dvico_mce,
  	&hw_ea65,
  #ifdef HAVE_LIBIRMAN
  	&hw_irman,
diff --exclude=CVS -c -rN lirc/daemons/Makefile.am
lirc-dvico_mce_new/daemons/Makefile.am
*** lirc/daemons/Makefile.am	2005-08-29 22:26:51.000000000 +1000
--- lirc-dvico_mce_new/daemons/Makefile.am	2005-08-29
20:05:52.000000000 +1000
***************
*** 26,31 ****
--- 26,32 ----
  			hw_default.c hw_default.h \
  			hw_devinput.c \
  			hw_dsp.c \
+ 			hw_dvico_mce.c \
  			hw_ea65.c hw_ea65.h \
  			hw_hiddev.c \
  			hw_irman.c hw_irman.h \
diff --exclude=CVS -c -rN lirc/remotes/dvico/lircd.conf.fusion_dvico_mce
lirc-dvico_mce_new/remotes/dvico/lircd.conf.fusion_dvico_mce
*** lirc/remotes/dvico/lircd.conf.fusion_dvico_mce	1970-01-01
10:00:00.000000000 +1000
--- lirc-dvico_mce_new/remotes/dvico/lircd.conf.fusion_dvico_mce
2005-08-29 19:50:06.000000000 +1000
***************
*** 0 ****
--- 1,77 ----
+ # this config file was automatically generated
+ # using lirc-0.7.0(dvico) on Sat Jun 18 00:56:01 2005
+ #
+ # contributed by anonymous
+ #
+ # brand:                       DVICO
+ # model no. of remote control: MCE Remote
+ #
+ 
+ begin remote
+ 
+   name           DVICO
+   bits           32
+   eps            30
+   aeps          100
+ 
+   one             0     0
+   zero            0     0
+   pre_data_bits   0
+   pre_data        0x0
+   post_data_bits  0
+   post_data       0x0
+   gap          	  195956
+   toggle_bit      0
+ 
+ 
+       begin codes
+           ok                       0x0000000000005EFE
+           dtv                      0x00000000000002FE
+           mp3                      0x0000000000000EFE
+           dvd                      0x0000000000001AFE
+           cpf                      0x0000000000001EFE
+           setup                    0x00000000000016FE
+           tv_onoff                 0x00000000000046FE
+           guide                    0x0000000000000AFE
+           back                     0x00000000000049FE
+           more                     0x00000000000059FE
+           dvd_menu                 0x0000000000004DFE
+           alt_tab                  0x00000000000055FE
+           replay                   0x0000000000000FFE
+           skip                     0x00000000000012FE
+           up                       0x00000000000051FE
+           down                     0x00000000000053FE
+           left                     0x0000000000005BFE
+           right                    0x0000000000005FFE
+           start                    0x00000000000042FE
+           vol_up                   0x00000000000015FE
+           vol_down                 0x00000000000005FE
+           ch_up                    0x00000000000011FE
+           ch_down                  0x00000000000009FE
+           snapshot                 0x00000000000052FE
+           live                     0x0000000000005AFE
+           folder_open              0x00000000000019FE
+           1                        0x0000000000000BFE
+           2                        0x00000000000017FE
+           3                        0x0000000000001BFE
+           4                        0x00000000000007FE
+           5                        0x00000000000050FE
+           6                        0x00000000000054FE
+           7                        0x00000000000048FE
+           8                        0x0000000000004CFE
+           9                        0x00000000000058FE
+           0                        0x00000000000003FE
+           aspect                   0x00000000000013FE
+           fullscreen               0x0000000000001FFE
+           rewind                   0x00000000000043FE
+           playpause                0x00000000000047FE
+           fastforward              0x0000000000004FFE
+           stop                     0x0000000000000DFE
+           mute                     0x00000000000057FE
+           record                   0x00000000000001FE
+ 	  white_onoff              0x0000000000004EFE
+       end codes
+ 
+ end remote
+ 
+ 
diff --exclude=CVS -c -rN lirc/setup.data lirc-dvico_mce_new/setup.data
*** lirc/setup.data	2005-08-29 22:25:23.000000000 +1000
--- lirc-dvico_mce_new/setup.data	2005-08-29 20:00:22.000000000 +1000
***************
*** 108,113 ****
--- 108,114 ----
  	cmdir: "COMMANDIR USB Transceiver"
  	sasem: "Dign HV5 HTPC IR/VFD Module"
  	dvico: "DViCO USB Remote"
+ 	dvico_mce: "DViCO Fusion Remote MCE"
  	tira: "Home Electronics Tira USB device"
  	igorplugusb: "Igor Cesko's USB IR Receiver"
  	pcmak_usb: "PCMAK USB receiver"
***************
*** 183,188 ****
--- 184,190 ----
  	digimatrix \
  	dsp \
  	dvico \
+ 	dvico_mce \
  	exaudio \
  	flyvideo \
  	gvbctv5pci \
***************
*** 241,246 ****
--- 243,249 ----
  	digimatrix \
  	dsp \
  	dvico \
+ 	dvico_mce \
  	exaudio \
  	flyvideo \
  	gvbctv5pci \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dvico_mce.diff
Type: application/octet-stream
Size: 11754 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20050829/daa8a5c3/dvico_mce.obj


More information about the mythtv-users mailing list