本帖最后由 jinyi7016 于 2021-4-23 15:23 编辑
有一个Qt程序用的是触摸屏,还做个了button.ko的模块加载。
正常qt运行后,加载ko,
再运行一个小程序,读取button的
当按几次button后,Qt程序会卡死不刷新,触摸也没有用。尤其是按的速度快了,几乎快按时都会卡死,慢按时,有机率卡死。
但button的小程序还正常运行。
下面是btuuon测试的程序
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/ioctl.h>
- #include <time.h>
- #include <fcntl.h>
- #include <linux/input.h>
- int main(int argc, char **argv)
- {
- int key_state;
- int fd;
- int ret;
- int code;
- struct input_event buf;
- fd = open("/dev/input/event1", O_RDONLY);
- if (fd < 0) {
- printf("Open Gpio_Keys failed!\n");
- return -1;
- }
- printf("Open Gpio_Keys successed!\n");
- while(1) {
- ret = read(fd, &buf, sizeof(struct input_event));
- if (ret <= 0) {
- printf("read failed!\n");
- return -1;
- }
- code = buf.code;
- key_state = buf.value;
- switch(code)
- {
- case KEY_PROG1:
- code = '1';
- break;
- case KEY_PROG2:
- code = '2';
- break;
- case KEY_PROG3:
- code = '3';
- break;
- case KEY_PROG4:
- code = '4';
- break;
-
- }
- if(code != 0)
- printf("KEY_PROG_%c state= %d.\n", code, key_state);
- }
- printf("Key test finished.\n");
- close(fd);
- return 0;
- }
|