*** hw_hiddev.c.orig	2005-08-31 10:32:20.000000000 +1000
--- hw_hiddev.c	2005-08-31 22:55:29.000000000 +1000
***************
*** 55,66 ****
  };
  
  static int dvico_repeat_mask = 0x8000;
  
  static int pre_code_length = 32;
  static int main_code_length = 32;
  
! static unsigned int pre_code;
! static signed int main_code = 0;
  
  static int repeat_flag = 0;
  
--- 55,67 ----
  };
  
  static int dvico_repeat_mask = 0x8000;
+ static int is_dvico_mce = 0;
  
  static int pre_code_length = 32;
  static int main_code_length = 32;
  
! static ir_code pre_code = 0;
! static ir_code main_code = 0;
  
  static int repeat_flag = 0;
  
***************
*** 171,179 ****
  	 * This stuff is probably dvico specific.
  	 * I don't have any other hid devices to test...
  	 */
  	if (event.hid == 0x10046) {
! 		repeat_flag = (main_code & dvico_repeat_mask);
! 		main_code = (main_code & ~dvico_repeat_mask);
  		return decode_all(remotes);
  	}
  	/* Remotec Mediamaster specific code */
--- 172,195 ----
  	 * This stuff is probably dvico specific.
  	 * I don't have any other hid devices to test...
  	 */
+ #ifdef DEBUG
+ 	  LOGPRINTF(1, "hid: 0x%X main_code: 0x%.16llX repeat_flag: %d", event.hid,main_code,repeat_flag);
+ 	 logprintf(LOG_DEBUG, "hid: 0x%X main_code: 0x%.16llX repeat_flag: %d", event.hid,main_code,repeat_flag);
+ #endif
+ 	/* identify the difference between original dvico and dvico 'mce' as the 'mce' sends a 0x90001 hid first - which I HOPE the non-mce version doesn't! */
+ 	if (event.hid == 0x90001) {
+ 		is_dvico_mce = 1;
+ 	}
+ 	/* both dvico's then use 0x10046 for the main code */
  	if (event.hid == 0x10046) {
! 		if ( is_dvico_mce == 1 ) {
! 			pre_code = 0;
! 			repeat_flag = (event.value & dvico_repeat_mask) ? 1 : 0;
! 			main_code = event.value & (dvico_repeat_mask-1);
! 		} else {
!                 	repeat_flag = (main_code & dvico_repeat_mask);
!                 	main_code = (main_code & ~dvico_repeat_mask);
! 		}	
  		return decode_all(remotes);
  	}
  	/* Remotec Mediamaster specific code */
