struct input_dev *input_pty = NULL;
reort
input_report_key(input_pty, KEY_BOOKMARKS, 1);
input_sync(input_pty);
input_report_key(input_pty, KEY_BOOKMARKS, 0);
input_sync(input_pty)
register
input_pty = input_allocate_device();
if (!input_pty)
{
printk("input_pty_signal: input dev allocate memory failed\n");
}
input_pty->name = "input_pty_signal";
input_pty->id.bustype = BUS_HOST;
__set_bit(KEY_BOOKMARKS, input_pty->keybit);
input_set_capability(input_pty, EV_KEY, KEY_BOOKMARKS);
ret = input_register_device(input_pty);
if (ret)
{ input_free_device(input_pty);
input_pty = NULL;
printk("input_pty: input_register_device failed\n");
}
用这个接口也可以单独注册按键
input_set_capability(input_pty, EV_KEY, KEY_BOOKMARKS);