• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : XX was terminated due to application error(11)(原帖:在qtopia里调用驱动程序的问题) 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 6476
精华: 0
发帖: 20
金钱: 195 两
威望: 96 点
综合积分: 40 分
注册时间: 2009-06-03
最后登录: 2011-04-14
楼主  发表于: 2009-09-01 10:28

 XX was terminated due to application error(11)(原帖:在qtopia里调用驱动程序的问题)

管理提醒: 本帖被 kasim 执行取消锁定操作(2009-11-04)
我是mini2440的板子,单独编译自带的examples中的led测试程序没问题,自带的arm-qtopia文件夹下有一个hello测试程序,现在我想实现这样一个功能:当我单击hello程序里的button时,led灯的第四个点亮,所以我重新修改连接button的槽如下:
void HelloForm::SayHello()
{
    MessageLabel->setText("Hello, Qtopia world!");
        int fd;
    fd = open("/dev/leds0", 0);
    if (fd < 0) {
        fd = open("/dev/leds", 0);
    }
    if (fd < 0) {
        perror("open device leds");
        exit(1);
    }
    ioctl(fd, 1, 3);
    close(fd);
}
头文件也是包含了原led测试程序的头文件,现在编译出现错误说‘open’was not declared in this scope
但ioctl和close函数却没有错误提示,这是什么原因呢?XX was terminated due to application error(11)
[ 此帖被kasim在2009-11-04 16:58重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-09-01 10:44
在Qtopia的源代码里搜索open, 看看别人是怎么写的
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 6476
精华: 0
发帖: 20
金钱: 195 两
威望: 96 点
综合积分: 40 分
注册时间: 2009-06-03
最后登录: 2011-04-14
2楼  发表于: 2009-09-01 12:14
版主的源代码指的是什么,我倒是很奇怪,网上http://www.qtcn.org/bbs/read.php?tid=17043怎么就可以,
级别: 新手上路
UID: 6476
精华: 0
发帖: 20
金钱: 195 两
威望: 96 点
综合积分: 40 分
注册时间: 2009-06-03
最后登录: 2011-04-14
3楼  发表于: 2009-09-01 12:19
难到是example里的例子是用arm-linux-gcc来编译的,所以能编译通过,换成arm-linux-g++就报错???
级别: 新手上路
UID: 6476
精华: 0
发帖: 20
金钱: 195 两
威望: 96 点
综合积分: 40 分
注册时间: 2009-06-03
最后登录: 2011-04-14
4楼  发表于: 2009-09-01 19:34
版主有这方面的例子可以发一份给我吗,我的邮箱:sunchaosq@yahoo.com.cn
级别: 侠客
UID: 5629
精华: 0
发帖: 74
金钱: 755 两
威望: 496 点
综合积分: 148 分
注册时间: 2009-05-01
最后登录: 2012-03-16
5楼  发表于: 2009-09-02 12:21
fd = open("/dev/leds0", 0);

leds0"是不是应该没有那个0啊?
级别: 新手上路
UID: 6476
精华: 0
发帖: 20
金钱: 195 两
威望: 96 点
综合积分: 40 分
注册时间: 2009-06-03
最后登录: 2011-04-14
6楼  发表于: 2009-09-02 20:36
不行啊,内核版本2.6.29,有谁能试一下上面的程序,我真找不到原因了
级别: 侠客
UID: 5629
精华: 0
发帖: 74
金钱: 755 两
威望: 496 点
综合积分: 148 分
注册时间: 2009-05-01
最后登录: 2012-03-16
7楼  发表于: 2009-09-04 08:45
fd=open("/dev/leds",O_RDWR);
      if(led_fd==-1)
         printf("open_leds error");

你看看这样行吗?
级别: 新手上路
UID: 6476
精华: 0
发帖: 20
金钱: 195 两
威望: 96 点
综合积分: 40 分
注册时间: 2009-06-03
最后登录: 2011-04-14
8楼  发表于: 2009-09-04 11:39
我的错误提示是open’was not declared in this scope
你这样改也解决不了问题啊
级别: 新手上路
UID: 6476
精华: 0
发帖: 20
金钱: 195 两
威望: 96 点
综合积分: 40 分
注册时间: 2009-06-03
最后登录: 2011-04-14
9楼  发表于: 2009-09-04 12:12
光盘里的led测试程序包含的头文件
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/ioctl.h>
这些文件是在那个文件夹下的,open(),close()函数在那个头文件里?
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go