主题 : 在qte下如何打开驱动设备文件? 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 4876
精华: 0
发帖: 6
金钱: 60 两
威望: 60 点
综合积分: 12 分
注册时间: 2009-04-01
最后登录: 2009-05-02
楼主  发表于: 2009-04-30 21:50

 在qte下如何打开驱动设备文件?

管理提醒: 本帖被 arm9home 从 Linux技术交流专区 移动到本区(2009-09-10)
大家好!我想在我的qt程序里打开led设备文件,直接用open()吗?可是不行,这是为什么,希望高手指教!
有谁有这个的代码吗,可否贴出来共享下,不胜感激!
级别: 新手上路
UID: 4986
精华: 0
发帖: 13
金钱: 130 两
威望: 130 点
综合积分: 26 分
注册时间: 2009-04-06
最后登录: 2010-06-02
1楼  发表于: 2009-05-01 11:25
我也碰到类似的问题,顶你一下,希望有人给予解答
级别: 侠客
UID: 3501
精华: 0
发帖: 52
金钱: 530 两
威望: 530 点
综合积分: 104 分
注册时间: 2009-01-14
最后登录: 2009-06-16
2楼  发表于: 2009-05-06 11:48
我也关注这个问题
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2009-05-06 13:04
是用open(), 设备节点文件是/dev/leds
"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: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
4楼  发表于: 2009-05-06 13:05
源代码可以参考光盘或升级文件包里examples\leds目录下的led.c
"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: 3501
精华: 0
发帖: 52
金钱: 530 两
威望: 530 点
综合积分: 104 分
注册时间: 2009-01-14
最后登录: 2009-06-16
5楼  发表于: 2009-05-06 16:03

 回 4楼(kasim) 的帖子

您好,如果我想用QT读入串口数据,是不是应该先用open()打开设备节点,然后再用read(),将缓冲区内的数据读出啊?请赐教,谢谢!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2009-05-06 16:19

 Re:回 4楼(kasim) 的帖子

引用第5楼cocies于2009-05-06 16:03发表的 回 4楼(kasim) 的帖子 :
您好,如果我想用QT读入串口数据,是不是应该先用open()打开设备节点,然后再用read(),将缓冲区内的数据读出啊?请赐教,谢谢!

是的,你的问题我已经在你之前的帖子里回复了,不要再回这个帖子了。
"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: 16485
精华: 0
发帖: 32
金钱: 160 两
威望: 32 点
综合积分: 64 分
注册时间: 2010-03-18
最后登录: 2014-08-24
7楼  发表于: 2010-03-20 13:10
学习了