简体   繁体   English

如何在汇编中编写键输入?

[英]How to write key input in assembly?

I'm trying to make a keyboard driver for windows & linux as a project, I was looking to simulate the actual process of writing a key (meaning not using anything such as windows messages), and after move on to the waiting for input from keyboard which I found alot of tutorials for. 我试图将Windows和Linux的键盘驱动程序作为一个项目,我希望模拟编写键的实际过程(意味着不使用Windows消息之类的任何东西),然后继续等待来自我找到了很多教程的键盘。 Anyone know hot to do this for Windows & Linux? 有人知道在Windows和Linux上很热吗? (running intel proc win10 64bit & kali linux amd proc 64bit) (正在运行Intel proc Win10 64bit和Kali Linux Amd proc 64bit)

You cannot have the same driver on Windows and on Linux. Windows和Linux上不能具有相同的驱动程序。 You'll need to make two different, unrelated, programs and you have to design them differently (because Windows and Linux have different architectures for drivers). 您需要制作两个不同的,不相关的程序,并且必须设计不同的程序(因为Windows和Linux具有不同的驱动程序体系结构)。

BTW, on Linux, with a graphical desktop, a display server (such as Xorg or Wayland ) is running. 顺便说一句,在带有图形桌面的Linux上, 显示服务器 (例如XorgWayland )正在运行。 That server is the only program handling the physical keyboard. 该服务器是唯一处理物理键盘的程序。 You might consider working with it. 您可以考虑使用它。

The actual notion of keyboard driver is too broad to make a concrete sense. 键盘驱动程序的实际概念太宽泛,无法具体说明。 On Linux, you could patch the kernel, patch the display server, improve the window manager , etc... There is no need, and not much interest, in coding that stuff in assembler. 在Linux上,您可以修补内核,修补显示服务器,改进窗口管理器等。。。没有必要,也没有太多兴趣,可以用汇编程序对这些内容进行编码。

Notice that on Linux, with a graphical desktop, the keyboard layout is handled in the display server, not in kernel code (so the kernel is sending key events with keycodes close to scancodes , not characters; the Xorg server sends keyboard events with similar keycodes to eg the window manager). 请注意,在具有图形桌面的Linux上,键盘布局是在显示服务器中处理的,而不是内核代码中的处理(因此,内核发送的键事件的键代码与scancodes接近,而不是字符; Xorg服务器发送的键事件与键代码相似)例如窗口管理器)。 Read more about the X Window System protocols and architecture and eg EWMH . 阅读有关X Window系统协议和体系结构的更多信息,例如EWMH The graphical layers are very complex (both on Linux and on Windows), many millions of lines of code. 图形层非常复杂(在Linux和Windows上),包含数百万行代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM