免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2536 | 回复: 1
打印 上一主题 下一主题

linux 怎么判断串口是否存在 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-11-30 15:42 |只看该作者 |倒序浏览
本帖最后由 donotgiveup 于 2010-12-01 21:08 编辑

请高手支招?

没有串口的机器也有/dev/ttyS0,也可以打开啊...

有没有人碰到过类似的问题,串口也是一种外设,intel的cpu是不会自带的.
PC上是接哪个总线呢?

论坛徽章:
0
2 [报告]
发表于 2010-12-02 08:10 |只看该作者
http://linux.koolsolutions.com/2 ... under-debian-linux/

Check if Linux detects your Serial Port or not

There are many ways to do that. One way you could do is to give the following command:
# dmesg | grep ttyS

You should see something like this:
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:0a: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

The above output shows that your COM1 and COM2 ports are available and Linux recognizes them.

Another way to test is to give the following command:
# ls > /dev/ttyS0

If the command does not return any error message then your Serial Ports are recognized by your Linux system.

可以搜下那个DMESG 信息是怎么打出来,如何实现的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP