QT Keyboard drive CPU is too high

Source: Internet
Author: User

Recently implemented QT's custom keyboard, although it can be used, but CPU occupancy is always very high, nearly 100%.

The survey can find that QT's keyboard event monitoring is implemented through Qsocketnotifier.

M_notifier = new Qsocketnotifier (M_FD, Qsocketnotifier::read, this);
Connect (M_notifier, SIGNAL (activated (int)), this, SLOT (Remotedataincoming ()));


The problem here is that the driver is always readable, causing the read function to be called all the time. The qsocketnotifier activated (int) signal is triggered based on the state returned by the drive poll function, and its driver is not included in the function.


The workaround is as follows:

Add the poll function to the drive and press the button to set the mask to mask |= Pollin | Pollrdnorm;


unsigned int s3c_key_poll (struct file *filp, struct poll_table_struct *wait)
{
	unsigned int mask = 0;
	if (Readl (gpldat))
	{
		Mask |= Pollin | Pollrdnorm;	/* Indicates that the data can be obtained
	/} return
	mask	
}

In fact, I am not familiar with the drive, encountered to solve, of course, the driving congestion and non-blocking is not quite understand, here denoted, easy to finish.

Hey, I always feel that I know too little.



~end~

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.