{"id":56269,"date":"2023-10-20T07:36:07","date_gmt":"2023-10-19T23:36:07","guid":{"rendered":"https:\/\/www.techphant.cn\/blog\/56269.html"},"modified":"2023-10-20T07:36:07","modified_gmt":"2023-10-19T23:36:07","slug":"lrhzkcdk","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/56269.html","title":{"rendered":"Linux\u5982\u4f55\u67e5\u770bCOM\u7aef\u53e3"},"content":{"rendered":"

  \u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0cCOM\u7aef\u53e3\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u4e32\u884c\u901a\u4fe1\u7aef\u53e3\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u4e24\u53f0\u8ba1\u7b97\u673a\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770bCOM\u7aef\u53e3\uff0c\u4ee5\u53ca\u5982\u4f55\u914d\u7f6eCOM\u7aef\u53e3\u4ee5\u5b9e\u73b0\u6570\u636e\u4f20\u8f93\u3002<\/p>\n

\u67e5\u770bCOM\u7aef\u53e3<\/h2>\n

  \u8981\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770bCOM\u7aef\u53e3\uff0c\u9996\u5148\u9700\u8981\u4f7f\u7528ls\u547d\u4ee4\u67e5\u770b\/dev\u76ee\u5f55\uff0c\u8be5\u76ee\u5f55\u5305\u542b\u7cfb\u7edf\u4e2d\u6240\u6709\u7684\u8bbe\u5907\u6587\u4ef6\u3002\u5728\/dev\u76ee\u5f55\u4e2d\uff0cCOM\u7aef\u53e3\u4e00\u822c\u4ee5ttyS\u6216\u8005ttyUSB\u5f00\u5934\uff0c\u6bd4\u5982\/dev\/ttyS0\u6216\u8005\/dev\/ttyUSB0\u3002<\/p>\n

  \u53e6\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528dmesg\u547d\u4ee4\u67e5\u770b\u7cfb\u7edf\u4e2d\u63d2\u5165\u7684\u8bbe\u5907\uff0c\u5728\u67e5\u770b\u8f93\u51fa\u65e5\u5fd7\u4e2d\uff0c\u53ef\u4ee5\u627e\u5230COM\u7aef\u53e3\u7684\u4fe1\u606f\uff0c\u4ece\u800c\u786e\u5b9aCOM\u7aef\u53e3\u7684\u8bbe\u5907\u540d\u79f0\u3002<\/p>\n

\u914d\u7f6eCOM\u7aef\u53e3<\/h2>\n

  \u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528stty\u547d\u4ee4\u6765\u914d\u7f6eCOM\u7aef\u53e3\uff0cstty\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u8bbe\u7f6eCOM\u7aef\u53e3\u7684\u6ce2\u7279\u7387\u3001\u6570\u636e\u4f4d\u3001\u505c\u6b62\u4f4d\u7b49\u53c2\u6570\u3002<\/p>\n

  \u8bbe\u7f6e\u6ce2\u7279\u7387<\/h3>\n

  \u9996\u5148\uff0c\u9700\u8981\u4f7f\u7528stty\u547d\u4ee4\u6765\u8bbe\u7f6eCOM\u7aef\u53e3\u7684\u6ce2\u7279\u7387\uff0c\u6bd4\u5982\u8981\u5c06COM\u7aef\u53e3\u8bbe\u7f6e\u4e3a9600bps\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

stty -F \/dev\/ttyS0 9600<\/pre>\n

  \u8bbe\u7f6e\u6570\u636e\u4f4d<\/h3>\n

  \u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u4f7f\u7528stty\u547d\u4ee4\u6765\u8bbe\u7f6eCOM\u7aef\u53e3\u7684\u6570\u636e\u4f4d\uff0c\u6bd4\u5982\u8981\u5c06COM\u7aef\u53e3\u8bbe\u7f6e\u4e3a8\u4f4d\u6570\u636e\u4f4d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

stty -F \/dev\/ttyS0 cs8<\/pre>\n

  \u8bbe\u7f6e\u505c\u6b62\u4f4d<\/h3>\n

  \u6700\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528stty\u547d\u4ee4\u6765\u8bbe\u7f6eCOM\u7aef\u53e3\u7684\u505c\u6b62\u4f4d\uff0c\u6bd4\u5982\u8981\u5c06COM\u7aef\u53e3\u8bbe\u7f6e\u4e3a1\u4f4d\u505c\u6b62\u4f4d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

stty -F \/dev\/ttyS0 -cstopb<\/pre>\n

\u603b\u7ed3<\/h2>\n

  \u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770bCOM\u7aef\u53e3\uff0c\u4ee5\u53ca\u5982\u4f55\u914d\u7f6eCOM\u7aef\u53e3\u4ee5\u5b9e\u73b0\u6570\u636e\u4f20\u8f93\u3002<\/strong>\u9996\u5148\uff0c\u53ef\u4ee5\u4f7f\u7528ls\u547d\u4ee4\u67e5\u770b\/dev\u76ee\u5f55\uff0c\u4ece\u800c\u786e\u5b9aCOM\u7aef\u53e3\u7684\u8bbe\u5907\u540d\u79f0\uff1b\u5176\u6b21\uff0c\u53ef\u4ee5\u4f7f\u7528stty\u547d\u4ee4\u6765\u8bbe\u7f6eCOM\u7aef\u53e3\u7684\u6ce2\u7279\u7387\u3001\u6570\u636e\u4f4d\u3001\u505c\u6b62\u4f4d\u7b49\u53c2\u6570\uff0c\u4ee5\u4fbf\u5b9e\u73b0\u6570\u636e\u4f20\u8f93\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0cCOM\u7aef\u53e3\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u4e32\u884c\u901a\u4fe1\u7aef\u53e3\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u4e24\u53f0\u8ba1\u7b97\u673a\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770bCOM\u7aef\u53e3\uff0c\u4ee5\u53ca\u5982\u4f55\u914d\u7f6eCOM\u7aef\u53e3<\/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":[289],"class_list":["post-56269","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-comport"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/56269","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=56269"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/56269\/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=56269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=56269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=56269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}