1

全志V853芯片 如何解决getevent运行出错,报错为“could not add watch for /dev/input...

 1 year ago
source link: https://blog.51cto.com/u_15380233/5765157
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

全志V853芯片 如何解决getevent运行出错,报错为“could not add watch for /dev/input”的问题?

精选 原创

神棍地海棠 2022-10-18 09:23:10 ©著作权

文章标签 插入图片 用户空间 内核空间 文章分类 嵌入式Linux 嵌入式 阅读数151

一、问题背景

如果系统已经注册了input设备,想要使用getevent命令去获取input事件时,发现getevent运行会报错,不能正常运行。

报错信息为:could not add watch for /dev/input, Function not implemented

如下图所示:

全志V853芯片 如何解决getevent运行出错,报错为“could not add watch for /dev/input”的问题?_插入图片

二、问题分析

通过小机端目录/dev/input/下,发现是有event*的,证明是已经注册有input设备了,有input设备getevent就可以正常运行。

通过getevent源码得知,"could not add watch"的错误是由于运行函数inotify_add_watch(),获取不到所对应的inotify的watch而产生的。

全志V853芯片 如何解决getevent运行出错,报错为“could not add watch for /dev/input”的问题?_插入图片_02

inotify是一个内核用于通知用户空间程序文件系统变化的机制,现在获取不到inotify可以判断为内核空间没有给到用户空间权限或者是接口。

内核空间是有对应的配置使能用户空间的接口的,选上该配置,即可解决问题。

全志V853芯片 如何解决getevent运行出错,报错为“could not add watch for /dev/input”的问题?_用户空间_03

PS:另外,使用cat /dev/input/event* | hexdump -C 也可以获取input事件。

  • 收藏
  • 1评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK