/* This routine is used to handle evdev EVIOCGKEY ioctl. If the key is not found, returns -EINVAL, otherwise, returns 0.  */
static int ir_getkeycode(struct input_dev *dev, int scancode, int *keycode)
/* This routine is used to handle evdev EVIOCGKEY ioctl. If the key is not found, returns -EINVAL, otherwise, returns 0.  */
static int ir_getkeycode(struct input_dev *dev, int scancode, int *keycode)
{
	int elem;
	struct ir_input_dev *ir_dev = input_get_drvdata(dev);
	struct ir_scancode_table *rc_tab = &ir_dev->rc_tab;
	elem = ir_seek_table(rc_tab, scancode);
	if (elem >= 0) {
		*keycode = rc_tab->scan[elem].keycode;
		return 0;
	}
	if (elem < 0 && rc_tab->size == IR_TAB_MAX_SIZE)
		return -EINVAL;
	*keycode = KEY_RESERVED;
	return 0;
}