1. Introduction 简介
This is the Linux Serial Programming HOWTO. All about how to program communications
with other devices / computers over a serial line under Linux. Different techniques
are explained: Canonical I/O (only complete lines are transmitted/received),
asyncronous I/O, and waiting for input from multiple sources.
This is the first update to the initial release of the Linux Serial Programming HOWTO.
The primary purpose of this update is to change the author information and convert
the document to DocBook format. In terms of technical content, very little if anything
has changed at this time. Sweeping changes to the technical content aren't going to
happen overnight, but I'll work on it as much as time allows.
If you've been waiting in the wings for someone to take over this HOWTO, you've
gotten your wish. Please send me any and all feedback you have, it'd be very much
appreciated.
All examples were tested using a i386 Linux Kernel 2.0.29.
本文是为 Linux 串口程序编写的 HOWTO. 主要讨论如何在 Linux 环境下,编写串口与其它
计算机设备进行通讯的程序。 文中所谈到的技术包括: 标准的 I/O (只具备 传送/接收 线
的), 异步 I/O, 以及 等待来自多信号源输入 的程序。
本文是初始的 linux serial programming howto 的第一个升级版。主要升级了一些作者信
息,把文件转换为 DocBook 格式。就技术内容而言,几乎没什幺大的改变。大规模的技术
内容的改变是不可能一夜之间发生的,如果时间允许,我会尽量做一些工作。
如果你正在一边等着有谁来接管这份 HOWTO,那你的心愿达成了。我会感谢你发来的任何反
馈信息。
所有的示例都在 i386 Linux Kernel 2.0.29 下测试通过。
1.1. Copyright Information 版权信息
This document is copyrighted © 1997 Peter Baumann, © 2001 Gary Frerking and is
distributed under the terms of the Linux Documentation Project (LDP) license, stated below.
Unless otherwise stated, Linux HOWTO documents are copyrighted by their respective
authors. Linux HOWTO documents may be reproduced and distributed in whole or in part,
in any medium physical or electronic, as long as this copyright notice is retained
on all copies. Commercial redistribution is allowed and encouraged; however, the
author would like to be notified of any such distributions.
Linux Serial-Programming-HOWTO 的版权© 1997 归 Peter Baumann 所有,© 2001
归 Gary Frerking 所有,并且以 LDP lisence (附后)发布。
除非另做申明,Linux HOWTO 文件的版权归各自的作者所有。Linux HOWTO 文件可以完整或
部份的以实物或电子版形式复制或者发布, 只要能在所有的拷贝中保留版权申明即可。我们
鼓励允许商业的发布,不过, 如果以此形式发布的话,请告知作者。
All translations, derivative works, or aggregate works incorporating any Linux HOWTO
documents must be covered under this copyright notice. That is, you may not produce
a derivative work from a HOWTO and impose additional restrictions on its distribution.
Exceptions to these rules may be granted under certain conditions; please contact
the Linux HOWTO coordinator at the address given below.
In
short, we wish to promote dissemination of this information through as many channels
as possible. However, we do wish to retain copyright on the HOWTO documents, and
would like to be notified of any plans to redistribute the HOWTOs.
If you have any questions, please contact <linux-howto@metalab.unc.edu>
所有的翻译, 以及其它派生的工作, 或整合合并任何 Linux HOWTO 文件都必须在此版权申
明的规范下进行. 也就是说, 你不可以在从 HOWTO 所衍生的工作中, 散布的文件上附加额
外的限制条款。 除了这些规则,都可获得某种条件的授与; 请见后面的地址来联络 Linux
HOWTO 协调员。
简而言之, 我们希望尽可能得透过各种渠道来促进这份资料的流通, 不过, 我们强烈希望将
此版权宣告置于 HOWTO 的文件上, 并且希望任何想重新发布 HOWTO 的人可以通知我们一
下。
如果你有问题, 请通过 email linux-howto@metalab.unc.edu 进行联系.
1.2. Disclaimer 申明
No liability for the contents of this documents can be accepted. Use the concepts,
examples and other content at your own risk. As this is a new edition of this document,
there may be errors and inaccuracies, that may of course be damaging to your system.
Proceed with caution, and although this is highly unlikely, the author(s) do not
take any responsibility for that.
All copyrights are held by their by their respective owners, unless specifically
noted otherwise. Use of a term in this document should not be regarded as affecting
the validity of any trademark or service mark.
Naming of particular products or brands should not be seen as endorsements.
You are strongly recommended to take a backup of your system before major installation
and backups at regular intervals.
使用本文的概念,例子及其它内容的风险由您自己承担,我们对此造成的后果不负责任。
由于这是份新的文档,可能存在着错误或误差,而有可能导致对您的系统的损害。请小心操
作,虽然这是几乎不可能发生的,作者不对此承担任何责任。
除非特别标注,所有的版权归其各自的作者。使用此文档不可标住任何商标或服务标记。
特定的产品或品牌的命名不可被理解为是认可的。(晕,这一段应该请律师来翻)。
强烈推荐您在重大的安装前备份系统,并且做到定期备份。
1.3. New Versions 版本更新
As previously mentioned, not much is new in terms of technical content yet.
如前面所提到的,此版本在技术内容上较前一版本并没有什幺大的更新。
1.4. Credits 感谢
The original author thanked Mr. Strudthoff, Michael Carter, Peter Waltenberg,
Antonino Ianella, Greg Hankins, Dave Pfaltzgraff, Sean Lincolne, Michael Wiedmann,
and Adrey Bonar.
原作者感谢 Strudthoff, Michael Carter, Peter Waltenberg, Antonino Ianella, Greg
Hankins, Dave Pfaltzgraff, Sean Lincolne, Michael Wiedmann, and Adrey Bonar 诸位
先生。
1.5. Feedback 意见反馈
Feedback is most certainly welcome for this document. Without your submissions and
input, this document wouldn't exist. Please send your additions, comments and criticisms
to the following email address : <gary@frerking.org>.
非常欢迎对此文档提出反馈意见。有任何补充,评论,批评请发信到: gary@frerking.org
This is the Linux Serial Programming HOWTO. All about how to program communications
with other devices / computers over a serial line under Linux. Different techniques
are explained: Canonical I/O (only complete lines are transmitted/received),
asyncronous I/O, and waiting for input from multiple sources.
This is the first update to the initial release of the Linux Serial Programming HOWTO.
The primary purpose of this update is to change the author information and convert
the document to DocBook format. In terms of technical content, very little if anything
has changed at this time. Sweeping changes to the technical content aren't going to
happen overnight, but I'll work on it as much as time allows.
If you've been waiting in the wings for someone to take over this HOWTO, you've
gotten your wish. Please send me any and all feedback you have, it'd be very much
appreciated.
All examples were tested using a i386 Linux Kernel 2.0.29.
本文是为 Linux 串口程序编写的 HOWTO. 主要讨论如何在 Linux 环境下,编写串口与其它
计算机设备进行通讯的程序。 文中所谈到的技术包括: 标准的 I/O (只具备 传送/接收 线
的), 异步 I/O, 以及 等待来自多信号源输入 的程序。
本文是初始的 linux serial programming howto 的第一个升级版。主要升级了一些作者信
息,把文件转换为 DocBook 格式。就技术内容而言,几乎没什幺大的改变。大规模的技术
内容的改变是不可能一夜之间发生的,如果时间允许,我会尽量做一些工作。
如果你正在一边等着有谁来接管这份 HOWTO,那你的心愿达成了。我会感谢你发来的任何反
馈信息。
所有的示例都在 i386 Linux Kernel 2.0.29 下测试通过。
1.1. Copyright Information 版权信息
This document is copyrighted © 1997 Peter Baumann, © 2001 Gary Frerking and is
distributed under the terms of the Linux Documentation Project (LDP) license, stated below.
Unless otherwise stated, Linux HOWTO documents are copyrighted by their respective
authors. Linux HOWTO documents may be reproduced and distributed in whole or in part,
in any medium physical or electronic, as long as this copyright notice is retained
on all copies. Commercial redistribution is allowed and encouraged; however, the
author would like to be notified of any such distributions.
Linux Serial-Programming-HOWTO 的版权© 1997 归 Peter Baumann 所有,© 2001
归 Gary Frerking 所有,并且以 LDP lisence (附后)发布。
除非另做申明,Linux HOWTO 文件的版权归各自的作者所有。Linux HOWTO 文件可以完整或
部份的以实物或电子版形式复制或者发布, 只要能在所有的拷贝中保留版权申明即可。我们
鼓励允许商业的发布,不过, 如果以此形式发布的话,请告知作者。
All translations, derivative works, or aggregate works incorporating any Linux HOWTO
documents must be covered under this copyright notice. That is, you may not produce
a derivative work from a HOWTO and impose additional restrictions on its distribution.
Exceptions to these rules may be granted under certain conditions; please contact
the Linux HOWTO coordinator at the address given below.
In
short, we wish to promote dissemination of this information through as many channels
as possible. However, we do wish to retain copyright on the HOWTO documents, and
would like to be notified of any plans to redistribute the HOWTOs.
If you have any questions, please contact <linux-howto@metalab.unc.edu>
所有的翻译, 以及其它派生的工作, 或整合合并任何 Linux HOWTO 文件都必须在此版权申
明的规范下进行. 也就是说, 你不可以在从 HOWTO 所衍生的工作中, 散布的文件上附加额
外的限制条款。 除了这些规则,都可获得某种条件的授与; 请见后面的地址来联络 Linux
HOWTO 协调员。
简而言之, 我们希望尽可能得透过各种渠道来促进这份资料的流通, 不过, 我们强烈希望将
此版权宣告置于 HOWTO 的文件上, 并且希望任何想重新发布 HOWTO 的人可以通知我们一
下。
如果你有问题, 请通过 email linux-howto@metalab.unc.edu 进行联系.
1.2. Disclaimer 申明
No liability for the contents of this documents can be accepted. Use the concepts,
examples and other content at your own risk. As this is a new edition of this document,
there may be errors and inaccuracies, that may of course be damaging to your system.
Proceed with caution, and although this is highly unlikely, the author(s) do not
take any responsibility for that.
All copyrights are held by their by their respective owners, unless specifically
noted otherwise. Use of a term in this document should not be regarded as affecting
the validity of any trademark or service mark.
Naming of particular products or brands should not be seen as endorsements.
You are strongly recommended to take a backup of your system before major installation
and backups at regular intervals.
使用本文的概念,例子及其它内容的风险由您自己承担,我们对此造成的后果不负责任。
由于这是份新的文档,可能存在着错误或误差,而有可能导致对您的系统的损害。请小心操
作,虽然这是几乎不可能发生的,作者不对此承担任何责任。
除非特别标注,所有的版权归其各自的作者。使用此文档不可标住任何商标或服务标记。
特定的产品或品牌的命名不可被理解为是认可的。(晕,这一段应该请律师来翻)。
强烈推荐您在重大的安装前备份系统,并且做到定期备份。
1.3. New Versions 版本更新
As previously mentioned, not much is new in terms of technical content yet.
如前面所提到的,此版本在技术内容上较前一版本并没有什幺大的更新。
1.4. Credits 感谢
The original author thanked Mr. Strudthoff, Michael Carter, Peter Waltenberg,
Antonino Ianella, Greg Hankins, Dave Pfaltzgraff, Sean Lincolne, Michael Wiedmann,
and Adrey Bonar.
原作者感谢 Strudthoff, Michael Carter, Peter Waltenberg, Antonino Ianella, Greg
Hankins, Dave Pfaltzgraff, Sean Lincolne, Michael Wiedmann, and Adrey Bonar 诸位
先生。
1.5. Feedback 意见反馈
Feedback is most certainly welcome for this document. Without your submissions and
input, this document wouldn't exist. Please send your additions, comments and criticisms
to the following email address : <gary@frerking.org>.
非常欢迎对此文档提出反馈意见。有任何补充,评论,批评请发信到: gary@frerking.org