嵌入式arm板子插入USB键盘,自动产生/dev/input/event4节点,
键盘按键event4有输出,但是系统应用程序相应不到按键。该怎么把event的键盘事件
上报给系统层?怎么办啊。
main() { struct input_event buf; { struct timeval time; __u16 type; __u16 code; __s32 value; } fd = open("/dev/input/event1" , O_RDWR); read(fd, buf, la);
或许可以注册虚拟输入设备:
创建输入设备:input = input_allocate_device()
注册:input_register_device(input)
上报输入事件:input_report_key(input, key, 0)
具体的方法网上有很多教程,你可以查一查
event4有输出,说明驱动没问题。如果是是android平台,需要在.kl文件中添加
key 115 VOLUME_UP
key 114 VOLUME_DOWN
等。
如果是linux平台,需要open节点,读节点等操作。