Linux键盘驱动程序的源代码 [英] Source code of keyboard driver of linux

查看:215
本文介绍了Linux键盘驱动程序的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为Linux制作自己的键盘驱动程序.因此,我遇到了这两个链接: usbkbd.c atkbd.c .

I have been working on making my own keyboard driver for linux. So I came accross these two links: usbkbd.c and atkbd.c.

现在我是 混淆了哪些是当前驱动我的键盘的实际代码.正如我所看到的,atkbd.c非常脏,并且有一个转换 扫描码到键码.尽管我不确定,它应该是代码.

Now I am confused which of these is the actual code driving my keyboard at the present. As I see it atkbd.c is quite gory and there is a conversion of scancodes to keycodes. So it should be the code, though I am not sure.

如果atkbd.c是代码,那么其他代码又是什么呢?

If atkbd.c is the code, then what is the other code for?

推荐答案

这很容易检查.让我们以usbkbd.c.

This is easy to check. Let's take usbkbd.c.

相应的Kconfig( http://lxr.free- electronics.com/source/drivers/hid/usbhid/Kconfig#L50 )说:

The corresponding Kconfig (http://lxr.free-electrons.com/source/drivers/hid/usbhid/Kconfig#L50) says:

仅在绝对确定您不想使用时,才在此处说Y USB键盘的通用HID驱动程序,喜欢使用 键盘只能在其受限的启动协议模式下使用.

Say Y here only if you are absolutely sure that you don't want to use the generic HID driver for your USB keyboard and prefer to use the keyboard in its limited Boot Protocol mode instead.

几乎可以肯定这不是您想要的.这主要用于 嵌入式应用程序或简单的键盘.

This is almost certainly not what you want. This is mostly useful for embedded applications or simple keyboards.

因此,似乎不太可能成为我们正在寻找的键盘驱动程序.还要检查当前的内核配置是否为USB_KBD.可以在/boot目录下或通过运行zcat /proc/config.gz找到该配置.如果不存在USB_KBD,则说明您未使用它.如果usbkbd.c是作为模块构建的,则值得检查它是否已实际加载.生成文件( http://lxr.free-electrons.com/source /drivers/hid/usbhid/Makefile#L10 )将目标指定为usbkbd.我们可以在lsmod的输出中通过grepping检查它是否已加载.

So it looks unlikely to be the keyboard driver we are looking for. Also check current kernel config for USB_KBD. The config can be found under /boot directory or by running zcat /proc/config.gz. If USB_KBD is not there, you're not using it. If usbkbd.c is built as module, then will be worth checking if it is actually loaded. Makefile (http://lxr.free-electrons.com/source/drivers/hid/usbhid/Makefile#L10) gives the target as usbkbd. We can check if it is loaded by grepping for it in output of lsmod.

相反,Kconfig( http://lxr.free -kb.c的-electrons.com/source/drivers/input/keyboard/Kconfig#L69 )似乎更有可能:

In contrast, Kconfig (http://lxr.free-electrons.com/source/drivers/input/keyboard/Kconfig#L69) for atkbd.c seem much more likely:

如果要使用标准AT或PS/2键盘,请在这里说Y.通常 除非您使用其他类型的键盘(USB,ADB 或其他).这也适用于通过以下方式连接的AT和PS/2键盘: PS/2到串行转换器.如果不确定,请说"Y".

Say Y here if you want to use a standard AT or PS/2 keyboard. Usually you'll need this, unless you have a different type keyboard (USB, ADB or other). This also works for AT and PS/2 keyboards connected over a PS/2 to serial converter. If unsure, say Y.

还要检查内核配置中的KEYBOARD_ATKBD.如果是Y,则表示正在使用它.如果为M,请检查lsmod的输出是否为atkbd.

Also check kernel config for KEYBOARD_ATKBD. If it is Y, you know it is being used. If it's M, check output of lsmod for atkbd.

这篇关于Linux键盘驱动程序的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆