问题
前阵子使用一块新板子的开发嵌入式系统,在做界面的过程中,发现移植的根文件系统里面没有/dev/input/mice文件,虽然接了鼠标时候会生成一个event0,但mice文件的数据和event0的数据是不一样的,所以想看看能不能让系统里有支持/dev/input/mice文件。
解决过程
1、在网上搜索系统里为什么没有/dev/input/mice?,没有找到想要的答案!!! 看了一些文章后,发现大部分文章都是直接就可以使用/dev/input/mice文件,产生一个想法:会不会是编译内核时,缺少了哪些配置导致的,然后执行make menuconfig重新配置内核,按斜杠键/搜索mice,没有任何相关信息。 2、接着又在内核源码的根目录使用grep "/dev/input/mice" -rnw ./搜索到很多txt文件,从中找到一个./Documentation/input/input.txt的文件可能会有帮助。 从这个txt文件摘抄下面这段话,意思是要先加载模块,再创建设备节点,最后指定GPM 使用节点。按照命令操作,没有 gpm 命令。
2. Simple Usage
~~~~~~~~~~~~~~~
For the most usual configuration, with one USB mouse and one USB keyboard,
you'll have to load the following modules (or have them built in to the
kernel):
input
mousedev
keybdev
usbcore
uhci_hcd or ohci_hcd or ehci_hcd
usbhid
After this, the USB keyboard will work straight away, and the USB mouse
will be available as a character device on major 13, minor 63:
crw-r--r-- 1 root root 13, 63 Mar 28 22:45 mice
This device has to be created.
The commands to create it by hand are:
cd /dev
mkdir input
mknod input/mice c 13 63
After that you have to point GPM (the textmode mouse cut&paste tool) and
XFree to this device to use it - GPM should be called like:
gpm -t ps2 -m /dev/input/mice
And in X:
Section "Pointer"
Protocol "ImPS/2"
Device "/dev/input/mice"
ZAxisMapping 4 5
EndSection
When you do all of the above, you can use your USB mouse and keyboard.
3、最后尝试在内核配置中搜到mousedev,找到了有点相关的选项,发现都被关闭了。 配置这些选项打开,操作路径如下
Device Drivers --->
Input device support --->
<*> Mouse interface
配置后如下图: 重新编译成功后,烧到板子了,可以找到/dev/input/mice文件了
总结
系统里没有/dev/input/mice的原因,可能是编译内核时,没有配置加载mousedev模块,需要重新配置内核,配置路径如下:
Device Drivers --->
Input device support --->
<*> Mouse interface
有用的话,帮忙点赞收藏,支持鼓励一波 !!!( *_^ )