主题 : Qt和驱动通信出错 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 3629
精华: 0
发帖: 71
金钱: 365 两
威望: 73 点
综合积分: 142 分
注册时间: 2009-01-27
最后登录: 2020-04-08
楼主  发表于: 2011-07-29 08:11

 Qt和驱动通信出错

#include "table.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>

void Input_handler(int sig)
{
    qDebug("Receive a signal from globalmem:%d!\n",sig);
}

void Table::Myfcntl()
{
   int fd, oflags;
   struct ::sigaction action;
   fd = ::open("/dev/globalmem", O_RDWR, S_IRUSR | S_IWUSR);
    if (fd !=  - 1)
    {
    ::signal(SIGIO,Input_handler);  //error: argument of type 'void (Table::)(int)' does not match 'void (*)(int)'
     ::fcntl(fd, F_SETOWN, getpid());
     oflags = ::fcntl(fd, F_GETFL);
     ::fcntl(fd, F_SETFL, oflags | FASYNC);
     }
    else
    {
           qDebug("Open device failed.\n");
    }
}

Table::Table( )
    : QTableWidget()
{  
         setWindowTitle(tr("Table"));
}

Table::~Table()
{

}



小弟写了个串口驱动,打算用异步通知来通知QT引用程序。
下面红色处出现错误,这个引用程序已经在linux中用arm-linux-gcc生成的引用程序在6410上试过了,可以使用。但是移植到QT中就出错了,不知道该怎么处理;请高手指点,小弟感激不尽!
QQ:252501870