Android Linux input发送事件不成功

lichujing 2017-05-10 11:14:14
各位大师们,如下测试按键发送模块insmod后为什么Android上层未接受到Home按键。
插入模块后UI上只是选中了一个ICON,并没有起到HOME键的作用,求大牛解惑!
static int __init test_init(void)
{
int ret;

device = input_allocate_device();
if(IS_ERR(device))
{
printk("Allocate input device error\n");
return -1;
}

ret = input_register_device(device);
if(ret < 0){
printk("Register device error\n");
return ret;
}

input_set_capability(device, EV_KEY, KEY_HOME);
printk("========Module test=========\n");

input_event(device,EV_KEY,KEY_HOME,1);
input_sync(device);
input_event(device,EV_KEY,KEY_HOME,0);
input_sync(device);
return 0;
}
module_init(test_init);

...全文
196 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

21,615

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧