{"id":318,"date":"2022-01-17T10:22:22","date_gmt":"2022-01-17T08:22:22","guid":{"rendered":"https:\/\/greenhouse.cv.ua\/?p=318"},"modified":"2022-01-17T10:22:22","modified_gmt":"2022-01-17T08:22:22","slug":"%d1%80%d0%b0%d0%b1%d0%be%d1%82%d0%b0-%d1%81-%d1%81%d0%be%d0%bc-%d0%bf%d0%be%d1%80%d1%82%d0%be%d0%bc-%d0%bd%d0%b0-%d1%81%d0%b8-%d0%b2-linux","status":"publish","type":"post","link":"https:\/\/greenhouse.cv.ua\/?p=318","title":{"rendered":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0421\u041e\u041c-\u043f\u043e\u0440\u0442\u043e\u043c \u043d\u0430 \u0421\u0438 \u0432 linux"},"content":{"rendered":"\n<p><a rel=\"noreferrer noopener\" href=\"http:\/\/we.easyelectronics.ru\/electro-and-pc\/rabota-s-som-portom-na-si-v-linux.html\" target=\"_blank\">\u0417\u0430\u043f\u043e\u0437\u0438\u0447\u0435\u043d\u043e \u0437 http:\/\/we.easyelectronics.ru<\/a><\/p>\n\n\n\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. \u0427\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 2020 \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.<br>\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.<br>\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\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"480\" src=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/fcaf7c.jpg\" alt=\"\" class=\"wp-image-319\" srcset=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/fcaf7c.jpg 720w, https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/fcaf7c-300x200.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/figure><\/div>\n\n\n\n<p>\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. \u0424\u043e\u0442\u043e&nbsp;<a href=\"https:\/\/xlat.livejournal.com\/737822.html\">\u0432\u0437\u044f\u0442\u043e \u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n\n\n\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. \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.<a><\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\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<\/h4>\n\n\n\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 \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, \u043a\u0430\u043d\u0430\u043b \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.<br>\u0424\u0430\u0439\u043b \u043c\u043e\u0436\u043d\u043e:&nbsp;\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. \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, \u0432 \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\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;sys\/types.h&gt;<br>#include &lt;sys\/stat.h&gt;<br>#include &lt;fcntl.h&gt;<br><br>int open(const char *pathname, int flags);<br>\/\/\u041b\u0438\u0431\u043e <br>int open(const char *pathname, int flags, mode_t mode); \/\/\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;unistd.h&gt;<br>int close(int fd); \/\/\u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b<\/code><\/pre>\n\n\n\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, \u044d\u0442\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;unistd.h&gt;<br>ssize_t read(int fd, void *buf, size_t count);<\/code><\/pre>\n\n\n\n<p>read() \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c count \u0431\u0430\u0439\u0442\u043e\u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044f fd \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 buf.<br>\u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e count \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e, \u0442\u043e read() \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 count \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c SSIZE_MAX, \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 read() \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\n\n\n<p><strong>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u0427\u0442\u043e \u043a\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\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.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;unistd.h&gt;<br>ssize_t write(int fd, const void *buf, size_t count);<\/code><\/pre>\n\n\n\n<p>write \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u043e count \u0431\u0430\u0439\u0442\u043e\u0432 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 buf \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 fd.<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 errno \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\n\n\n<p><strong>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \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.<\/strong><\/p>\n\n\n\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 read \u0438 write&nbsp;\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \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&nbsp;(\u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f), \u0438&nbsp;\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&nbsp;(\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\u0435 \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\n\n\n<h4 class=\"wp-block-heading\">\u0424\u0430\u0439\u043b-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e COM-\u043f\u043e\u0440\u0442\u0430<\/h4>\n\n\n\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 \/dev\/tty*, \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 tty. \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 \/dev\/ttyS0. \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 \/dev\/ttyUSB0, \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 \/dev\/ttyACM0.<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\n\n\n<pre class=\"wp-block-code\"><code>ls -la \/dev\/tty*<\/code><\/pre>\n\n\n\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\u0435\u043d \u0432\u0430\u0448 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \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\u0439 \u043f\u043e\u0442\u043e\u043a \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\n\n\n<pre class=\"wp-block-code\"><code>~$ echo \"Hello\" &gt; \/dev\/tty<br>Hello<\/code><\/pre>\n\n\n\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 \/dev\/tty, \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\u0435\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. \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\n\n\n<ul class=\"wp-block-list\"><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><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><li>^H \u2192 BS (Backspace, \\b ), ASCII 0x08<\/li><li>^J \u2192 LF (\u043f\u043e\u0434\u0430\u0447\u0430 \u043b\u0438\u043d\u0438\u0438, \\n ), ASCII 0x0A<\/li><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><li>^M \u2192 CR (\u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043a\u0430\u0440\u0435\u0442\u043a\u0438, \\r ), ASCII 0x0D<\/li><\/ul>\n\n\n\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.<br>\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\n\n\n<pre class=\"wp-block-code\"><code>stty -F \/dev\/tty -a<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>~$ stty -F \/dev\/tty -a<br>speed 38400 baud; rows 51; columns 238; line = 0;<br>intr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = &lt;undef&gt;; eol2 = &lt;undef&gt;; swtch = &lt;undef&gt;; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;<br>-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts<br>-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8<br>opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0<br>isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc<\/code><\/pre>\n\n\n\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.<br>\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\n\n\n<h4 class=\"wp-block-heading\">\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<\/h4>\n\n\n\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, struct termios, \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\u0435\u043d\u043d\u044b\u0445 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 &lt;termios.h&gt;. \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\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 tcgetattr() \u0438 tcsetattr().<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;termios.h>\n\nstruct termios {\n\u00a0tcflag_t c_iflag; \/* \u0444\u043b\u0430\u0433\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 *\/\n\u00a0tcflag_t c_oflag; \/* \u0444\u043b\u0430\u0433\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 *\/\n\u00a0tcflag_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 *\/\n\u00a0tcflag_t c_lflag; \/* \u0444\u043b\u0430\u0433\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 *\/\n\u00a0cc_t c_line; \u00a0 \u00a0 \u00a0\/* \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430 \u043b\u0438\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 *\/\n\u00a0cc_t c_cc&#91;NCCS]; \u00a0\/* \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b *\/\n};\n\nint tcgetattr(int fd, struct termios * tp);\n\nint tcsetattr(int fd, int oact, struct termios * tp);<\/code><\/pre>\n\n\n\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\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;fcntl.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;termios.h&gt;<br><br>int main (int argc, char ** argv)<br>{<br>&nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; struct termios oldsettings, newsettings;<br>&nbsp; &nbsp; &nbsp; &nbsp; tcgetattr(fileno(stdin), &amp;oldsettings);<br>&nbsp; &nbsp; &nbsp; &nbsp; newsettings = oldsettings;<br>&nbsp; &nbsp; &nbsp; &nbsp; newsettings.c_lflag &amp;= ~(ECHO|ICANON|ISIG);<br>&nbsp; &nbsp; &nbsp; &nbsp; newsettings.c_cc&#91;VMIN] = 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; newsettings.c_cc&#91;VTIME] = 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; tcsetattr(fileno(stdin), TCSANOW, &amp;newsettings);<br>&nbsp; &nbsp; &nbsp; &nbsp; printf(\"press &#91;q] to quit\\n\");<br>&nbsp; &nbsp; &nbsp; &nbsp; char rd_ch = '\\0';<br>&nbsp; &nbsp; &nbsp; &nbsp; int fd_in = open (\"\/dev\/tty\", O_RDONLY);<br>&nbsp; &nbsp; &nbsp; &nbsp; while(rd_ch != 'q') {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int read_count = read(fd_in, &amp;rd_ch, 1);<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; tcsetattr(fileno(stdin), TCSANOW, &amp;oldsettings);<br>&nbsp; &nbsp; &nbsp; &nbsp; return EXIT_SUCCESS;<br>}<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u0438\u043c\u0435\u0440&nbsp;<a href=\"https:\/\/github.com\/dlinyj\/com_for_easyelectronics\/blob\/master\/pressq.c\">\u043e\u0431\u0438\u0442\u0430\u0435\u0442 \u0432\u043e\u0442 \u0442\u0443\u0442<\/a>.<\/p>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>.\/pressq <br>press &#91;q] to quit<br>$<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>struct termios oldsettings, newsettings;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>tcgetattr(fileno(stdin), &amp;oldsettings);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>newsettings = oldsettings;<\/code><\/pre>\n\n\n\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>newsettings.c_lflag &amp;= ~(ECHO|ICANON|ISIG);<\/code><\/pre>\n\n\n\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&nbsp;<a href=\"https:\/\/www.opennet.ru\/man.shtml?topic=termios&amp;category=3&amp;russian=0\">\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b termios \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0443\u0442<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>newsettings.c_cc&#91;VMIN] = 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; newsettings.c_cc&#91;VTIME] = 1;<\/code><\/pre>\n\n\n\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 read \u0434\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 VTIME). \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 read. \u0415\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0435\u0442, \u0442\u043e read \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).<br>\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 read \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 read \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.&nbsp;<strong>\u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f read \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0430\u044f!<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tcsetattr(fileno(stdin), TCSANOW, &amp;newsettings);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>char rd_ch = '\\0';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int fd_in = open (\"\/dev\/tty\", O_RDONLY);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(rd_ch != 'q') {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int read_count = read(fd_in, &amp;rd_ch, 1);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/code><\/pre>\n\n\n\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 &#8220;\/dev\/tty&#8221; c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 open \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&nbsp;<em>fileno<\/em>, \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 \u2018q\u2019.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tcsetattr(fileno(stdin), TCSANOW, &amp;oldsettings);<\/code><\/pre>\n\n\n\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\n\n\n<h4 class=\"wp-block-heading\">\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<\/h4>\n\n\n\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 \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u0442 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void setup() {<br>&nbsp; &nbsp; Serial.begin(9600);<br>}<br><br>void loop() {<br>&nbsp; &nbsp; &nbsp;Serial.print(\"01234567890123456789\\n\\r\");<br>&nbsp; &nbsp; &nbsp;delay(2000);<br>}<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>dmesg -w<\/code><\/pre>\n\n\n\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\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>[83343.555600] usb 2-2: new full-speed USB device number 3 using ohci-pci<br>[83344.099687] usb 2-2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54<br>[83344.099694] usb 2-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0<br>[83344.099698] usb 2-2: Product: USB2.0-Serial<br>[83344.199375] usbcore: registered new interface driver usbserial_generic<br>[83344.205220] usbserial: USB Serial support registered for generic<br>[83344.247903] usbcore: registered new interface driver ch341<br>[83344.248341] usbserial: USB Serial support registered for ch341-uart<br>[83344.248819] ch341 2-2:1.0: ch341-uart converter detected<br>[83344.311747] usb 2-2: ch341-uart converter now attached to ttyUSB0<\/p><\/blockquote>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>$ ls -la \/dev\/ttyUSB0 <br>crw-rw---- 1 root dialout 188, 0 Oct 21 11:38 \/dev\/ttyUSB0<\/code><\/pre>\n\n\n\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 root, \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 dialout. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0432\u0435\u0434\u0451\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -a -G dialout $USER<\/code><\/pre>\n\n\n\n<p>\u0418 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo reboot<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>$ stty -F \/dev\/ttyUSB0 9600<br>$ cat \/dev\/ttyUSB0 <br>0123456789<br><br>0123456789<br><br>0123456789<br><br>0123456789<\/code><\/pre>\n\n\n\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.<br>\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 hexdump:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hexdump -C \/dev\/ttyUSB0<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"116\" src=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/030055.png\" alt=\"\" class=\"wp-image-320\" srcset=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/030055.png 654w, https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/030055-300x53.png 300w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">\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<\/h4>\n\n\n\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&nbsp;<a href=\"https:\/\/github.com\/xanthium-enterprises\/Serial-Port-Programming-on-Linux\/blob\/master\/USB2SERIAL_Read\/Reciever%20(PC%20Side)\/SerialPort_read.c\">\u0432\u0437\u044f\u0442 \u043e\u0442\u0441\u044e\u0434\u0430<\/a>&nbsp;\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&nbsp;<a href=\"https:\/\/github.com\/dlinyj\/com_for_easyelectronics\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043a \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n\n\n\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\n\n\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&nbsp;<a href=\"https:\/\/github.com\/dlinyj\/com_for_easyelectronics\/blob\/master\/bloking_read\/SerialPort_read.c\">SerialPort_read.c<\/a>:<\/p>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>fd = open(\"\/dev\/ttyUSB0\",O_RDWR | O_NOCTTY);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>struct termios SerialPortSettings;<br>tcgetattr(fd, &amp;SerialPortSettings);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>cfsetispeed(&amp;SerialPortSettings,B9600); <br>cfsetospeed(&amp;SerialPortSettings,B9600);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code><br>&nbsp; &nbsp; &nbsp; &nbsp; B0<br>&nbsp; &nbsp; &nbsp; &nbsp; B50<br>&nbsp; &nbsp; &nbsp; &nbsp; B75<br>&nbsp; &nbsp; &nbsp; &nbsp; B110<br>&nbsp; &nbsp; &nbsp; &nbsp; B134<br>&nbsp; &nbsp; &nbsp; &nbsp; B150<br>&nbsp; &nbsp; &nbsp; &nbsp; B200<br>&nbsp; &nbsp; &nbsp; &nbsp; B300<br>&nbsp; &nbsp; &nbsp; &nbsp; B600<br>&nbsp; &nbsp; &nbsp; &nbsp; B1200<br>&nbsp; &nbsp; &nbsp; &nbsp; B1800<br>&nbsp; &nbsp; &nbsp; &nbsp; B2400<br>&nbsp; &nbsp; &nbsp; &nbsp; B4800<br>&nbsp; &nbsp; &nbsp; &nbsp; B9600<br>&nbsp; &nbsp; &nbsp; &nbsp; B19200<br>&nbsp; &nbsp; &nbsp; &nbsp; B38400<br>&nbsp; &nbsp; &nbsp; &nbsp; B57600<br>&nbsp; &nbsp; &nbsp; &nbsp; B115200<br>&nbsp; &nbsp; &nbsp; &nbsp; B230400<\/code><\/pre>\n\n\n\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\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cflag &amp;= ~PARENB;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cflag &amp;= ~CSTOPB;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cflag &amp;= ~CSIZE;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cflag |= &nbsp;CS8;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cflag &amp;= ~CRTSCTS;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cflag |= CREAD | CLOCAL;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_iflag &amp;= ~(IXON | IXOFF | IXANY);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_iflag &amp;= ~(ICANON | ECHO | ECHOE | ISIG);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_oflag &amp;= ~OPOST;<\/code><\/pre>\n\n\n\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\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cc&#91;VMIN] = 40;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>SerialPortSettings.c_cc&#91;VTIME] = 10;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>tcsetattr(fd,TCSANOW,&amp;SerialPortSettings)<\/code><\/pre>\n\n\n\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 termios.<\/p>\n\n\n\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 \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 termios, \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\n\n\n<pre class=\"wp-block-code\"><code>while (1) {<br>&nbsp; tcflush(fd, TCIFLUSH); &nbsp; \/\/\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<br>&nbsp; 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 <br>&nbsp; printf(\"\\n\\n &nbsp;Bytes Rxed -%d\", bytes_read);<br>&nbsp; for(i=0;i&lt;bytes_read;i++)<br>&nbsp; &nbsp; printf(\"%c\",read_buffer&#91;i]); \/\/\u043f\u0435\u0447\u0430\u0442\u044c \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<br>}<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>$ gcc SerialPort_read.c -o SerialPort_read<br>$ .\/SerialPort_read <br><br>&nbsp;+----------------------------------+<br>&nbsp;| &nbsp; &nbsp; &nbsp; &nbsp;Serial Port Read &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br>&nbsp;+----------------------------------+<br>&nbsp; ttyUSB0 Opened Successfully <br>&nbsp; BaudRate = 9600 <br>&nbsp; StopBits = 1 <br>&nbsp; Parity &nbsp; = none<br><br>&nbsp; Bytes Rxed -11<br><br>&nbsp; 0123456789<br><br><br>&nbsp; Bytes Rxed -11<br><br>&nbsp; 0123456789<br>\u2026.<\/code><\/pre>\n\n\n\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\n\n\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\n\n\n<h4 class=\"wp-block-heading\">\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?<\/h4>\n\n\n\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&nbsp;<a href=\"https:\/\/www.opennet.ru\/man.shtml?topic=select&amp;category=2&amp;russian=0\">select<\/a>,&nbsp;<a href=\"https:\/\/www.opennet.ru\/man.shtml?topic=poll&amp;category=2&amp;russian=0\">poll<\/a>&nbsp;\u0438&nbsp;<a href=\"https:\/\/www.opennet.ru\/man.shtml?topic=epoll&amp;category=4&amp;russian=0\">epoll<\/a>. \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.<br>\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.&nbsp;<a href=\"https:\/\/github.com\/dlinyj\/com_for_easyelectronics\/tree\/master\/card_reader\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0438\u0442\u0430\u0435\u0442 \u0442\u0443\u0442<\/a>.<\/p>\n\n\n\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&nbsp;<a href=\"https:\/\/github.com\/dlinyj\/com_for_easyelectronics\/blob\/master\/card_reader\/uart.c\">\u0444\u0430\u0439\u043b\u0435 uart.c<\/a>.<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\u0432 \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\n\n\n<pre class=\"wp-block-code\"><code>fcntl(fd, F_SETFL, FNDELAY);<\/code><\/pre>\n\n\n\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.<br>\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 \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\n\n\n<pre class=\"wp-block-code\"><code>int read_com(int fd, int len , int timeout, uint8_t * buff){<br>&nbsp; &nbsp; &nbsp; &nbsp; int ret = 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; struct pollfd fds;<br>&nbsp; &nbsp; &nbsp; &nbsp; fds.fd=fd;<br>&nbsp; &nbsp; &nbsp; &nbsp; fds.events = POLLIN;<br>&nbsp; &nbsp; &nbsp; &nbsp; poll(&amp;fds, 1, timeout);<br>&nbsp; &nbsp; &nbsp; &nbsp; if(fds.revents &amp; POLLIN) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ret = read(fd, buff, len);<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; if(ret&lt;0){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ret = 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; return ret; <br>}<\/code><\/pre>\n\n\n\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.<br>\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\n\n\n<pre class=\"wp-block-code\"><code>struct pollfd fds;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>fds.fd=fd;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>fds.events = POLLIN;<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>poll(&amp;fds, 1, timeout);<\/code><\/pre>\n\n\n\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\n\n\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.<br>\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.<br>\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\n\n\n<pre class=\"wp-block-code\"><code>int write_com(int fd, uint8_t * buf, size_t size, int timeout){<br>&nbsp; &nbsp; &nbsp; &nbsp; int ret = 0;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; struct pollfd fds;<br>&nbsp; &nbsp; &nbsp; &nbsp; fds.fd=fd;<br>&nbsp; &nbsp; &nbsp; &nbsp; fds.events = POLLOUT;<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; poll(&amp;fds, 1, timeout);<br>&nbsp; &nbsp; &nbsp; &nbsp; if(fds.revents &amp; POLLOUT){<br>#ifdef USE_RTS<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set_rts(fd,RTS_SET);<br>#endif<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ret = write(fd, (uint8_t*)buf, size);<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tcdrain(fd); <br>#ifdef USE_RTS<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set_rts(fd,RTS_CLR);<br>#endif<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; if(ret!=size) return 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; return 1; <br>}<\/code><\/pre>\n\n\n\n<p>\u0417\u0434\u0435\u0441\u044c poll \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 tcdrain(fd); \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 fd, \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b. \u0424\u0443\u043d\u043a\u0446\u0438\u044e int set_rts(int fd, int on) \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\n\n\n<h4 class=\"wp-block-heading\">\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<\/h4>\n\n\n\n<p>\u041a\u0440\u043e\u043c\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 read \u0438 write, \u0435\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 ioctl, \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 termios, \u0432\u043d\u0438\u0437\u0443 \u0438\u043c\u0435\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 ioctl, \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 ioctl \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\n\n\n<pre class=\"wp-block-code\"><code>int set_rts(int fd, int on){<br>&nbsp; &nbsp; &nbsp; &nbsp; int flags;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; ioctl(fd, TIOCMGET, &amp;flags);<br>&nbsp; &nbsp; &nbsp; &nbsp; if (on) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flags |= TIOCM_RTS;<br>&nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flags &amp;= ~TIOCM_RTS;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; ioctl(fd, TIOCMSET, &amp;flags);<br>&nbsp; &nbsp; &nbsp; &nbsp; return 1;<br>} <\/code><\/pre>\n\n\n\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 &amp;flags.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ioctl(fd, TIOCMGET, &amp;flags);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>ioctl(fd, TIOCMSET, &amp;flags);<\/code><\/pre>\n\n\n\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\n\n\n<pre class=\"wp-block-code\"><code>int set_dtr(int fd, int on){<br>&nbsp; &nbsp; &nbsp; &nbsp; int flags;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; ioctl(fd, TIOCMGET, &amp;flags);<br>&nbsp; &nbsp; &nbsp; &nbsp; if (on) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flags |= TIOCM_DTR;<br>&nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flags &amp;= ~TIOCM_DTR;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; ioctl(fd, TIOCMSET, &amp;flags);<br>&nbsp; &nbsp; &nbsp; &nbsp; return 1;<br>}<\/code><\/pre>\n\n\n\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 \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \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\n\n\n<h4 class=\"wp-block-heading\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h4>\n\n\n\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). Di_halt \u043f\u0440\u043e\u0441\u0438\u043b \u043c\u0435\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u043c, \u043d\u043e \u044d\u0442\u043e \u0432\u0441\u0451 \u043b\u0438\u0448\u043d\u044f\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f. \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.<br>\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.<br>\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\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 RS-232 \u043f\u043e\u0434 \u043b\u0438\u043d\u0443\u043a\u0441\" width=\"750\" height=\"563\" src=\"https:\/\/www.youtube.com\/embed\/hnzbcjEYJuA?start=1&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 RS-232 \u043f\u043e\u0434 \u043b\u0438\u043d\u0443\u043a\u04412\" width=\"750\" height=\"563\" src=\"https:\/\/www.youtube.com\/embed\/gyLznXtNa2A?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\u0410\u0440\u0445\u0438\u0432 \u0432\u0438\u0434\u0435\u043e:<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"480\" style=\"aspect-ratio: 600 \/ 480;\" width=\"600\" controls src=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435-RS-232-\u043f\u043e\u0434-\u043b\u0438\u043d\u0443\u043a\u0441.mp4\"><\/video><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"720\" style=\"aspect-ratio: 900 \/ 720;\" width=\"900\" controls src=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435-RS-232-\u043f\u043e\u0434-\u043b\u0438\u043d\u0443\u043a\u04412.mp4\"><\/video><\/figure>\n\n\n\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&nbsp;<a href=\"https:\/\/github.com\/dlinyj\/rs-232_linux_example\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a>.<\/p>\n\n\n\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:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/dlinyj\/com_for_easyelectronics\">\u0412 \u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/linux_com_port-master.zip\">\u0410\u0440\u0445\u0438\u0432 17,01,22<\/a><a href=\"https:\/\/greenhouse.cv.ua\/wp-content\/uploads\/2022\/01\/linux_com_port-master.zip\" class=\"wp-block-file__button\" download>\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0438\u0442\u0438<\/a><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u043f\u043e\u0437\u0438\u0447\u0435\u043d\u043e \u0437 http:\/\/we.easyelectronics.ru \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. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 . . .<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7,3],"tags":[],"class_list":["post-318","post","type-post","status-publish","format-standard","hentry","category-linux","category-3"],"aioseo_notices":[],"featured_image_src":null,"author_info":{"display_name":"Bernyk Dmytro","author_link":"https:\/\/greenhouse.cv.ua\/?author=2"},"_links":{"self":[{"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=\/wp\/v2\/posts\/318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=318"}],"version-history":[{"count":5,"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=\/wp\/v2\/posts\/318\/revisions"}],"predecessor-version":[{"id":328,"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=\/wp\/v2\/posts\/318\/revisions\/328"}],"wp:attachment":[{"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greenhouse.cv.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}