我一直在为
linux制作自己的键盘驱动程序.所以我来到这两个链接:
usbkbd.c和
atkbd.c.
现在我
混淆了这些是当前驱动键盘的实际代码.正如我所看到的那样,atkbd.c是非常血腥的并且有转换
扫描码到密钥代码.所以它应该是代码,虽然我不确定.
如果atkbd.c是代码,那么其他代码是什么?
最佳答案 这很容易检查.我们来看看usbkbd.c.
相应的Kconfig(http://lxr.free-electrons.com/source/drivers/hid/usbhid/Kconfig#L50)说:
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构建为模块,则值得检查它是否实际加载. Makefile(http://lxr.free-electrons.com/source/drivers/hid/usbhid/Makefile#L10)将目标指定为usbkbd.我们可以在lsmod的输出中通过grepping来检查它是否被加载.
相比之下,atkbd.c的Kconfig(http://lxr.free-electrons.com/source/drivers/input/keyboard/Kconfig#L69)似乎更有可能:
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.