{"id":211,"date":"2020-09-16T20:56:09","date_gmt":"2020-09-16T17:56:09","guid":{"rendered":"https:\/\/sanana.kiev.ua\/?p=211"},"modified":"2020-09-22T22:38:21","modified_gmt":"2020-09-22T19:38:21","slug":"moxa-uport-1450i","status":"publish","type":"post","link":"https:\/\/sanana.kiev.ua\/index.php\/archives\/211","title":{"rendered":"Moxa UPort 1450I"},"content":{"rendered":"<p>\u041f\u043e\u043f\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0437\u0432\u0435\u0440\u044c \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u041f\u0422\u041a. \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u0432 \u044f\u0434\u0440\u0435 \u0432\u0440\u043e\u0434\u0435 \u0435\u0441\u0442\u044c, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u0422\u043e\u0447\u043d\u0435\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0445\u043e\u0442\u044f \u0436\u0435\u043b\u0435\u0437\u043a\u0430 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0436\u0438\u043c\u044b RS232\/RS422\/RS485, \u0438 \u0434\u0430\u0436\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0444\u0430\u0439\u043d\u044b \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442, \u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0440\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 RS232, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0447\u0435\u0440\u0435\u0437 setserial \u0438\u043b\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0447\u0435\u0440\u0435\u0437 ioctl(TIOCSSERIAL,\u2026) \u043d\u0435\u0442 \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 ioctl (\u043b\u044e\u0431\u044b\u0445) \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435.<\/p>\n<p>\u0414\u0440\u0430\u0439\u0432\u0435\u0440\u0430, \u0441\u0442\u044f\u043d\u0443\u0442\u044b\u0435 \u0441 \u0441\u0430\u0439\u0442\u0430 \u043c\u043e\u0445\u0438 \u043c\u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c. \u041b\u0430\u043f\u0448\u0430 \u0438 \u043e\u0432\u0435\u0440\u0445\u0435\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0435\u0449\u0435 \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0445\u0430\u0447\u0435\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e usb-serial. \u041d\u0443 \u0438\u0445<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0443\u043c\u0430\u043b \u0437\u0430\u043f\u0438\u043b\u0438\u043b\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <b>ioctl<\/b> \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0448\u0438\u043b &#8211; \u043d\u0430\u0445\u0435\u0440 \u043c\u043d\u0435 \u044d\u0442\u043e\u0442 \u0433\u0435\u043c\u043e\u0440, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u044f \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c.<br \/>\n\u041f\u043e\u0442\u043e\u043c\u0443 \u043e\u0431\u043e\u0448\u0435\u043b\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043e\u043f\u0446\u0438\u0435\u0439. \u041f\u0430\u0442\u0447\u0438\u043a, \u043a\u043e\u043c\u0443 \u043d\u0430\u0434\u043e. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u043f\u0446\u0438\u044e modes &#8211; \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e 16 \u0447\u0438\u0441\u0435\u043b, \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043f\u043e\u0440\u0442\u043e\u0432<\/p>\n<pre style=\"color:#839496; background-color:#002b36; font-size:10pt; font-family:'Courier New',monospace;\">\r\n<span style=\"color:#cb4b16\">--- linux\/drivers\/usb\/serial\/mxuport.c.orig     2020-09-03 12:19:28.000000000 +0300<\/span>\r\n<span style=\"color:#859900\">+++ linux\/drivers\/usb\/serial\/mxuport.c     2020-09-07 09:37:25.653498042 +0300<\/span>\r\n<span style=\"color:#93a1a1\">&#64;&#64; -155,6 +155,9 &#64;&#64;<\/span>\r\n #define MX_UPORT_8_PORT                       BIT(2)\r\n #define MX_UPORT_16_PORT              BIT(3)\r\n \r\n<span style=\"color:#859900\">+\/* initial ports modes *\/<\/span>\r\n<span style=\"color:#859900\">+static int modes[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };<\/span>\r\n<span style=\"color:#859900\">+<\/span>\r\n \/* This structure holds all of the local port information *\/\r\n struct mxuport_port {\r\n       u8 mcr_state;           \/* Last MCR state *\/\r\n<span style=\"color:#93a1a1\">&#64;&#64; -1136,10 +1139,11 &#64;&#64;<\/span>\r\n       if (err)\r\n               return err;\r\n \r\n<span style=\"color:#cb4b16\">-  \/* Set interface (RS-232) *\/<\/span>\r\n<span style=\"color:#859900\">+  \/* Set interface mode (RS-232\/RS-422\/RS-485) *\/<\/span>\r\n<span style=\"color:#859900\">+  dev_info(&amp;serial-&gt;interface-&gt;dev, &quot;Set port %d to mode %d\\n&quot;, <\/span>\r\n<span style=\"color:#859900\">+                   port-&gt;port_number, modes[port-&gt;port_number]);<\/span>\r\n       return mxuport_send_ctrl_urb(serial, RQ_VENDOR_SET_INTERFACE,\r\n<span style=\"color:#cb4b16\">-                               MX_INT_RS232,<\/span>\r\n<span style=\"color:#cb4b16\">-                               port-&gt;port_number);<\/span>\r\n<span style=\"color:#859900\">+                               modes[port-&gt;port_number], port-&gt;port_number);<\/span>\r\n }\r\n \r\n static int mxuport_alloc_write_urb(struct usb_serial *serial,\r\n<span style=\"color:#93a1a1\">&#64;&#64; -1398,3 +1402,6 &#64;&#64;<\/span>\r\n MODULE_AUTHOR(&quot;Andrew Lunn &lt;andrew&#64;lunn.ch&gt;&quot;);\r\n MODULE_AUTHOR(&quot;&lt;support&#64;moxa.com&gt;&quot;);\r\n MODULE_LICENSE(&quot;GPL&quot;);\r\n<span style=\"color:#859900\">+<\/span>\r\n<span style=\"color:#859900\">+module_param_array(modes, int, NULL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);<\/span>\r\n<span style=\"color:#859900\">+MODULE_PARM_DESC(modes, &quot;Initial modes for ports (up to 16). 0 - RS232, 1 - RS485(2W), 2 - RS422, 3 - RS485(4W)&quot;);<\/span>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u043f\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0437\u0432\u0435\u0440\u044c \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u041f\u0422\u041a. \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u0432 \u044f\u0434\u0440\u0435 \u0432\u0440\u043e\u0434\u0435 \u0435\u0441\u0442\u044c, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u0422\u043e\u0447\u043d\u0435\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0445\u043e\u0442\u044f \u0436\u0435\u043b\u0435\u0437\u043a\u0430 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0436\u0438\u043c\u044b RS232\/RS422\/RS485, \u0438 \u0434\u0430\u0436\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0444\u0430\u0439\u043d\u044b \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442, \u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0440\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 RS232, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0447\u0435\u0440\u0435\u0437 setserial \u0438\u043b\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0447\u0435\u0440\u0435\u0437 ioctl(TIOCSSERIAL,\u2026) \u043d\u0435\u0442 &hellip; <a href=\"https:\/\/sanana.kiev.ua\/index.php\/archives\/211\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u0432\u0436\u0438\u0442\u0438 \u0447\u0438\u0442\u0430\u043d\u043d\u044f<span class=\"screen-reader-text\"> &#8220;Moxa UPort 1450I&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[21,22],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-tipstricks","tag-kernel","tag-serial"],"_links":{"self":[{"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/posts\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/comments?post=211"}],"version-history":[{"count":6,"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":217,"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/posts\/211\/revisions\/217"}],"wp:attachment":[{"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/media?parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/categories?post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanana.kiev.ua\/index.php\/wp-json\/wp\/v2\/tags?post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}