{"id":39793,"date":"2023-09-30T10:30:45","date_gmt":"2023-09-30T02:30:45","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=39793"},"modified":"2023-09-30T10:30:45","modified_gmt":"2023-09-30T02:30:45","slug":"czkcksb","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/39793.html","title":{"rendered":"Centos\u67e5\u770b\u4e32\u53e3\u8bbe\u5907"},"content":{"rendered":"

  Centos\u7cfb\u7edf\u662f\u4e00\u6b3e\u5f00\u6e90\u7684Linux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u3002\u5728Centos\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528dmesg\u547d\u4ee4\u6765\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\uff0c\u4ece\u800c\u5b9e\u73b0\u4e32\u53e3\u8bbe\u5907\u7684\u68c0\u6d4b\u548c\u914d\u7f6e\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdCentos\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u7684\u65b9\u6cd5\uff0c\u5305\u62ec\u68c0\u6d4b\u4e32\u53e3\u8bbe\u5907\u3001\u914d\u7f6e\u4e32\u53e3\u8bbe\u5907\u53ca\u5176\u4ed6\u76f8\u5173\u64cd\u4f5c\u3002<\/p>\n

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

  \u5728Centos\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528dmesg\u547d\u4ee4\u6765\u68c0\u6d4b\u4e32\u53e3\u8bbe\u5907\u3002dmesg\u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u7cfb\u7edf\u542f\u52a8\u3001\u8bbe\u5907\u9a71\u52a8\u52a0\u8f7d\u3001\u786c\u4ef6\u8bbe\u5907\u68c0\u6d4b\u7b49\u4fe1\u606f\uff0c\u56e0\u6b64\u53ef\u4ee5\u7528\u6765\u68c0\u6d4b\u4e32\u53e3\u8bbe\u5907\u3002\u9996\u5148\uff0c\u4f7f\u7528dmesg\u547d\u4ee4\u67e5\u770b\u7cfb\u7edf\u542f\u52a8\u4fe1\u606f\uff1a<\/p>\n

dmesg | grep tty<\/pre>\n

  \u8fd0\u884c\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u7684\u8f93\u51fa\uff1a<\/p>\n

ttyS0 at I\/O 0x3f8 (irq = 4) is a 16550A

  ttyS1 at I\/O 0x2f8 (irq = 3) is a 16550A<\/p>

  ttyS2 at I\/O 0x3e8 (irq = 4) is a 16550A<\/p> ttyS3 at I\/O 0x2e8 (irq = 3) is a 16550A<\/pre>\n

  \u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\uff0c\u7cfb\u7edf\u4e0a\u67094\u4e2a\u4e32\u53e3\u8bbe\u5907\uff0c\u5206\u522b\u662fttyS0\u3001TTYS1\u3001TTYS2\u548cTTYS3\uff0c\u4ed6\u4eec\u7684I\/O\u5730\u5740\u548c\u4e2d\u65ad\u53f7\u4e5f\u663e\u793a\u51fa\u6765\u4e86\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u786e\u5b9a\u7cfb\u7edf\u4e0a\u6709\u51e0\u4e2a\u4e32\u53e3\u8bbe\u5907\u4e86\u3002<\/p>\n

\u914d\u7f6e\u4e32\u53e3\u8bbe\u5907<\/h2>\n

  \u7531\u4e8e\u4e32\u53e3\u8bbe\u5907\u7684\u7279\u6b8a\u6027\uff0c\u5728\u4f7f\u7528\u524d\u5fc5\u987b\u5148\u8fdb\u884c\u914d\u7f6e\uff0c\u624d\u80fd\u6b63\u5e38\u4f7f\u7528\u3002\u5728Centos\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528setserial\u547d\u4ee4\u6765\u914d\u7f6e\u4e32\u53e3\u8bbe\u5907\u3002setserial\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u67e5\u770b\u548c\u914d\u7f6e\u4e32\u53e3\u7684\u6ce2\u7279\u7387\u3001\u6570\u636e\u4f4d\u3001\u505c\u6b62\u4f4d\u7b49\u53c2\u6570\uff0c\u4ece\u800c\u5b9e\u73b0\u4e32\u53e3\u7684\u6b63\u5e38\u4f7f\u7528\u3002<\/p>\n

  \u9996\u5148\uff0c\u4f7f\u7528setserial\u547d\u4ee4\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u7684\u53c2\u6570\uff1a<\/p>\n

setserial -g \/dev\/ttyS0<\/pre>\n

  \u8fd0\u884c\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u7684\u8f93\u51fa\uff1a<\/p>\n

\/dev\/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4<\/pre>\n

  \u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\uff0c\u4e32\u53e3\u8bbe\u5907\/dev\/ttyS0\u7684UART\u7c7b\u578b\u4e3a16550A\uff0c\u7aef\u53e3\u5730\u5740\u4e3a0x03f8\uff0c\u4e2d\u65ad\u53f7\u4e3a4\u3002<\/p>\n

  \u63a5\u4e0b\u6765\uff0c\u4f7f\u7528setserial\u547d\u4ee4\u914d\u7f6e\u4e32\u53e3\u8bbe\u5907\uff1a<\/p>\n

setserial \/dev\/ttyS0 port 0x03f8 irq 4 uart 16550A<\/pre>\n

  \u8fd0\u884c\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u7684\u8f93\u51fa\uff1a<\/p>\n

\/dev\/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4<\/pre>\n

  \u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\uff0c\u4e32\u53e3\u8bbe\u5907\/dev\/ttyS0\u7684\u914d\u7f6e\u5df2\u7ecf\u5b8c\u6210\uff0c\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u4e86\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u672c\u6587\u4ecb\u7ecd\u4e86Centos\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u7684\u65b9\u6cd5\uff0c\u5176\u4e2d\u5305\u62ec\u68c0\u6d4b\u4e32\u53e3\u8bbe\u5907\u3001\u914d\u7f6e\u4e32\u53e3\u8bbe\u5907\u53ca\u5176\u4ed6\u76f8\u5173\u64cd\u4f5c\u3002<\/strong>\u4f7f\u7528dmesg\u547d\u4ee4\u53ef\u4ee5\u68c0\u6d4b\u7cfb\u7edf\u4e0a\u7684\u4e32\u53e3\u8bbe\u5907\uff0c\u4f7f\u7528setserial\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u548c\u914d\u7f6e\u4e32\u53e3\u8bbe\u5907\u7684\u53c2\u6570\uff0c\u4ece\u800c\u5b9e\u73b0\u4e32\u53e3\u7684\u6b63\u5e38\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Centos\u7cfb\u7edf\u662f\u4e00\u6b3e\u5f00\u6e90\u7684Linux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\u3002\u5728Centos\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528dmesg\u547d\u4ee4\u6765\u67e5\u770b\u4e32\u53e3\u8bbe\u5907\uff0c\u4ece\u800c\u5b9e\u73b0\u4e32\u53e3\u8bbe\u5907\u7684\u68c0\u6d4b\u548c\u914d\u7f6e\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb<\/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-39793","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\/39793"}],"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=39793"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/39793\/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=39793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=39793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=39793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}