linux 怎么判断串口是否存在,没有串口的机器也有/dev/ttyS0,也可以打开啊

jackxiang 2011-2-12 13:34 | |
请高手支招?

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

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

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 信息是怎么打出来,如何实现的。
__________________________________
个人意见,仅供参考。错了概不负责。
My blog: http://jianggmulab.blogspot.com/

欢迎访问:
集群和虚拟机版
来源:http://linux.chinaunix.net/bbs/thread-1174961-1-1.html

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/4015/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!

评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]