{"id":59762,"date":"2022-05-22T05:42:01","date_gmt":"2022-05-21T21:42:01","guid":{"rendered":"http:\/\/www.idc.net\/help\/59762\/"},"modified":"2022-05-22T05:42:01","modified_gmt":"2022-05-21T21:42:01","slug":"linux%e4%b8%8b%e6%9f%a5%e7%9c%8b%e4%b8%b2%e5%8f%a3%e7%8a%b6%e6%80%81%ef%bc%9a%e5%bf%ab%e9%80%9f%e6%8e%8c%e6%8f%a1%e8%a6%81%e7%82%b9%ef%bc%88linux%e4%b8%8b%e6%9f%a5%e7%9c%8b%e4%b8%b2%e5%8f%a3%ef%bc%89","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/59762\/","title":{"rendered":"Linux\u4e0b\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff1a\u5feb\u901f\u638c\u63e1\u8981\u70b9\uff08linux\u4e0b\u67e5\u770b\u4e32\u53e3\uff09"},"content":{"rendered":"<p>Linux\u7cfb\u7edf\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u4e32\u53e3\u7ba1\u7406\u529f\u80fd\uff0c\u53ef\u4ee5\u7528\u6765\u5e2e\u52a9\u6211\u4eec\u5feb\u901f\u67e5\u770b\u4e32\u53e3\u72b6\u6001\u3002\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff0c\u8fd9\u91cc\u63d0\u4f9b\u6240\u9700\u8981\u7684\u64cd\u4f5c\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p>### \u4e00\u3001\u4f7f\u7528dmesg\u547d\u4ee4\u67e5\u770b\u4e32\u53e3<\/p>\n<\/p>\n<p>\u9996\u5148\uff0c\u767b\u5f55Linux\u7cfb\u7edf\uff0c\u4f7f\u7528`dmesg`\u547d\u4ee4\u67e5\u770b\u4e32\u53e3\u4fe1\u606f\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a <\/p>\n<\/p>\n<p>\u201c`shell<\/p>\n<p>sudo dmesg | grep tty<\/p>\n<pre><br>\u6267\u884c\u4ee5\u4e0a\u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u770b\u5230\u6709\u5173\u4e32\u53e3\u7684\u4fe1\u606f\uff0c\u5982\u4e0b\uff1a<br><br><\/pre>\n<p>[ 1.538379] serial8250: ttyS0 at I\/O 0x3f8 (irq = 4, base_baud = 115200)<\/p>\n<p>[ 1.541287] serial8250: ttyS1 at I\/O 0x2f8 (irq = 3, base_baud = 115200)<\/p>\n<pre><br>\u5176\u4e2d`ttyS0`\u4e0e`ttyS1`\u5206\u522b\u662f\u4e24\u4e2a\u4e32\u53e3\u8bbe\u5907\uff0c\u6839\u636e\u8bbe\u5907\u53f7\uff0c\u53ef\u67e5\u770b\u6bcf\u4e2a\u4e32\u53e3\u7684\u5185\u5bb9\uff0c\u5982\u4e0b\uff1a<br><br>```shell<br>sudo dmesg | grep ttyS0<br>sudo dmesg | grep ttyS1<br><\/pre>\n<\/p>\n<p>### \u4e8c\u3001\u4f7f\u7528 `ls -l \/dev\/tty*` \u67e5\u770b\u4e32\u53e3<\/p>\n<\/p>\n<p>\u7b2c\u4e8c\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u4f7f\u7528`ls -l \/dev\/tty*`\u547d\u4ee4\uff0c\u67e5\u770bLinux\u7cfb\u7edf\u4e2d\u6240\u6709\u4e32\u53e3\u4fe1\u606f\uff0c\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p>\u201c`shell<\/p>\n<p>ls -l \/dev\/tty*<\/p>\n<pre><br>\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\uff1a<br><br><\/pre>\n<p>crw-rw\u2014- 1 root dialout 4, 64 2\u6708 7 10:34 \/dev\/ttyS0<\/p>\n<p>crw-rw\u2014- 1 root dialout 4, 65 2\u6708 7 10:34 \/dev\/ttyS1<\/p>\n<pre><br>\u5176\u4e2d\uff0cttyS0 \u548c ttyS1 \u5206\u522b\u662fLinux\u7cfb\u7edf\u4e2d\u7684\u4e24\u4e2a\u4e32\u53e3\u8bbe\u5907\u3002<br><br>### \u4e09\u3001\u4f7f\u7528 `stty -F \/dev\/ttyS0 -a`\u67e5\u770b\u4e32\u53e3\u8be6\u60c5<br><br>\u7b2c\u4e09\u79cd\u65b9\u6cd5\uff0c`stty -F \/dev\/ttyS0 -a`\u67e5\u770b\u4e32\u53e3S0\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<br><br>```shell<br>stty -F \/dev\/ttyS0 -a<br><\/pre>\n<\/p>\n<p>\u5176\u4e2d\uff0c`-F` \u6307\u5b9a\u8981\u67e5\u770b\u7684\u4e32\u53e3\uff0c`\/dev\/ttyS0`\u4e3a\u7b2c\u4e00\u4e2a\u4e32\u53e3\uff1b`-a` \u53ef\u67e5\u770b\u8be6\u7ec6\u53c2\u6570\uff0c\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p>\u201c`shell<\/p>\n<p>speed 115200 baud; line = 0;<\/p>\n<p>\u2026<\/p>\n<p>intr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^A; eol = ;<\/p>\n<\/p>\n<p>eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z;<\/p>\n<\/p>\n<p>\u2026<\/p>\n<pre><br>\u4ee5\u4e0a\u547d\u4ee4\u4e2d\uff0c\u4e3b\u8981\u5217\u51fa\u4e86\u4e32\u53e3\u7684\u901f\u7387\uff0c\u884c\u7f16\u7801\uff0c\u6587\u672c\u7f16\u7801\u7b49\u4fe1\u606f\u3002<br><br>### \u56db\u3001\u5c0f\u7ed3<br><br>\u672c\u6587\u4ecb\u7ecd\u4e86Linux\u4e0b\u67e5\u770b\u4e32\u53e3\u72b6\u6001\u7684\u4e09\u79cd\u5feb\u901f\u65b9\u6cd5\uff0c\u8ba9\u6211\u4eec\u5feb\u901f\u638c\u63e1Linux\u4e0b\u4e32\u53e3\u7684\u72b6\u6001\u3002\u901a\u8fc7`dmesg`\u547d\u4ee4\u67e5\u770b\u4e32\u53e3\uff1b`ls -l \/dev\/tty*`\u67e5\u770b\u6240\u6709\u4e32\u53e3\uff1b `stty -F \/dev\/ttyS0 -a`\u67e5\u770b\u4e32\u53e3\u8be6\u60c5\u7b49\u547d\u4ee4\uff0c\u5e2e\u52a9\u6211\u4eec\u5b9e\u73b0\u5feb\u901f\u4e32\u53e3\u72b6\u6001\u67e5\u770b\u3002<br><\/pre>\n<p><a href=\"http:https:\/\/idc.net\/\">\u9999\u6e2f\u670d\u52a1\u5668<\/a>\u9996\u9009\u540e\u6d6a\u4e91\uff0c2H2G\u9996\u670810\u5143\u5f00\u901a\u3002<br \/>\u540e\u6d6a\u4e91\uff08www.IDC.Net\uff09\u63d0\u4f9b\u7b80\u5355\u597d\u7528\uff0c\u4ef7\u683c\u539a\u9053\u7684\u9999\u6e2f\/\u7f8e\u56fd\u4e91\u670d\u52a1\u5668\u548c\u72ec\u7acb\u670d\u52a1\u5668\u3002IDC+ISP+ICP\u8d44\u8d28\u3002ARIN\u548cAPNIC\u4f1a\u5458\u3002\u6210\u719f\u6280\u672f\u56e2\u961f15\u5e74\u884c\u4e1a\u7ecf\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u7cfb\u7edf\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u4e32\u53e3\u7ba1\u7406\u529f\u80fd\uff0c\u53ef\u4ee5\u7528\u6765\u5e2e\u52a9\u6211\u4eec\u5feb\u901f\u67e5\u770b\u4e32\u53e3\u72b6\u6001\u3002\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff0c\u8fd9\u91cc\u63d0\u4f9b\u6240\u9700\u8981\u7684\u64cd\u4f5c\u6b65 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-59762","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/59762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=59762"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/59762\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=59762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=59762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=59762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}