Exemplo n.º 1
0
int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d,
		u8 keybuf[5], u32 *event, int *state)
{
	int i;
	struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
	*event = 0;
	*state = REMOTE_NO_KEY_PRESSED;
	switch (keybuf[0]) {
		case DVB_USB_RC_NEC_EMPTY:
			break;
		case DVB_USB_RC_NEC_KEY_PRESSED:
			if ((u8) ~keybuf[1] != keybuf[2] ||
				(u8) ~keybuf[3] != keybuf[4]) {
				deb_err("remote control checksum failed.\n");
				break;
			}
			/* See if we can match the raw key code. */
			for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
				if (rc5_custom(&keymap[i]) == keybuf[1] &&
					rc5_data(&keymap[i]) == keybuf[3]) {
					*event = keymap[i].keycode;
					*state = REMOTE_KEY_PRESSED;
					return 0;
				}
			deb_err("key mapping failed - no appropriate key found in keymapping\n");
			break;
		case DVB_USB_RC_NEC_KEY_REPEATED:
			*state = REMOTE_KEY_REPEAT;
			break;
		default:
			deb_err("unknown type of remote status: %d\n",keybuf[0]);
			break;
	}
	return 0;
}
Exemplo n.º 2
0
/* remote control stuff (does not work with my box) */
static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
	u8 *key;
	int i;

/* remove the following return to enabled remote querying */
	return 0;

	key = kmalloc(10, GFP_KERNEL);
	if (!key)
		return -ENOMEM;

	vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10);

	deb_rc("remote query key: %x %d\n",key[1],key[1]);

	if (key[1] == 0x44) {
		*state = REMOTE_NO_KEY_PRESSED;
		kfree(key);
		return 0;
	}

	for (i = 0; i < ARRAY_SIZE(rc_map_vp702x_table); i++)
		if (rc5_custom(&rc_map_vp702x_table[i]) == key[1]) {
			*state = REMOTE_KEY_PRESSED;
			*event = rc_map_vp702x_table[i].keycode;
			break;
		}
	kfree(key);
	return 0;
}
Exemplo n.º 3
0
static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
	u8 key[10];
	int i;


	return 0;

	vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10);

	deb_rc("remote query key: %x %d\n",key[1],key[1]);

	if (key[1] == 0x44) {
		*state = REMOTE_NO_KEY_PRESSED;
		return 0;
	}

	for (i = 0; i < ARRAY_SIZE(vp702x_rc_keys); i++)
		if (rc5_custom(&vp702x_rc_keys[i]) == key[1]) {
			*state = REMOTE_KEY_PRESSED;
			*event = vp702x_rc_keys[i].event;
			break;
		}
	return 0;
}
Exemplo n.º 4
0
static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
    int i;
    u8 key[5];
    u8 b[4] = { 0 };

    *event = 0;
    *state = REMOTE_NO_KEY_PRESSED;

    digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4);

    /* Tell the device we've read the remote. Not sure how necessary
       this is, but the Nebula SDK does it. */
    digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0);

    /* if something is inside the buffer, simulate key press */
    if (key[1] != 0)
    {
        for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
            if (rc5_custom(&d->props.rc.legacy.rc_map_table[i]) == key[1] &&
                    rc5_data(&d->props.rc.legacy.rc_map_table[i]) == key[2]) {
                *event = d->props.rc.legacy.rc_map_table[i].keycode;
                *state = REMOTE_KEY_PRESSED;
                return 0;
            }
        }
    }

    if (key[0] != 0)
        deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]);
    return 0;
}
Exemplo n.º 5
0
/* remote control stuff (does not work with my box) */
static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
	u8 key[10];
	int i;

/* remove the following return to enabled remote querying */
	return 0;

	vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10);

	deb_rc("remote query key: %x %d\n",key[1],key[1]);

	if (key[1] == 0x44) {
		*state = REMOTE_NO_KEY_PRESSED;
		return 0;
	}

	for (i = 0; i < ARRAY_SIZE(ir_codes_vp702x_table); i++)
		if (rc5_custom(&ir_codes_vp702x_table[i]) == key[1]) {
			*state = REMOTE_KEY_PRESSED;
			*event = ir_codes_vp702x_table[i].event;
			break;
		}
	return 0;
}
Exemplo n.º 6
0
static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
	u8 buf[] = {CMD_GET_IR_CODE};
	struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
	u8 ircode[2];
	int i, ret;

	ret = anysee_ctrl_msg(d, buf, sizeof(buf), &ircode[0], 2);
	if (ret)
		return ret;

	*event = 0;
	*state = REMOTE_NO_KEY_PRESSED;

	for (i = 0; i < d->props.rc_key_map_size; i++) {
		if (rc5_custom(&keymap[i]) == ircode[0] &&
		    rc5_data(&keymap[i]) == ircode[1]) {
			*event = keymap[i].event;
			*state = REMOTE_KEY_PRESSED;
			return 0;
		}
	}
	return 0;
}