Home  >  Article  >  What is the difference between keyboard interface ps2 and usb interface

What is the difference between keyboard interface ps2 and usb interface

coldplay.xixi
coldplay.xixiOriginal
2020-10-30 09:22:2013713browse

The difference between keyboard interface ps2 and usb interface: 1. A data packet of USB keyboard has only 8 bytes, 2 bytes mark the status, and the remaining 6 bytes are used to record the current press or pop-up Scan code of the key that is activated; 2. PS2 will report whatever is pressed and whatever is popped up. If 10 keys are pressed at the same time, it will be reported 10 times in sequence.

What is the difference between keyboard interface ps2 and usb interface

The difference between keyboard interface ps2 and usb interface:

Simply put: a data packet of USB keyboard only 8 bytes (why there are only 8? This is because the protocol stipulates this. The reason why the protocol stipulates this is because the USB speed was slow in the early days, and the maximum number of packets transmitted using interrupts was 8 bytes), of which 2 bytes mark the status. , the remaining 6 bytes are used to record the scan code of the currently pressed or popped-up button, so the USB keyboard can describe the status of up to 6 buttons at the same time.

This deceptive design specification of the USB keyboard results in that it can only achieve up to 6 keys without rollover. To solve this problem, the USB keyboard specifications must be redesigned, but I guess no one is willing to do this, because this thing works well, and most people will not press 6 keys at the same time.

As for the PS/2 keyboard, this specification is not used. PS/2 is: report whatever is pressed, and report whatever is popped up. If 10 keys are pressed at the same time, 10 will be reported in sequence. There is no protocol limit on how many key press events can be recorded at the same time. It depends on the operating system itself. Therefore, the PS/2 keyboard can theoretically achieve unlimited key presses without rollover.

Of course, some people have indeed seen USB keyboards break the 6-key limit. One of the possible reasons is: the USB device built into this keyboard is a multiple keyboard USB HUB, because USB allows multi-level Device connection, so you can break the 6 limit.

Of course, it is also a solution to bring the USB keyboard's own driver, because although the interrupt transmission only has 6 bytes, the Bulk transmission can transmit 256 bytes without any problem. (Note: I searched on Baidu myself and found that although many manufacturers have implemented USB full-key rollover, there seem to be a lot of bugs. It seems that the technology still needs to be developed.) In short, the specifications are the specifications, and there are always those that are not restricted by the specifications. Method.

Related free recommendations: Programming video course

The above is the detailed content of What is the difference between keyboard interface ps2 and usb interface. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is twrpNext article:what is twrp