Ev_rep, input_repeat_key, duplicate keyboard, gpio keyboard

Source: Internet
Author: User

[Please indicate the source of the post: blog.csdn.net/lanmanck]

The effect is similar to opening Notepad on the desktop. After you press the keyboard, you can enter it continuously.

Environment: In an embedded Linux system, the keyboard is implemented by gpio scanning and simulated as a standard keyboard. The interface is displayed in lineedit of qt4.

 

I will not talk much about the keyboard driver. Refer to the OMAP of input/keyboard.CodeIn QT, You can inherit keypressevent () to determine which key is pressed.

Pay attention to some of the following points:

1. Pay attention to anti-jitter on the keyboard

2. If you confirm that there is a keyboard, input_report_key (& va-> kb_dev, key_got, 1); then rescan. This step is very important. The rescan time is less than 33 Ms. Why? Check the input. C will know, input. c's input_repeat_key will be called once every time rep [rep_period], but if we release the buttons in the driver, input_repeat_key will not be called (this function has been judged before ).

Therefore, the scanning time must be less than rep [rep_period]. If you do not do this, you will see that you wanted to press the button once, and the result would have a few more tails.

For example, if you confirm whether the scan is still pressed ms after pressing the button, the input_repeat_key has been called several times, so there are a few more tails, so you don't just press the keyboard once.

3. Do not confuse yourself with the fixed idea of repeating the time by hand or keyboard.Program. As long as the driver specifies ev_rep, the driver upper layer will automatically start the above timer. This driver only needs to judge whether the key is raised and then input_report_key (x, x, 0!

 

Correct the error!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.