• 4839阅读
  • 2回复

【提问】keypad question of qtembeded-2.3.10 [复制链接]

上一主题 下一主题
离线roy_skyx
 

只看楼主 倒序阅读 楼主  发表于: 2006-02-20
I have a keypad on my target board. and I have install the keypad device driver. and the program can work will on target board. but my qtembeded cannot get any key event.why?

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <linux/fb.h>


int main( int argc, char *argv[] )
{
    int   fd = -1 ;
    unsigned char key;
    int ret = 0;

    // Open the device
    fd = open( "/dev/keypad", O_RDONLY ) ;
    if ( -1 == fd )
    {
          printf( "Error: could not open /dev/keypad device .\n") ;
          return 1 ;
    }

    /* argument is the keypad debounce timeout in ticks */
    if(argc == 2) {
        ioctl(fd, 1, atoi(argv[1]));
    }

    do {
        ret = read(fd, &key, 1);
        if(ret)
    ----》         printf("Rcvd a key from Keypad [val : %d ]\n", key);
        sleep(1);
        ret = 0;
    }while(1);
    close( fd ) ;
    return 0 ;
}
我按任何键的时候,都有打印信息出来,而且键值不同。但是qt中按任何键,都没有反应,不知道问题出在什么地方?

qt的配置是
./configure -xplatform linux-arm-g++ -keypad-mode -depths16 -no-xft
产生config文件的的时候
选择5-全部安装,
选择no qvfb

在./configure --help 配置中还有一个选项-keypad-input,但是加上这个选项后配置不能通过。这个选项是做什么的?
[ 此贴被XChinux在2006-02-20 12:06重新编辑 ]
离线liu_ming50

只看该作者 1楼 发表于: 2006-03-07
是不是你在src/kernel/keybord_qws.cpp中没有加上你得keypad driver 啊?编译时的-keypad-input好像是一种键盘种类吧,在src/kernel/keybord_qws.cpp中支持好几种键盘,默认是pc标准键盘。好像是这样,是我自己的理解,希望对你有帮助,希望高手来解答。
离线roy_skyx

只看该作者 2楼 发表于: 2006-03-07
谢谢,这个问题已经解决,原因就是你说的,在运行程序前加上export QWS_KEYBOARD=*****就可以了。现在的新问题是键盘事件响应问题,刚发贴。
快速回复
限100 字节
 
上一个 下一个