{"id":42656,"date":"2023-09-28T05:48:06","date_gmt":"2023-09-27T21:48:06","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=42656"},"modified":"2023-09-28T05:48:06","modified_gmt":"2023-09-27T21:48:06","slug":"zklxtckzt","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/42656.html","title":{"rendered":"\u67e5\u770bLinux\u7cfb\u7edf\u4e32\u53e3\u72b6\u6001"},"content":{"rendered":"

  Linux\u7cfb\u7edf\u4e32\u53e3\u662f\u4e00\u79cd\u4e32\u884c\u901a\u4fe1\u63a5\u53e3\uff0c\u53ef\u4ee5\u7528\u4e8e\u8fde\u63a5\u8ba1\u7b97\u673a\u548c\u5916\u90e8\u8bbe\u5907\uff0c\u4ee5\u5b9e\u73b0\u6570\u636e\u7684\u4f20\u8f93\u548c\u63a7\u5236\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Linux\u7cfb\u7edf\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Linux\u7cfb\u7edf\u4e32\u53e3\u63a7\u5236\u5916\u90e8\u8bbe\u5907\u3002<\/p>\n

\u67e5\u770b\u4e32\u53e3\u72b6\u6001<\/h2>\n

  \u67e5\u770bLinux\u7cfb\u7edf\u4e32\u53e3\u8bbe\u5907<\/h3>\n

  \u9996\u5148\uff0c\u9700\u8981\u4f7f\u7528Linux\u7cfb\u7edf\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\uff0c\u4ee5\u786e\u5b9a\u4e32\u53e3\u7684\u72b6\u6001\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bLinux\u7cfb\u7edf\u4e32\u53e3\u8bbe\u5907\uff1a<\/p>\n

$ ls \/dev\/tty* <\/code><\/pre>\n

  \u8be5\u547d\u4ee4\u4f1a\u5217\u51faLinux\u7cfb\u7edf\u4e0b\u6240\u6709\u7684\u4e32\u53e3\u8bbe\u5907\uff0c\u5982\u679c\u6ca1\u6709\u4e32\u53e3\u8bbe\u5907\uff0c\u5219\u4f1a\u63d0\u793a\u201c\u6ca1\u6709\u627e\u5230\u6587\u4ef6\u201d\u3002<\/p>\n

  \u67e5\u770b\u4e32\u53e3\u72b6\u6001<\/h3>\n

  \u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff1a<\/p>\n

$ stty -F \/dev\/ttyS0 <\/code><\/pre>\n

  \u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u4e32\u53e3\u7684\u5f53\u524d\u72b6\u6001\uff0c\u5305\u62ec\u6ce2\u7279\u7387\u3001\u6570\u636e\u4f4d\u3001\u505c\u6b62\u4f4d\u7b49\u3002\u5982\u679c\u6ca1\u6709\u663e\u793a\u4efb\u4f55\u5185\u5bb9\uff0c\u5219\u8868\u793a\u4e32\u53e3\u672a\u6253\u5f00\u3002<\/p>\n

\u4f7f\u7528Linux\u7cfb\u7edf\u4e32\u53e3\u63a7\u5236\u5916\u90e8\u8bbe\u5907<\/h2>\n

  \u6253\u5f00\u4e32\u53e3<\/h3>\n

  \u5982\u679c\u8981\u4f7f\u7528Linux\u7cfb\u7edf\u4e32\u53e3\u63a7\u5236\u5916\u90e8\u8bbe\u5907\uff0c\u9996\u5148\u9700\u8981\u6253\u5f00\u4e32\u53e3\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6253\u5f00\u4e32\u53e3\uff1a<\/p>\n

$ stty -F \/dev\/ttyS0 115200 <\/code><\/pre>\n

  \u8be5\u547d\u4ee4\u4f1a\u5c06\u4e32\u53e3\u6ce2\u7279\u7387\u8bbe\u7f6e\u4e3a115200\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u63a7\u5236\u5916\u90e8\u8bbe\u5907\u3002<\/p>\n

  \u53d1\u9001\u6570\u636e<\/h3>\n

  \u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u53d1\u9001\u6570\u636e\uff1a<\/p>\n

$ echo \"Hello World\" > \/dev\/ttyS0 <\/code><\/pre>\n

  \u8be5\u547d\u4ee4\u4f1a\u5c06\u201cHello World\u201d\u53d1\u9001\u5230\u4e32\u53e3\uff0c\u4ee5\u4fbf\u63a7\u5236\u5916\u90e8\u8bbe\u5907\u3002<\/p>\n

  \u5173\u95ed\u4e32\u53e3<\/h3>\n

  \u6700\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5173\u95ed\u4e32\u53e3\uff1a<\/p>\n

$ stty -F \/dev\/ttyS0 -hupcl <\/code><\/pre>\n

  \u8be5\u547d\u4ee4\u4f1a\u5c06\u4e32\u53e3\u5173\u95ed\uff0c\u4ee5\u4fbf\u505c\u6b62\u63a7\u5236\u5916\u90e8\u8bbe\u5907\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528Linux\u7cfb\u7edf\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Linux\u7cfb\u7edf\u4e32\u53e3\u63a7\u5236\u5916\u90e8\u8bbe\u5907\u3002<\/strong>\u9996\u5148\uff0c\u9700\u8981\u4f7f\u7528Linux\u7cfb\u7edf\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\uff0c\u4ee5\u786e\u5b9a\u4e32\u53e3\u7684\u72b6\u6001\u3002\u7136\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff0c\u4ee5\u786e\u5b9a\u4e32\u53e3\u662f\u5426\u5df2\u6253\u5f00\u3002\u63a5\u7740\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u6253\u5f00\u4e32\u53e3\uff0c\u7136\u540e\u4f7f\u7528\u547d\u4ee4\u53d1\u9001\u6570\u636e\uff0c\u4ee5\u4fbf\u63a7\u5236\u5916\u90e8\u8bbe\u5907\u3002\u6700\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u5173\u95ed\u4e32\u53e3\uff0c\u4ee5\u4fbf\u505c\u6b62\u63a7\u5236\u5916\u90e8\u8bbe\u5907\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Linux\u7cfb\u7edf\u4e32\u53e3\u662f\u4e00\u79cd\u4e32\u884c\u901a\u4fe1\u63a5\u53e3\uff0c\u53ef\u4ee5\u7528\u4e8e\u8fde\u63a5\u8ba1\u7b97\u673a\u548c\u5916\u90e8\u8bbe\u5907\uff0c\u4ee5\u5b9e\u73b0\u6570\u636e\u7684\u4f20\u8f93\u548c\u63a7\u5236\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Linux\u7cfb\u7edf\u67e5\u770b\u4e32\u53e3\u72b6\u6001\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Linux\u7cfb\u7edf\u4e32\u53e3\u63a7<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[69],"class_list":["post-42656","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-cktx"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/42656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=42656"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/42656\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=42656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=42656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=42656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}