Android 驱动之 jogball 详解
2010-03-17 16:15:00 来源:WEB开发网.count = ARRAY_SIZE(hero_x_axis_gpios),
.type = EV_REL,
.code = REL_X,
.decoded_size = 1U << ARRAY_SIZE(hero_x_axis_gpios),
.map = hero_axis_map,
.gpio = hero_x_axis_gpios,
.flags = GPIOEAF_PRINT_UNKNOWN_DIRECTION /*| GPIOEAF_PRINT_RAW | GPIOEAF_PRINT_EVENT */,
.enable_emc_protect_delay = 1 * NSEC_PER_MSEC,
}
};
X轴上的info结构体的初始化
static struct hero_axis_info hero_y_axis = {
.threshold = 1,
.info = {
.info.func = gpio_event_axis_func,
.count = ARRAY_SIZE(hero_y_axis_gpios),
.type = EV_REL,
.code = REL_Y,
.decoded_size = 1U << ARRAY_SIZE(hero_y_axis_gpios),
.map = hero_axis_map,
.gpio = hero_y_axis_gpios,
.flags = GPIOEAF_PRINT_UNKNOWN_DIRECTION /*| GPIOEAF_PRINT_RAW | GPIOEAF_PRINT_EVENT */,
.enable_emc_protect_delay = 1 * NSEC_PER_MSEC,
}
};
Y轴上的info结构体的初始化
6 备注
在android的framework的代码中识别jogball设备是识别成鼠标的特性的,不仅有坐标还是由按键的,但是驱动中并没有axis中并没
有按键,所以在注册input设备的时候要加入按键的键值。如下代码:
在drivers/input/misc/gpio_axis.c中的gpio_event_axis_func函数中
as->input_dev = input_dev;
as->info = ai;
input_set_capability(input_dev, ai->type, ai->;code);
if (ai->type == EV_ABS) {
input_set_abs_params(input_dev, ai->code, 0,
ai->decoded_size - 1, 0, 0);
}
input_set_capability(input_dev, ai->type, BT_MOUSE);
本文源码是基于hero手机kernel代码
kernel_hero/arch/arm/mach-msm/board-hero.c
下载地址 http://developer.htc.com/
更多精彩
赞助商链接