Esempio n. 1
0
static void
ir_decode(void)
{
#if IR_RC5_SUPPORT == 1
	rc5_decode();
#endif
#if IR_RC6_SUPPORT == 1
	rc6_decode();
#endif
#if IR_NEC_SUPPORT == 1
	nec_decode();
#endif
#if IR_JVC_SUPPORT == 1
	jvc_decode();
#endif
#if IR_SONY_SUPPORT == 1
	sony_decode();
#endif
#if IR_SHARP_SUPPORT == 1
	sharp_decode();
#endif
#if IR_PACE_SUPPORT == 1
	pace_decode();
#endif
}
Esempio n. 2
0
static void bttv_rc5_timer_end(unsigned long data)
{
	struct bttv_ir *ir = (struct bttv_ir *)data;
	struct timeval tv;
	unsigned long current_jiffies, timeout;
	u32 gap;

	/* get time */
	current_jiffies = jiffies;
	do_gettimeofday(&tv);

	/* avoid overflow with gap >1s */
	if (tv.tv_sec - ir->base_time.tv_sec > 1) {
		gap = 200000;
	} else {
		gap = 1000000 * (tv.tv_sec - ir->base_time.tv_sec) +
		    tv.tv_usec - ir->base_time.tv_usec;
	}

	/* Allow some timmer jitter (RC5 is ~24ms anyway so this is ok) */
	if (gap < 28000) {
		dprintk(KERN_WARNING "spurious timer_end\n");
		return;
	}

	ir->active = 0;
	if (ir->last_bit < 20) {
		/* ignore spurious codes (caused by light/other remotes) */
		dprintk(KERN_WARNING "short code: %x\n", ir->code);
	} else {
		u32 rc5 = rc5_decode(ir->code);

		/* two start bits? */
		if (RC5_START(rc5) != 3) {
			dprintk(KERN_WARNING "rc5 start bits invalid: %u\n", RC5_START(rc5));

			/* right address? */
		} else if (RC5_ADDR(rc5) == 0x0) {
			u32 toggle = RC5_TOGGLE(rc5);
			u32 instr = RC5_INSTR(rc5);

			/* Good code, decide if repeat/repress */
			if (toggle != RC5_TOGGLE(ir->last_rc5) ||
			    instr != RC5_INSTR(ir->last_rc5)) {
				dprintk(KERN_WARNING "instruction %x, toggle %x\n", instr,
					toggle);
				ir_input_nokey(ir->dev, &ir->ir);
				ir_input_keydown(ir->dev, &ir->ir, instr,
						 instr);
			}

			/* Set/reset key-up timer */
			timeout = current_jiffies + (500 + rc5_key_timeout
						     * HZ) / 1000;
			mod_timer(&ir->timer_keyup, timeout);

			/* Save code for repeat test */
			ir->last_rc5 = rc5;
		}
	}
}