{"id":390729,"date":"2024-06-29T09:25:01","date_gmt":"2024-06-29T09:25:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=390729"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=390729","title":{"rendered":"<span>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u043c \u043d\u0430 \u0421\u0438 \u0432 linux<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/578432\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/3o\/ns\/ai\/3onsaiuef8v8o9vlyzww0iim3bu.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/3o\/ns\/ai\/3onsaiuef8v8o9vlyzww0iim3bu.jpeg\" data-blurred=\"true\"\/><\/div>\n<p><\/a><i><font color=\"#999999\">\u0422\u0435\u043b\u0435\u0442\u0430\u0439\u043f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0411\u042d\u0412\u041c \u043c\u043e\u0433\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. <a href=\"https:\/\/xlat.livejournal.com\/737822.html\">\u0424\u043e\u0442\u043e \u0432\u0437\u044f\u0442\u043e \u0437\u0434\u0435\u0441\u044c.<\/a><\/font><\/i><\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u0438\u043a\u043e\u0439 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u043c \u043f\u043e\u0434 \u043b\u0438\u043d\u0443\u043a\u0441\u043e\u043c. \u041d\u0435\u0434\u0430\u0440\u043e\u043c, \u043c\u043e\u044f \u0441\u0442\u0430\u0442\u044c\u044f &#171;<a href=\"https:\/\/habr.com\/ru\/post\/109395\/\">UART \u0438 \u0441 \u0447\u0435\u043c \u0435\u0433\u043e \u0435\u0434\u044f\u0442<\/a>&#187; \u0441\u043f\u0443\u0441\u0442\u044f 11 \u043b\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u044b \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. <\/p>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u043f\u0440\u044f\u0447\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a, \u043b\u0438\u0431\u043e \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u043e\u0434\u043d\u043e\u043f\u043b\u0430\u0442\u043d\u0438\u043a\u043e\u043c. \u0414\u0430 \u0447\u0442\u043e \u0433\u0440\u0435\u0445\u0430 \u0442\u0430\u0438\u0442\u044c, \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 2021 \u0433\u043e\u0434\u0443 UART, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u0441\u044e \u0435\u0433\u043e \u0430\u0440\u0445\u0430\u0438\u0447\u043d\u043e\u0441\u0442\u044c. \u0414\u0430\u043b\u0435\u043a\u043e \u0437\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430, \u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0443 \u0432\u0430\u0441 \u0432 \u043a\u0430\u0440\u043c\u0430\u043d\u0435, \u0431\u0443\u0434\u0435\u0442 \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a UART \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u0441\u0430\u043c\u044b\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 SIM-\u043a\u0430\u0440\u0442\u044b.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043c\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0430\u043c\u0438 \u0432 linux \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u043e. \u0418 \u0432\u043e\u0442, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, UART, \u0434\u0440\u0435\u0432\u043d\u0435\u0439\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0438 \u0434\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043b\u043e\u043c\u0430\u044e\u0442 \u0437\u0443\u0431\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u043d\u0438\u043c \u0432 \u043b\u0438\u043d\u0443\u043a\u0441\u0435. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u0440\u043a \u0441 \u043a\u043e\u043d\u044f\u043c\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0441\u044b\u0440\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e RS-485. \u041d\u0435 \u0437\u043d\u0430\u044e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b \u0433\u043e\u0440\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u041f\u041e \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0421\u0430\u043c\u043e\u0435 \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u043e\u043c\u043e\u0434\u043d\u044b\u043c i2c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043b\u0438\u043d\u0443\u043a\u0441\u0435 \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u0441 \u043e\u0440\u0442\u043e\u0434\u043e\u043a\u0441\u0430\u043b\u044c\u043d\u044b\u043c UART. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b \u0434\u0430\u043b\u044c\u0448\u0435, \u0432\u0441\u0451 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e UART (RS-232, RS-485, UART 5V, UART 3,3 \u0438 \u0442.\u0434.) \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u044f \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c COM-\u043f\u043e\u0440\u0442 \u0438\u043b\u0438 UART. \u041c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0430 \u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u0430.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0441 UART \u0432 \u041e\u0421 Linux. \u0418 \u043d\u0435\u0432\u0430\u0436\u043d\u043e \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 UART (python, c, c++, bash, php, perl \u0438 \u0442.\u0434.), \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0433\u0440\u0430\u0431\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0432\u0441\u0451 \u0443\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043a \u044f\u0434\u0440\u0443. \u0410 \u043d\u0435\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u0430\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0442\u0440\u0443\u0434\u043d\u043e\u0443\u043b\u043e\u0432\u0438\u043c\u044b\u043c \u0431\u0430\u0433\u0430\u043c.<a name=\"habracut\"><\/a><\/p>\n<p>  \u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0421\u041e\u041c-\u043f\u043e\u0440\u0442 \u0432 UNIX \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043a\u0430\u043a \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b (\u0441\u043c\u043e\u0442\u0440\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435). \u0422\u043e \u0435\u0441\u0442\u044c, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u042d\u0412\u041c. \u041e\u0442\u0441\u044e\u0434\u0430 \u0438\u0434\u0451\u0442 \u0432\u0441\u0451 \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b UART.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041e\u0441\u043d\u043e\u0432\u044b \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0432 linux: \u0432\u0441\u0451 \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b<\/font><\/h2>\n<p>  \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0442\u0438\u043f\u0430 Unix (\u0438 GNU Linux \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0438\u043c\u0438): \u0432\u0441\u0451 \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b. \u0424\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u043d\u0430 \u0434\u0438\u0441\u043a\u0435, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0432\u0441\u0435 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438, \u0444\u0430\u0439\u043b\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043d\u0430\u043b (\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043b\u0438 \u043d\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439) \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u0435\u0442\u0438, \u0442\u043e\u0436\u0435 \u043f\u043e \u0441\u0443\u0442\u0438, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b-\u0441\u043e\u043a\u0435\u0442\u043e\u043c (\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0432\u0448\u0438\u0441\u044c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u043c\u044b \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0430.<\/p>\n<p>  <b><font color=\"#3AC1EF\">\u0424\u0430\u0439\u043b \u043c\u043e\u0436\u043d\u043e: <\/font><\/b><u>\u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u043e\u0442\u043a\u0440\u044b\u0442\u044c, \u0437\u0430\u043a\u0440\u044b\u0442\u044c, \u0443\u0434\u0430\u043b\u0438\u0442\u044c, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0444\u0430\u0439\u043b<\/u>. \u0412\u0441\u0451 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432 \u044f\u0434\u0440\u043e, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0430\u0439\u043b\u0430. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442, \u0434\u0430\u043b\u0435\u0435 \u0438\u0445 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e. \u042d\u0442\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u0430\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u043c\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0433\u0434\u0435 \u043e\u043d\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b:<\/p>\n<pre><code class=\"cpp\">#include &lt;sys\/types.h> #include &lt;sys\/stat.h> #include &lt;fcntl.h>  int open(const char *pathname, int flags); \/\/\u041b\u0438\u0431\u043e  int open(const char *pathname, int flags, mode_t mode); \/\/\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0444\u043b\u0430\u0433\u0438 \u043e\u043f\u0446\u0438\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f, \u0438, \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0442\u043e \u0438 \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041d\u043e \u043d\u0430\u0441 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u043e\u043b\u043d\u0443\u0435\u0442. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 (\u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044c) \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0447\u0438\u0441\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u043b\u044f. \u0412 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2013 \u044d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">#include &lt;unistd.h> int close(int fd); \/\/\u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b<\/code><\/pre>\n<p>  \u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0444\u0430\u0439\u043b, \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0443\u043b\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430.<br \/>  \u0421\u0430\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u043b\u044f \u043d\u0430\u0441 \u2014 \u044d\u0442\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<pre><code class=\"cpp\">#include &lt;unistd.h> ssize_t read(int fd, void *buf, size_t count);<\/code><\/pre>\n<p>  <code>read()<\/code> \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c <i>count<\/i> \u0431\u0430\u0439\u0442\u043e\u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044f <i>fd<\/i> \u0432 \u0431\u0443\u0444\u0435\u0440, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <i>buf<\/i>.<br \/>  \u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e <i>count<\/i> \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e, \u0442\u043e <code>read(<\/code>) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u043e \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443. \u0415\u0441\u043b\u0438 <i>count<\/i> \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c <i>SSIZE_MAX<\/i>, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d.<br \/>  \u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u043d\u044b (\u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430), \u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442\u043e\u0432 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445, \u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u0430\u043d\u0430\u043b\u0435, \u043d\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435, \u0438\u043b\u0438 <code>read()<\/code> \u0431\u044b\u043b \u043f\u0440\u0435\u0440\u0432\u0430\u043d \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e -1, \u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 errno \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440 \u043e\u0448\u0438\u0431\u043a\u0438. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430.<\/p>\n<p>  <b><font color=\"#3AC1EF\">\u2752 \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! <\/font><\/b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0431\u0430\u0439\u0442 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442. \u041e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u043c\u0443.<\/p>\n<pre><code class=\"cpp\">#include &lt;unistd.h> ssize_t write(int fd, const void *buf, size_t count);<\/code><\/pre>\n<p>  <code>write<\/code> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u043e <i>count<\/i> \u0431\u0430\u0439\u0442\u043e\u0432 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 <i>buf<\/i> \u0432 \u0444\u0430\u0439\u043b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 <i>fd<\/i>.<br \/>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b (\u043d\u043e\u043b\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430). \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f -1, \u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>errno<\/i> \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <b><font color=\"#3AC1EF\">\u2752 \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c,<\/font><\/b> \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0430\u0439\u0442 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0431\u0430\u0439\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0438 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u044f\u0434\u0440\u0430, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>read<\/code> \u0438 <code>write<\/code> \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 <u>\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u044f\u0434\u0440\u0430 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/u> (\u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f), \u0438 <u>\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u044f\u0434\u0440\u043e<\/u> (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0438\u0441\u0438). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u044f\u0434\u0440\u0430. \u0418 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e\u0440\u0442\u0430, \u0432\u044b \u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u043d\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u044f\u0434\u0440\u0430 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0438\u0437 \u043f\u043e\u0440\u0442\u0430 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430, \u0438 \u0441\u043b\u043e\u0436\u0438\u043b \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0431\u0443\u0444\u0435\u0440.<\/p>\n<h2><font color=\"#3AC1EF\">\u0424\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e COM-\u043f\u043e\u0440\u0442\u0430<\/font><\/h2>\n<p>  \u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0432 \u041e\u0421 Linux \u0432\u0441\u0451 \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b. \u0424\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e COM-\u043f\u043e\u0440\u0442\u043e\u0432 \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>\/dev\/tty*<\/code>, \u0433\u0434\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u0437\u0432\u0451\u0437\u0434\u043e\u0447\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u043e\u044f\u0442\u044c \u043b\u044e\u0431\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438\u043b\u0438 \u0435\u0451 \u043d\u0435 \u0431\u044b\u0442\u044c \u0432\u043e\u0432\u0441\u0435. \u042d\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f \u043d\u0430\u0437\u0430\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432 TeleType (\u0441\u043c. \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u043e\u0441\u0442\u0430) \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 <code>tty<\/code>. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 COM1 \u0432 Ubuntu \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c, \u043a\u0430\u043a <code>\/dev\/ttyS0<\/code>. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c USB-COM \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u0438\u043a, \u0442\u043e \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438\u043c\u044f <code>\/dev\/ttyUSB0<\/code>, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043d\u0430 \u043a\u043e\u043d\u0446\u0435, \u0435\u0441\u043b\u0438 \u0432\u043e\u0442\u043a\u043d\u0443\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u043d\u0443\u0440\u043a\u043e\u0432. \u0427\u0430\u0441\u0442\u043e, \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, lte-\u043c\u043e\u0434\u0435\u043c\u044b), \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a <code>\/dev\/ttyACM0<\/code>.<br \/>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0432\u0435\u0434\u0451\u0442\u0435:<\/p>\n<pre><code class=\"bash\">ls -la \/dev\/tty*<\/code><\/pre>\n<p>  \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u041a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d \u0432\u0430\u0448 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u2014 \u044d\u0442\u043e \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u201c\/dev\/tty\u201d. \u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u0434\u0451\u0442 \u0432 \u044d\u0442\u043e \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 (\u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 bash) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430. \u041c\u043e\u0436\u0435\u043c \u0432 \u044d\u0442\u043e\u043c \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u0432\u0435\u0434\u044f:<\/p>\n<pre><code class=\"bash\">~$ echo \"Hello\" > \/dev\/tty Hello<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 echo \u0432\u044b\u0432\u0435\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b <code>\/dev\/tty<\/code>, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u0415\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0432\u0441\u0451 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0440\u0430\u043d\u044c\u0448\u0435, \u0442\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u00ab\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d\u00bb \u043a \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0443 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0430\u0441\u0441\u0438\u0432\u043d\u0443\u044e \u0436\u0435\u043b\u0435\u0437\u043a\u0443, \u0447\u0442\u043e \u043a \u043d\u0435\u043c\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442, \u0442\u043e \u043e\u043d \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u201cecho\u201d \u0432 \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 write), \u0442\u043e \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 \u0438 \u043c\u044b \u0438\u0445 \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442: \u0432\u044b, \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438 \u043d\u0430\u0436\u0430\u0442\u044c ctrl-c, \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 SIGINT. \u041a\u0430\u043a \u0436\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0442\u043e \u043d\u0430\u0431\u0438\u0440\u0430\u044f ctrl-c, \u0432\u044b \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442\u0435 \u0441\u0438\u043c\u0432\u043e\u043b \u00ab^c\u00bb: ETX (\u041a\u043e\u043d\u0435\u0446 \u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f), ASCII 0x03. \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0430 \u0432\u0438\u0434\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u043b\u0430\u0434\u0435\u0435\u0442 \u0432\u0432\u043e\u0434\u043e\u043c-\u0432\u044b\u0432\u043e\u0434\u043e\u043c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438. <\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d, \u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0442.\u0434. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:<\/p>\n<ul>\n<li>(ctrl-c) ^C \u2192 ETX (\u041a\u043e\u043d\u0435\u0446 \u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f), ASCII 0x03<\/li>\n<li>(ctrl-d) ^D \u2192 EOT (\u041a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438, \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0432\u0432\u043e\u0434), ASCII 0x04<\/li>\n<li>^H \u2192 BS (Backspace, \\b ), ASCII 0x08<\/li>\n<li>^J \u2192 LF (\u043f\u043e\u0434\u0430\u0447\u0430 \u043b\u0438\u043d\u0438\u0438, \\n ), ASCII 0x0A<\/li>\n<li>^L \u2192 FF (\u043a\u0430\u043d\u0430\u043b \u0444\u043e\u0440\u043c\u044b, \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430), ASCII 0x0C<\/li>\n<li>^M \u2192 CR (\u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043a\u0430\u0440\u0435\u0442\u043a\u0438, \\r ), ASCII 0x0D<\/li>\n<\/ul>\n<p>  \u041a\u0430\u043a \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u0432 \u0441\u044b\u0440\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b, \u0442\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u043f\u043e\u0448\u043b\u0451\u0442 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0442\u0430\u043a\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b, \u0438 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043a \u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0421\u041e\u041c-\u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0441\u044b\u0440\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0438 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">stty -F \/dev\/tty -a<\/code><\/pre>\n<p>  \u0418 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"bash\">~$ stty -F \/dev\/tty -a speed 38400 baud; rows 51; columns 238; line = 0; intr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = &lt;undef>; eol2 = &lt;undef>; swtch = &lt;undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u043e\u0435 \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435, \u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u043b\u043e\u0449\u0435\u043d\u0438\u044f \u0432 \u0436\u0435\u043b\u0435\u0437\u0435, \u0443 \u043d\u0435\u0433\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0444\u043b\u0430\u0433\u0438. \u042d\u0442\u043e \u0444\u043b\u0430\u0433\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b termios. \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u0444\u043b\u0430\u0433\u0430\u043c\u0438, \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u043d\u0430\u0447\u0430\u0442 \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u044b, \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435.<\/p>\n<p>  \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0440\u0442\u0430, \u0442\u043e \u043e\u043d\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 \u00ab\u043d\u0435\u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c\u00bb, \u0442\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043d\u0435 \u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430, \u0442\u043e \u043e\u043d \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0431\u0443\u0434\u0443\u0442 \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0431\u044b\u043b\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442. \u0418 \u043f\u0440\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0448\u043b\u0430 \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e: \u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u0442\u043e \u043d\u0435\u0442. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043d\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 <i>cutecom<\/i> \u0438 \u0441 \u043d\u0435\u0439 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0447\u0430\u0441\u044b, \u043d\u043e \u0434\u043e \u0435\u0451 \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0443 \u043c\u0435\u043d\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u0418 \u0432\u0434\u0440\u0443\u0433 \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u044f \u043f\u043e\u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u043b \u0435\u0451, <u>\u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e<\/u> \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e! <\/p>\n<p>  \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u043b\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0441\u043e\u0444\u0442 \u0441\u0442\u0430\u0432\u0438\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b\u0430. \u0418 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0448\u043b\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <i>stty<\/i>. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0440\u0442\u0430 \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <i>cutecom<\/i>, \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443:<\/p>\n<pre><code class=\"bash\">stty -a -F \/dev\/ttyUSB0 > first cutecom^C stty -a -F \/dev\/ttyUSB0 > second diff first second<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 <i>cutecom<\/i> \u0441\u043d\u0438\u043c\u0430\u0435\u0442 \u0444\u043b\u0430\u0433 <code>ISIG<\/code> \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0444\u043b\u0430\u0433 <code>IGNBRK<\/code>. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u044b.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430<\/font><\/h2>\n<p>  \u0412\u0441\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 tty \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>struct termios<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <code>&lt;termios.h><\/code>. \u0418\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0448\u0438\u0440\u043e\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0448\u0435\u0441\u0442\u044c. \u041a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043b\u0438\u043d\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 <code>tcgetattr()<\/code> \u0438 <code>tcsetattr()<\/code>.<\/p>\n<pre><code class=\"cpp\">#include &lt;termios.h>  struct termios {   tcflag_t c_iflag; \/* \u0444\u043b\u0430\u0433\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 *\/   tcflag_t c_oflag; \/* \u0444\u043b\u0430\u0433\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 *\/   tcflag_t c_cflag; \/* \u0444\u043b\u0430\u0433\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 *\/   tcflag_t c_lflag; \/* \u0444\u043b\u0430\u0433\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 *\/   cc_t c_line;      \/* \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430 \u043b\u0438\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 *\/   cc_t c_cc[NCCS];  \/* \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b *\/  };  int tcgetattr(int fd, struct termios * tp);  int tcsetattr(int fd, int oact, struct termios * tp);<\/code><\/pre>\n<p>  \u041f\u043e\u0447\u0442\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c tcgetattr() \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c tcsetattr() \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 (\u0442\u0435\u043b\u0435\u0442\u0430\u0439\u043f\u0430, \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0430, \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0443\u0433\u043e\u0434\u043d\u043e), \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h> #include &lt;stdlib.h> #include &lt;fcntl.h> #include &lt;unistd.h> #include &lt;termios.h>  int main (int argc, char ** argv) {            struct termios oldsettings, newsettings;         tcgetattr(fileno(stdin), &amp;oldsettings);         newsettings = oldsettings;         newsettings.c_lflag &amp;= ~(ECHO|ICANON|ISIG);         newsettings.c_cc[VMIN] = 1;         newsettings.c_cc[VTIME] = 1;         tcsetattr(fileno(stdin), TCSANOW, &amp;newsettings);         printf(\"press [q] to quit\\n\");         char rd_ch = '\\0';         int fd_in = open (\"\/dev\/tty\", O_RDONLY);         while(rd_ch != 'q') {                 int read_count = read(fd_in, &amp;rd_ch, 1);         }         tcsetattr(fileno(stdin), TCSANOW, &amp;oldsettings);         return EXIT_SUCCESS; }<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/github.com\/dlinyj\/linux_com_port\/blob\/master\/pressq.c\">\u043e\u0431\u0438\u0442\u0430\u0435\u0442 \u0432\u043e\u0442 \u0442\u0443\u0442<\/a>.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430: \u043e\u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u043d\u0435\u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c, \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u044f \u044d\u0445\u043e \u043f\u043e\u043a\u0430\u0437\u0430 \u043a\u043b\u0430\u0432\u0438\u0448 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044f \u0432\u0441\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b, \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u00abq\u00bb \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430.<br \/>  \u0420\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">.\/pressq  press [q] to quit $<\/code><\/pre>\n<p>  \u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u043c\u0438 \u043a\u043b\u0430\u0432\u0438\u0448 ctrl-c, ctrl-d \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b. \u041d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0451 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<br \/>  \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<pre><code class=\"cpp\">struct termios oldsettings, newsettings;<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0432\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b termios. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0438 \u043f\u043e\u0442\u043e\u043c \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0435\u0433\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u043d\u043e\u0432\u043e\u0435.<\/p>\n<pre><code class=\"cpp\">tcgetattr(fileno(stdin), &amp;oldsettings);<\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fileno(stdin) \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432\u044b\u0432\u043e\u0434\u0430, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f tcgetattr \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 oldsettings.<\/p>\n<pre><code class=\"cpp\">newsettings = oldsettings;<\/code><\/pre>\n<p>  \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.<\/p>\n<pre><code class=\"cpp\">newsettings.c_lflag &amp;= ~(ECHO|ICANON|ISIG);<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043d\u0438\u043c\u0430\u0435\u043c \u0444\u043b\u0430\u0433\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u044d\u0445\u0430, \u0441\u043d\u0438\u043c\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0444\u043b\u0430\u0433\u0430\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b termios <a href=\"https:\/\/www.opennet.ru\/man.shtml?topic=termios&amp;category=3&amp;russian=0\">\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0443\u0442<\/a>.<\/p>\n<pre><code class=\"cpp\">newsettings.c_cc[VMIN] = 1;         newsettings.c_cc[VTIME] = 1;<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u0437\u0430 \u0440\u0430\u0437 \u2014 \u0434\u043b\u044f \u043d\u0435\u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 (\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>read<\/code> \u0434\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 <code>VTIME<\/code>). \u0410 \u0442\u0430\u043a\u0436\u0435 \u0442\u0430\u0439\u043c\u0430\u0443\u0442, \u0432 \u0434\u0435\u0446\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u043d\u043e \u043d\u0430\u043a\u043e\u043f\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>read<\/code>. \u0415\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0435\u0442, \u0442\u043e <code>read<\/code> \u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u0443\u043b\u044c (\u0441\u043c. \u0433\u043b\u0430\u0432\u0443 \u00ab\u041e\u0441\u043d\u043e\u0432\u044b \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0432 linux: \u0432\u0441\u0451 \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b\u00bb).<\/p>\n<p>  \u042d\u0442\u043e \u043c\u0435\u0441\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0435, \u043f\u043e\u044f\u0441\u043d\u044e. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0430, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>read<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0443\u043b\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0435 0,1 \u0441. \u0415\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>read<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c 1-\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u0435. <b><font color=\"#3AC1EF\">\u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>read<\/code> \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0430\u044f!<\/font><\/b><\/p>\n<pre><code class=\"cpp\">tcsetattr(fileno(stdin), TCSANOW, &amp;newsettings);<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u043d\u0430\u0448 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b.<\/p>\n<pre><code class=\"cpp\">char rd_ch = '\\0';                 int fd_in = open (\"\/dev\/tty\", O_RDONLY);                 while(rd_ch != 'q') {                         int read_count = read(fd_in, &amp;rd_ch, 1);                 }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0438\u0434\u0451\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 &#171;\/dev\/tty&#187; c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>open<\/code> \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 <code>fileno<\/code>, \u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043b \u0442\u0430\u043a \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u0432 \u0446\u0438\u043a\u043b\u0435 \u043c\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0443, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u0440\u0430\u0432\u043d\u044b\u0439 &#8216;q&#8217;.<\/p>\n<pre><code class=\"cpp\">tcsetattr(fileno(stdin), TCSANOW, &amp;oldsettings);<\/code><\/pre>\n<p>  \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/font><\/h2>\n<p>  \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0445\u043e\u0442\u044c \u0438 \u0431\u044b\u043b \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u043f\u0430\u0440\u043e\u043b\u0435\u0439, \u043b\u0438\u0431\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u0441\u0435\u0432\u0434\u043e\u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u0445. \u041d\u043e \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430, \u0432\u0441\u0451 \u0436\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0436\u0438\u0432\u044b\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430 Arduino \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u043a\u0435\u0442\u0447:<\/p>\n<pre><code class=\"cpp\">void setup() {     Serial.begin(9600); }  void loop() {      Serial.print(\"01234567890123456789\\n\\r\");      delay(2000); }<\/code><\/pre>\n<p>  \u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0448\u043b\u0451\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u00ab01234567890123456789\\n\\r\u00bb \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 9600 \u043a\u0430\u0436\u0434\u044b\u0435 \u0434\u0432\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0423\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043b ASCII-\u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0449\u0435 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c.<br \/>  \u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0432\u0432\u043e\u0434\u0438\u043c:<\/p>\n<pre><code class=\"bash\">dmesg -w<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u044f\u0434\u0440\u0430. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c Arduino-\u043f\u043b\u0430\u0442\u0443 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443 \u0438 \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">[83343.555600] usb 2-2: new full-speed USB device number 3 using ohci-pci [83344.099687] usb 2-2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54 [83344.099694] usb 2-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [83344.099698] usb 2-2: Product: USB2.0-Serial [83344.199375] usbcore: registered new interface driver usbserial_generic [83344.205220] usbserial: USB Serial support registered for generic [83344.247903] usbcore: registered new interface driver ch341 [83344.248341] usbserial: USB Serial support registered for ch341-uart [83344.248819] ch341 2-2:1.0: ch341-uart converter detected [83344.311747] usb 2-2: ch341-uart converter now attached to ttyUSB0<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0441 \u0441\u0430\u043c\u0430\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0447\u0442\u043e \u043d\u0430\u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0441\u044f, \u043a\u0430\u043a ttyUSB0 \u0438 \u043e\u0431\u0438\u0442\u0430\u0435\u0442 \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \/dev\/ttyUSB0.<\/p>\n<pre><code class=\"bash\">$ ls -la \/dev\/ttyUSB0  crw-rw---- 1 root dialout 188, 0 Oct 21 11:38 \/dev\/ttyUSB0<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441 \u044d\u0442\u0438\u043c \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0438\u0437-\u043f\u043e\u0434 <code>root<\/code>, \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 <code>dialout<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0432\u0435\u0434\u0451\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<pre><code class=\"bash\">sudo usermod -a -G dialout $USER<\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u0435\u0430\u043d\u0441, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0432 \u0441\u0438\u043b\u0443. \u041b\u0438\u0447\u043d\u043e \u044f \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0449\u0438\u043a, \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0431\u0443\u0442\u0430\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n<pre><code class=\"bash\">sudo reboot<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430. \u0417\u0430\u0434\u0430\u0434\u0438\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u0440\u0442\u0430 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435.<\/p>\n<pre><code class=\"bash\">$ stty -F \/dev\/ttyUSB0 9600 $ cat \/dev\/ttyUSB0  0123456789  0123456789  0123456789  0123456789<\/code><\/pre>\n<p>  \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437 \u0432 \u0434\u0432\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u0441\u0451 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0445\u0430\u043a. \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (\u0431\u0435\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u041f\u041e), \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <code>hexdump<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/29\/xm\/bf\/29xmbfmwwtdjd4lyu_hjiuyucb4.png\" data-src=\"https:\/\/habrastorage.org\/webt\/29\/xm\/bf\/29xmbfmwwtdjd4lyu_hjiuyucb4.png\"\/><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0430<\/font><\/h2>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 COM-\u043f\u043e\u0440\u0442\u0430 \u0431\u044b\u043b \u0432\u0437\u044f\u0442 <a href=\"https:\/\/github.com\/xanthium-enterprises\/Serial-Port-Programming-on-Linux\/blob\/master\/USB2SERIAL_Read\/Reciever%20(PC%20Side)\/SerialPort_read.c\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a> \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d. \u0412\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/dlinyj\/linux_com_port\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> \u043a \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  \u0411\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0447\u0442\u0435\u043d\u0438\u0435, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 read \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c read. \u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u0442, \u0442\u043e \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0436\u0434\u0430\u0442\u044c \u0432\u0435\u0447\u043d\u043e \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u042d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u043c, \u0438 \u0441 \u043d\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u0440\u0442\u043e\u043c, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435, \u0442\u043e\u0442 \u0436\u0435 cat \u0438 hexdump \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0447\u0442\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u0442\u0430\u043a\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0434\u043a\u043e.<\/p>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 <a href=\"https:\/\/github.com\/dlinyj\/linux_com_port\/blob\/master\/bloking_read\/SerialPort_read.c\">SerialPort_read.c<\/a>:<\/p>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"cpp\">fd = open(\"\/dev\/ttyUSB0\",O_RDWR | O_NOCTTY);<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0444\u043b\u0430\u0433\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f: O_RDWR \u2013 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438, O_NOCTTY \u2013 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c (\u0442\u043e\u0442 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 ctrl-c).<\/p>\n<pre><code class=\"cpp\">struct termios SerialPortSettings; tcgetattr(fd, &amp;SerialPortSettings);<\/code><\/pre>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 termios \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<pre><code class=\"cpp\">cfsetispeed(&amp;SerialPortSettings,B9600);  cfsetospeed(&amp;SerialPortSettings,B9600);<\/code><\/pre>\n<p>  \u0417\u0430\u0434\u0430\u0451\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043c\u0430\u043a\u0440\u043e\u0441\u0430\u043c\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u201cB\u201d (\u043e\u043d\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 termios.h). \u041c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">        B0         B50         B75         B110         B134         B150         B200         B300         B600         B1200         B1800         B2400         B4800         B9600         B19200         B38400         B57600         B115200         B230400<\/code><\/pre>\n<p>  \u041d\u0443\u043b\u0435\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, B0, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0438.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0443\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cflag &amp;= ~PARENB;<\/code><\/pre>\n<p>  \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0442 \u0447\u0451\u0442\u043d\u043e\u0441\u0442\u0438 (\u0435\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u043e\u0447\u0438\u0449\u0435\u043d).<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cflag &amp;= ~CSTOPB;<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u0442\u043e \u0441\u0442\u043e\u043f-\u0431\u0438\u0442 \u0440\u0430\u0432\u0435\u043d \u0434\u0432\u0443\u043c, \u0435\u0441\u043b\u0438 \u043e\u0447\u0438\u0449\u0435\u043d (\u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435), \u0442\u043e \u0440\u0430\u0432\u0435\u043d \u043e\u0434\u043d\u043e\u043c\u0443.<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cflag &amp;= ~CSIZE;<\/code><\/pre>\n<p>  \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u043c\u0430\u0441\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cflag |=  CS8;<\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0432\u043d\u044b\u0439 \u0432\u043e\u0441\u044c\u043c\u0438 \u0431\u0438\u0442\u0430\u043c.<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cflag &amp;= ~CRTSCTS;<\/code><\/pre>\n<p>  \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 (RTS\/CTS).<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cflag |= CREAD | CLOCAL;<\/code><\/pre>\n<p>  \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u0438\u0451\u043c\u043d\u0438\u043a, \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043c\u0430.<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_iflag &amp;= ~(IXON | IXOFF | IXANY);<\/code><\/pre>\n<p>  \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0435, \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u0432\u043e\u0434.<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_lflag &amp;= ~(ICANON | ECHO | ECHOE | ISIG); <\/code><\/pre>\n<p>  <b><font color=\"#3AC1EF\">\u2752 \u0427\u0430\u0441\u0442\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430: <\/font><\/b>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 <code>c_iflag<\/code> \u0438 <code>c_lflag<\/code>, \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0438 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435 \u043d\u0435 \u0442\u0435 \u0444\u043b\u0430\u0433\u0438, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0412 \u043a\u043e\u0434\u0435 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 (\u0432 \u0442. \u0447. \u0438 \u0443 \u043c\u0435\u043d\u044f).<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 \u043d\u0435\u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0436\u0438\u043c (\u043c\u044b \u044d\u0442\u043e \u0443\u0436\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438).<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_oflag &amp;= ~OPOST;<\/code><\/pre>\n<p>  \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0435\u0436\u0438\u043c \u0432\u0432\u043e\u0434\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 (\u0441 \u044d\u0442\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043c\u044b \u0435\u0449\u0451 \u043f\u043e\u0438\u0433\u0440\u0430\u0435\u043c\u0441\u044f). \u0425\u043e\u0442\u044c \u043c\u044b \u0438\u0445 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438 \u0443\u0436\u0435, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0443 \u043d\u0438\u0445 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cc[VMIN] = 40;<\/code><\/pre>\n<p>  \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0437\u0430 \u0440\u0430\u0437 \u0442\u043e\u043b\u044c\u043a\u043e 40 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">SerialPortSettings.c_cc[VTIME] = 10;<\/code><\/pre>\n<p>  \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 \u043d\u0443\u043b\u044f, \u0444\u0443\u043d\u043a\u0446\u0438\u044f read \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u0434\u0435\u0446\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.<\/p>\n<pre><code class=\"cpp\">tcsetattr(fd,TCSANOW,&amp;SerialPortSettings)<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>termios<\/code>.<\/p>\n<p>  \u0412\u044b \u043e\u0441\u043e\u0437\u043d\u0430\u0451\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 COM-\u043f\u043e\u0440\u0442\u043e\u043c? \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u044b \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0434\u0430\u0436\u0435 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0430 \u0443\u0436\u0435 \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0438\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>termios<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u043e\u0440\u0442\u043e\u043c.<br \/>  \u0427\u0442\u0435\u043d\u0438\u0435 \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435:<\/p>\n<pre><code class=\"cpp\">while (1) {   tcflush(fd, TCIFLUSH);   \/\/\u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 RX   bytes_read = read(fd,&amp;read_buffer,32); \/\/\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 32-\u0445 \u0431\u0430\u0439\u0442    printf(\"\\n\\n  Bytes Rxed -%d\", bytes_read);   for(i=0;i&lt;bytes_read;i++)     printf(\"%c\",read_buffer[i]); \/\/\u043f\u0435\u0447\u0430\u0442\u044c \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 }<\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0436\u0435 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443 \u043d\u0430\u0441 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"bash\">$ gcc SerialPort_read.c -o SerialPort_read $ .\/SerialPort_read    +----------------------------------+  |        Serial Port Read          |  +----------------------------------+   ttyUSB0 Opened Successfully    BaudRate = 9600    StopBits = 1    Parity   = none    Bytes Rxed -11    0123456789     Bytes Rxed -11    0123456789 \u2026.<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432\u044b\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044c (\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 write) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0438 \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0439, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0443\u0444\u0435\u0440 \u044f\u0434\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u043f\u043e\u0440\u0442\u0443<br \/>  <\/font><\/h2>\n<p>  \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 COM-\u043f\u043e\u0440\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u0412 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0432\u0438\u0434\u0435, \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0435\u0449\u0451 \u0434\u0432\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0443\u0448\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443. \u041d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430, \u043f\u0440\u0438\u0447\u0451\u043c \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0435. \u041b\u0438\u0447\u043d\u043e \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <b><font color=\"#3AC1EF\">IO Ninja Serial Monitor:<\/font><\/b><\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/61444a11f61f533babdf2e51\" data-style=\"\" id=\"61444a11f61f533babdf2e51\" width=\"\"><\/div>\n<\/div>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u044f\u0434\u0440\u0430, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0447\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 <i>tdevmon<\/i>, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0435\u0433\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u043c insmod \u0434\u043b\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430. <a href=\"https:\/\/ioninja.com\/doc\/kb\/tdevmon_linux_installation.html\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0432\u043e\u0442 \u0442\u0443\u0442.<\/a><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 ioninja, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0438\u043a\u043e\u0432 \u043c\u044b\u0448\u044c\u044e, \u0438 \u0432\u0441\u0451 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ex\/q8\/xv\/exq8xvaxdqggbboiydms33op4ws.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/ex\/q8\/xv\/exq8xvaxdqggbboiydms33op4ws.png\"\/><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0447\u0442\u0435\u043d\u0438\u0435?<\/font><\/h2>\n<p>  \u041d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u044f\u0434\u0440\u0430 linux \u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f read \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043d\u0451\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u043d\u043e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439, \u0435\u0441\u043b\u0438 \u0432\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0435 \u043f\u043e\u0441\u044b\u043b\u043a\u0443, \u0442\u043e \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435 \u0447\u0438\u0442\u0430\u0442\u044c, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0432\u0435\u0449\u0438 \u043a\u0430\u043a \u2014 select, poll \u0438 epoll. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043d\u0438\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0443 \u043a\u0440\u0430\u0442\u043e\u043a.<\/p>\n<p>  \u0412 \u0441\u0432\u043e\u0451\u043c \u0432\u0435\u0431\u0438\u043d\u0430\u0440\u0435 \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u043c (\u0441\u0441\u044b\u043b\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0438\u0436\u0435), \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0442\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442-\u0440\u0438\u0434\u0435\u0440\u0430 \u043c\u0430\u0433\u043d\u0438\u0442\u043d\u044b\u0445 \u043a\u0430\u0440\u0442. \u0422\u0430\u043c \u0443 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u043c. \u0415\u0451 \u043c\u044b \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c. <a href=\"https:\/\/github.com\/dlinyj\/linux_com_port\/tree\/master\/card_reader\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0438\u0442\u0430\u0435\u0442 \u0442\u0443\u0442.<\/a><\/p>\n<p>  \u041d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432\u0441\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043f\u0440\u043e\u0431\u0435\u0433\u0443\u0441\u044c \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0432 \u043d\u0435\u0439 \u0432\u0441\u0451 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438. \u0412\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b\u0435 uart.c.<br \/>  \u0427\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442 \u0432 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c, \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u043e\u0440\u0442\u0430, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0432 \u0440\u0435\u0436\u0438\u043c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"cpp\">fcntl(fd, F_SETFL, FNDELAY);<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0435\u043f\u0435\u0440\u044c, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443, \u043f\u043e\u0441\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 read, \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0435\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u044f\u0434\u0440\u0430, \u0438 \u0435\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442 \u0442\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0443, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"cpp\">int read_com(int fd, int len , int timeout, uint8_t * buff){         int ret = 0;                  struct pollfd fds;         fds.fd=fd;         fds.events = POLLIN;         poll(&amp;fds, 1, timeout);         if(fds.revents &amp; POLLIN) {                 ret = read(fd, buff, len);         }         if(ret&lt;0){                 ret = 0;         }         return ret;  }<\/code><\/pre>\n<p>  \u041d\u0430 \u0432\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430, \u0434\u043b\u0438\u043d\u0443 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u0439\u043c\u0430\u0443\u0442 \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0431\u0443\u0444\u0435\u0440, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u0447\u0438\u0442\u0430\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"cpp\">struct pollfd fds;<\/code><\/pre>\n<p>  \u0412 \u043d\u0435\u0451 \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0442\u0438\u043c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">fds.fd=fd;<\/code><\/pre>\n<p>  \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0442\u043e \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"cpp\">fds.events = POLLIN; <\/code><\/pre>\n<p>  \u0418, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0437\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0448 \u00ab\u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440\u00bb.<\/p>\n<pre><code class=\"cpp\">poll(&amp;fds, 1, timeout);<\/code><\/pre>\n<p>  \u0418\u0437 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u0432\u044b\u0439\u0434\u0435\u043c \u043b\u0438\u0431\u043e \u043f\u043e \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0443, \u043b\u0438\u0431\u043e \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e. \u0418 \u0435\u0441\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 POLLIN, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043d\u0443\u043b\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 \u043d\u0443\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0451 \u0436\u0435 \u043b\u0443\u0447\u0448\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0430 \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0443\u043b\u044c. \u041d\u043e \u044d\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0435\u0441\u0442\u044c \u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0432\u0435\u0434\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u044f\u0434\u0440\u043e? \u0414\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0440\u0435\u0436\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 RS-485 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u043d\u0438\u0435\u0439 DTR\/RTS, \u043b\u0438\u0431\u043e GPIO, \u0442\u043e \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u0438\u043d\u044b, \u043c\u0435\u043d\u044f\u044f \u0440\u0435\u0436\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043d\u0430 \u043f\u0440\u0438\u0451\u043c. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0432\u0441\u0451 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<pre><code class=\"cpp\">int write_com(int fd, uint8_t * buf, size_t size, int timeout){         int ret = 0;          struct pollfd fds;         fds.fd=fd;         fds.events = POLLOUT;                  poll(&amp;fds, 1, timeout);         if(fds.revents &amp; POLLOUT){ #ifdef USE_RTS                 set_rts(fd,RTS_SET); #endif                 ret = write(fd, (uint8_t*)buf, size);                  tcdrain(fd);  #ifdef USE_RTS                 set_rts(fd,RTS_CLR); #endif         }                  if(ret!=size) return 0;         return 1;  }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c <code>poll<\/code> \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u043d\u0430 \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u044d\u0442\u043e \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>tcdrain(fd);<\/code> \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u0430, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f <code>fd<\/code>, \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b. \u0424\u0443\u043d\u043a\u0446\u0438\u044e <code>int set_rts(int fd, int on)<\/code> \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041a\u0430\u043a \u043f\u043e\u0434\u0440\u044b\u0433\u0430\u0442\u044c \u043d\u043e\u0436\u043a\u043e\u0439 DTR \u0438 RTS, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043e RS-485<\/font><\/h2>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 <code>read<\/code> \u0438 <code>write<\/code>, \u0435\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>ioctl<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0442\u043e\u043d\u043a\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443. \u0411\u0443\u0434\u0435\u043c \u0447\u0435\u0441\u0442\u043d\u044b, \u0432\u043e\u0442 \u044d\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 <code>termios<\/code>, \u0432\u043d\u0438\u0437\u0443 \u0438\u043c\u0435\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>ioctl<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u044f\u0434\u0440\u043e. \u041d\u043e \u044d\u0442\u043e \u043e\u0442 \u043d\u0430\u0441 \u0441\u043a\u0440\u044b\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>ioctl<\/code> \u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u043e\u0432\u0430\u043d \u0438 \u043e\u0447\u0435\u043d\u044c \u043e\u043f\u0430\u0441\u0435\u043d, \u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u043d\u043a\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u043e\u0440\u0442\u0430. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u043b\u0438 \u0441\u043d\u044f\u0442\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 rts.<\/p>\n<pre><code class=\"cpp\">int set_rts(int fd, int on){         int flags;          ioctl(fd, TIOCMGET, &amp;flags);         if (on) {                 flags |= TIOCM_RTS;         } else {                 flags &amp;= ~TIOCM_RTS;         }         ioctl(fd, TIOCMSET, &amp;flags);         return 1; }  <\/code><\/pre>\n<p>  \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u043e\u0432 \u043f\u043e\u0440\u0442\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>&amp;flags<\/code>.<\/p>\n<pre><code class=\"cpp\">ioctl(fd, TIOCMGET, &amp;flags);<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u043b\u0438\u0431\u043e \u0441\u043d\u0438\u043c\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f TIOCM_RTS, \u043b\u0438\u0431\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e.<br \/>  \u0418 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e<\/p>\n<pre><code class=\"cpp\">ioctl(fd, TIOCMSET, &amp;flags);<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c DTR.<\/p>\n<pre><code class=\"cpp\">int set_dtr(int fd, int on){         int flags;          ioctl(fd, TIOCMGET, &amp;flags);         if (on) {                 flags |= TIOCM_DTR;         } else {                 flags &amp;= ~TIOCM_DTR;         }         ioctl(fd, TIOCMSET, &amp;flags);         return 1; }<\/code><\/pre>\n<p>  \u0421 RS-485 \u0432 \u043b\u0438\u043d\u0443\u043a\u0441\u0435 \u0432\u0441\u0451 \u043e\u0431\u0441\u0442\u043e\u0438\u0442 \u043d\u0435\u0432\u0430\u0436\u043d\u043e. \u042d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442. \u0413\u0434\u0435-\u0442\u043e \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u044f\u0434\u0440\u0435, \u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u044f\u0434\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u0440\u0438\u0451\u043c\u043e-\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a, \u0433\u0434\u0435-\u0442\u043e \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e. \u0422\u0443\u0442 \u0432\u0441\u0451 \u043a\u0430\u043a \u0431\u043e\u0433 \u043d\u0430 \u0434\u0443\u0448\u0443 \u043f\u043e\u043b\u043e\u0436\u0438\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0441 RS-485 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. \u041d\u043e \u043c\u043e\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0451 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u2013 \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u2013 \u044d\u0442\u043e \u043b\u0435\u0437\u0442\u044c \u0432 \u043a\u043e\u0434 \u044f\u0434\u0440\u0430 \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0412\u044b\u0432\u043e\u0434\u044b<\/font><\/h2>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u043c \u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 linux, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u043c\u0438. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u043e\u0447\u0435\u043c\u0443 COM-\u043f\u043e\u0440\u0442 \u043d\u0435 \u043f\u043e\u0440\u0442, \u0430 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b, \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043f\u043e\u0440\u0442. \u042d\u0442\u043e\u0442 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430. \u0418, \u0432 \u0441\u0438\u043b\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u0447\u0438\u043d, \u043d\u0435\u0441\u0451\u0442 \u044d\u0442\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0438\u0435 \u0434\u0430\u043b\u044c\u0448\u0435. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438 \u0432 linux (\u0442\u0435\u043c \u0436\u0435 i2c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0449\u0435). \u0420\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0436\u0435\u043b\u0435\u0437\u043e\u043c, \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u043f\u043e\u0440\u0442\u0430\u043c\u0438 \u0438\u0434\u0451\u0442 \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u044f\u0434\u0440\u0430 linux. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u043e\u0440\u0442\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. \u0414\u0430\u043b\u044c\u0448\u0435 \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0436\u0434\u0443\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443, \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (\u0430\u043d\u0430\u043b\u043e\u0433 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e), \u043b\u0438\u0431\u043e \u043b\u044e\u0431\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0432\u043a\u0443\u0441 \u0438 \u0446\u0432\u0435\u0442.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u0440\u0443\u0433\u043e\u0437\u043e\u0440, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043c\u043e\u0439 \u0432\u0435\u0431\u0438\u043d\u0430\u0440 \u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u0432 \u043f\u043e\u0434 \u043b\u0438\u043d\u0443\u043a\u0441. \u0422\u0430\u043c \u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438 \u0441 \u0436\u0438\u0432\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043e\u0431 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u0438\u0434\u0435\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b:<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6143a0e5ad041b3b9bfdc72c\" data-style=\"\" id=\"6143a0e5ad041b3b9bfdc72c\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6143a0e6abb378f6450d19b7\" data-style=\"\" id=\"6143a0e6abb378f6450d19b7\" width=\"\"><\/div>\n<\/div>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0432\u0438\u0434\u0435\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/dlinyj\/rs-232_linux_example\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a>.<\/p>\n<p>  \u0412\u0441\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443 <a href=\"https:\/\/github.com\/dlinyj\/linux_com_port\">\u043c\u0435\u043d\u044f \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435.<\/a><\/p>\n<h2><font color=\"#3AC1EF\">\u258d P.S.<\/font><\/h2>\n<p>  \u0420\u0430\u043d\u0435\u0435 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/we.easyelectronics.ru\/electro-and-pc\/rabota-s-som-portom-na-si-v-linux.html\">easyelectronics.ru<\/a>, \u043d\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u0445\u0430\u0431\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0441\u0435\u0449\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u0433, \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0441 \u043d\u0435\u0439 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043e\u0447\u0435\u043d\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430. \u0414\u0430 \u0438 \u0442\u0435\u043c\u0430 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u0430, \u0447\u0442\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0451 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c.<\/p>\n<p>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=dlinyj&amp;utm_content=rabota_s_som-portom_na_si_v_linux\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/578432\/\"> https:\/\/habr.com\/ru\/articles\/578432\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/578432\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/3o\/ns\/ai\/3onsaiuef8v8o9vlyzww0iim3bu.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/3o\/ns\/ai\/3onsaiuef8v8o9vlyzww0iim3bu.jpeg\" data-blurred=\"true\"\/><\/div>\n<p><\/a><i><font color=\"#999999\">\u0422\u0435\u043b\u0435\u0442\u0430\u0439\u043f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0411\u042d\u0412\u041c \u043c\u043e\u0433\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. <a href=\"https:\/\/xlat.livejournal.com\/737822.html\">\u0424\u043e\u0442\u043e \u0432\u0437\u044f\u0442\u043e \u0437\u0434\u0435\u0441\u044c.<\/a><\/font><\/i><\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u0438\u043a\u043e\u0439 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u043c \u043f\u043e\u0434 \u043b\u0438\u043d\u0443\u043a\u0441\u043e\u043c. \u041d\u0435\u0434\u0430\u0440\u043e\u043c, \u043c\u043e\u044f \u0441\u0442\u0430\u0442\u044c\u044f &#171;<a href=\"https:\/\/habr.com\/ru\/post\/109395\/\">UART \u0438 \u0441 \u0447\u0435\u043c \u0435\u0433\u043e \u0435\u0434\u044f\u0442<\/a>&#187; \u0441\u043f\u0443\u0441\u0442\u044f 11 \u043b\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u044b \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. <\/p>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u043f\u0440\u044f\u0447\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a, \u043b\u0438\u0431\u043e \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u043e\u0434\u043d\u043e\u043f\u043b\u0430\u0442\u043d\u0438\u043a\u043e\u043c. \u0414\u0430 \u0447\u0442\u043e \u0433\u0440\u0435\u0445\u0430 \u0442\u0430\u0438\u0442\u044c, \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 2021 \u0433\u043e\u0434\u0443 UART, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u0441\u044e \u0435\u0433\u043e \u0430\u0440\u0445\u0430\u0438\u0447\u043d\u043e\u0441\u0442\u044c. \u0414\u0430\u043b\u0435\u043a\u043e \u0437\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430, \u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0443 \u0432\u0430\u0441 \u0432 \u043a\u0430\u0440\u043c\u0430\u043d\u0435, \u0431\u0443\u0434\u0435\u0442 \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a UART \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u0441\u0430\u043c\u044b\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 SIM-\u043a\u0430\u0440\u0442\u044b.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043c\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u0430\u043c\u0438 \u0432 linux \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u043e. \u0418 \u0432\u043e\u0442, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, UART, \u0434\u0440\u0435\u0432\u043d\u0435\u0439\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0438 \u0434\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043b\u043e\u043c\u0430\u044e\u0442 \u0437\u0443\u0431\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u043d\u0438\u043c \u0432 \u043b\u0438\u043d\u0443\u043a\u0441\u0435. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u0440\u043a \u0441 \u043a\u043e\u043d\u044f\u043c\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0441\u044b\u0440\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e RS-485. \u041d\u0435 \u0437\u043d\u0430\u044e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b \u0433\u043e\u0440\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u041f\u041e \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0421\u0430\u043c\u043e\u0435 \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u043e\u043c\u043e\u0434\u043d\u044b\u043c i2c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043b\u0438\u043d\u0443\u043a\u0441\u0435 \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u0441 \u043e\u0440\u0442\u043e\u0434\u043e\u043a\u0441\u0430\u043b\u044c\u043d\u044b\u043c UART. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b \u0434\u0430\u043b\u044c\u0448\u0435, \u0432\u0441\u0451 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e UART (RS-232, RS-485, UART 5V, UART 3,3 \u0438 \u0442.\u0434.) \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u044f \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c COM-\u043f\u043e\u0440\u0442 \u0438\u043b\u0438 UART. \u041c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0430 \u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u0430.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0441 UART \u0432 \u041e\u0421 Linux. \u0418 \u043d\u0435\u0432\u0430\u0436\u043d\u043e \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 UART (python, c, c++, bash, php, perl \u0438 \u0442.\u0434.), \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0433\u0440\u0430\u0431\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0432\u0441\u0451 \u0443\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043a \u044f\u0434\u0440\u0443. \u0410 \u043d\u0435\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u0430\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0442\u0440\u0443\u0434\u043d\u043e\u0443\u043b\u043e\u0432\u0438\u043c\u044b\u043c \u0431\u0430\u0433\u0430\u043c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-390729","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/390729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=390729"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/390729\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=390729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=390729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=390729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}