{"id":42101,"date":"2023-10-05T10:49:09","date_gmt":"2023-10-05T02:49:09","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=42101"},"modified":"2023-10-05T10:49:09","modified_gmt":"2023-10-05T02:49:09","slug":"sylzkcksbxx","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/42101.html","title":{"rendered":"\u4f7f\u7528Linux\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f"},"content":{"rendered":"

  \u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u4efb\u52a1\uff0c\u5bf9\u4e8e\u8bb8\u591a\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u4e2a\u5fc5\u987b\u638c\u63e1\u7684\u57fa\u672c\u6280\u80fd\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Linux\u547d\u4ee4\u884c\u6765\u64cd\u4f5c\u4e32\u53e3\u8bbe\u5907\u3002<\/p>\n

\u68c0\u67e5\u4e32\u53e3\u8bbe\u5907<\/h2>\n

  \u8981\u68c0\u67e5\u4e32\u53e3\u8bbe\u5907\uff0c\u9996\u5148\u9700\u8981\u77e5\u9053\u7cfb\u7edf\u4e2d\u53ef\u7528\u7684\u4e32\u53e3\u8bbe\u5907\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528ls\u547d\u4ee4\u6765\u5b8c\u6210\uff0cls\u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u7cfb\u7edf\u4e2d\u6240\u6709\u7684\u4e32\u53e3\u8bbe\u5907\uff0c\u4f8b\u5982\uff1a<\/p>\n

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

  \u4e0a\u8ff0\u547d\u4ee4\u5c06\u663e\u793a\u7cfb\u7edf\u4e2d\u6240\u6709\u4ee5\u201ctty\u201d\u5f00\u5934\u7684\u8bbe\u5907\uff0c\u8fd9\u4e9b\u8bbe\u5907\u90fd\u662f\u4e32\u53e3\u8bbe\u5907\u3002<\/p>\n

\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f<\/h2>\n

  \u8981\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n

dmesg | grep tty <\/code><\/pre>\n

  \u4e0a\u8ff0\u547d\u4ee4\u4f1a\u663e\u793a\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u4e32\u53e3\u8bbe\u5907\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u8bbe\u5907\u540d\u79f0\u3001\u6ce2\u7279\u7387\u3001\u6570\u636e\u4f4d\u3001\u505c\u6b62\u4f4d\u7b49\u3002<\/p>\n

\u4f7f\u7528\u4e32\u53e3\u8bbe\u5907<\/h2>\n

  \u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u64cd\u4f5c\u4e32\u53e3\u8bbe\u5907\uff1a<\/p>\n

screen \/dev\/ttyS0 <\/code><\/pre>\n

  \u4e0a\u8ff0\u547d\u4ee4\u5c06\u6253\u5f00\u4e32\u53e3\u8bbe\u5907\/dev\/ttyS0\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u53d1\u9001\u548c\u63a5\u6536\u6570\u636e\u3002<\/p>\n

  \u8bbe\u7f6e\u4e32\u53e3\u8bbe\u5907\u53c2\u6570<\/h3>\n

  \u8981\u8bbe\u7f6e\u4e32\u53e3\u8bbe\u5907\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n

stty -F \/dev\/ttyS0 baud_rate data_bits stop_bits <\/code><\/pre>\n

  \u4e0a\u8ff0\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u8bbe\u7f6e\u4e32\u53e3\u8bbe\u5907\u7684\u6ce2\u7279\u7387\u3001\u6570\u636e\u4f4d\u548c\u505c\u6b62\u4f4d\u3002<\/p>\n

  \u8bfb\u53d6\u4e32\u53e3\u8bbe\u5907\u6570\u636e<\/h3>\n

  \u8981\u8bfb\u53d6\u4e32\u53e3\u8bbe\u5907\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n

cat \/dev\/ttyS0 <\/code><\/pre>\n

  \u4e0a\u8ff0\u547d\u4ee4\u5c06\u8bfb\u53d6\u4e32\u53e3\u8bbe\u5907\u4e2d\u7684\u6570\u636e\uff0c\u5e76\u5c06\u5176\u663e\u793a\u5728\u7ec8\u7aef\u4e2d\u3002<\/p>\n

  \u5199\u5165\u4e32\u53e3\u8bbe\u5907\u6570\u636e<\/h3>\n

  \u8981\u5199\u5165\u4e32\u53e3\u8bbe\u5907\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n

echo \"data\" > \/dev\/ttyS0 <\/code><\/pre>\n

  \u4e0a\u8ff0\u547d\u4ee4\u5c06\u5411\u4e32\u53e3\u8bbe\u5907\u5199\u5165\u6307\u5b9a\u7684\u6570\u636e\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Linux\u547d\u4ee4\u884c\u6765\u64cd\u4f5c\u4e32\u53e3\u8bbe\u5907\uff0c\u5305\u62ec\u68c0\u67e5\u4e32\u53e3\u8bbe\u5907\u3001\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f\u3001\u8bbe\u7f6e\u4e32\u53e3\u8bbe\u5907\u53c2\u6570\u3001\u8bfb\u53d6\u4e32\u53e3\u8bbe\u5907\u6570\u636e\u548c\u5199\u5165\u4e32\u53e3\u8bbe\u5907\u6570\u636e\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u4efb\u52a1\uff0c\u5bf9\u4e8e\u8bb8\u591a\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u4e2a\u5fc5\u987b\u638c\u63e1\u7684\u57fa\u672c\u6280\u80fd\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u4fe1\u606f\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Lin<\/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-42101","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\/42101","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=42101"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/42101\/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=42101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=42101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=42101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}