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重新编辑 ]