{"id":364161,"date":"2024-05-21T02:11:22","date_gmt":"2024-05-21T02:11:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=364161"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T02:11:22","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=364161","title":{"rendered":"<span>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 HID-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430: \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/mc\/3d\/2d\/mc3d2dfobdlwboi6iwg--bnzc_o.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/mc\/3d\/2d\/mc3d2dfobdlwboi6iwg--bnzc_o.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0438\u0440 <strong>Human Interface Device<\/strong> (<em>HID<\/em>) \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 <a href=\"https:\/\/kpda.ru\/products\/kpda10964\/\">\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u00ab\u041d\u0435\u0439\u0442\u0440\u0438\u043d\u043e\u00bb<\/a>. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u0440\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 <em>HID<\/em> \u0438 \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0432\u0432\u043e\u0434\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0437\u0430\u0442\u0440\u043e\u043d\u0435\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043d\u043e\u0433\u043e <em>API<\/em> \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u043c, \u043d\u043e, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<hr\/>\n<p>  <\/p>\n<h1 id=\"obschee-predstavlenie-arhitektury-hid-drayverov\">\u041e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b HID \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432<\/h1>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0445 \u043f\u0440\u0438\u0440\u043e\u0434\u0443 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><em>HID<\/em> \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0432\u0432\u043e\u0434\u0430. \u041e\u043d \u0441\u044b\u0433\u0440\u0430\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0440\u043e\u043b\u044c \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445. \u041f\u043e\u043c\u043e\u0433 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c: \u043e\u0442 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440 \u0434\u043e \u0433\u0435\u0439\u043c\u043f\u0430\u0434\u043e\u0432, \u043e\u0442 \u043c\u044b\u0448\u0435\u0439 \u0434\u043e \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u044d\u043a\u0440\u0430\u043d\u043e\u0432. \u0412\u0441\u0435 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u0435\u0436\u0434\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c \u0438 \u043c\u0430\u0448\u0438\u043d\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u0437 \u043e\u0431\u0438\u043b\u0438\u044f \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438, \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043c\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0443\u044e \u043e\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/li>\n<li>\u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439. \u0421\u0430\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0440\u0435\u043f\u043e\u0440\u0442\u0430 \u0438 \u043e\u0442\u0447\u0435\u0442\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445: \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 USB \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 <a href=\"https:\/\/www.usb.org\/sites\/default\/files\/hid1_11.pdf\">\u043f\u043e\u043b\u043d\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0435 \u0438 \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0435<\/a> <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041f\u0435\u0440\u0432\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e 60 000 \u0431\u0430\u0439\u0442 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 64 \u0431\u0430\u0439\u0442\u0430\u043c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e 1 \u043c\u0441, \u0430 \u0432\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 800 \u0431\u0430\u0439\u0442 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 8 \u0431\u0430\u0439\u0442\u0430\u043c \u043a\u0430\u0436\u0434\u044b\u0435 10 \u043c\u0441.<\/li>\n<li><em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0441\u0432\u043e\u0435\u0433\u043e \u043e\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438;<\/li>\n<li>\u041e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0435\u043f\u043e\u0440\u0442\u043e\u0432: \u0432\u0441\u044f \u0441\u0432\u044f\u0437\u044c \u0441 <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e &#171;\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0440\u0435\u043f\u043e\u0440\u0442\u0430&#187; (<em>report descriptor<\/em>). \u0414\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0440\u0435\u043f\u043e\u0440\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u043e 65 535 \u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u043c\u0435\u0435\u0442 \u0433\u0438\u0431\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u0435\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<li><em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 \u0440\u0435\u043f\u043e\u0440\u0442\u0430;<\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0432\u0430\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 <em>HID<\/em>-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u0439 <a href=\"https:\/\/kpda.ru\/products\/kpda10964\/\"><em>\u041e\u0421<\/em><\/a> \u043e\u0431\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0432\u0432\u043e\u0434\u0430 \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/ka\/9y\/uf\/ka9yufxzfgwujr5ljj7tekd3i6s.jpeg\" alt=\"\u041e\u0431\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u0432\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043e\u043a\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f Photon (legacy)\" title=\"\u041e\u0431\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u0432\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043e\u043a\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f Photon (legacy)\" data-src=\"https:\/\/habrastorage.org\/webt\/ka\/9y\/uf\/ka9yufxzfgwujr5ljj7tekd3i6s.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p><em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430. \u0418\u0445 \u0432\u0437\u0430\u0438\u043c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/6j\/cp\/mr\/6jcpmrmxkpahx0uopkwzdg4ky2o.jpeg\" alt=\"\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b HID-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\" title=\"\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b HID-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\" data-src=\"https:\/\/habrastorage.org\/webt\/6j\/cp\/mr\/6jcpmrmxkpahx0uopkwzdg4ky2o.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p><em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 <a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/services\/io-hid.html\"><em>HID<\/em>-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c<\/a> \u0438 <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0437\u0430\u0434\u0430\u0447\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0445 \u043e\u0442 <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0434\u043b\u044f \u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f <em>HID<\/em>-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c. \u042d\u0442\u043e \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u043a\u043b\u0438\u043a \u043c\u044b\u0448\u0438, \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435), \u043d\u043e \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e &#171;\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f&#187; \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0432\u0432\u043e\u0434\u0430.<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<h1 id=\"hid-drayver-iznutri\">HID-\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0438\u0437\u043d\u0443\u0442\u0440\u0438<\/h1>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438\u0437 \u0447\u0435\u0433\u043e \u0436\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435:<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/programmers_guide\/ddk\/HID\/module\/io_hid_dll_entry_t.html\"><em>io_hid_dll_entry_t<\/em><\/a> \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">  #include &lt;sys\/io-hid.h>    typedef struct _io_hid_dll_entry   {       char    *name;       int     nfuncs;       int     (*init)( void *dll_hdl, dispatch_t *dpp,                        io_hid_self_t *ioh, char *args );       int     (*shutdown)( void *dll_hdl );   } io_hid_dll_entry_t;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e\u043b\u044f <em>name<\/em> (\u0438\u043c\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430), <em>nfuncs<\/em> (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430), <em>init<\/em> \u0438 <em>shutdown<\/em> (\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438).<\/p>\n<p>  <\/li>\n<li>\n<p><em>io_hid_registrant_funcs_t<\/em> \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">  #include &lt;sys\/io-hid.h>    typedef struct _io_hid_registrant_funcs   {       _Uint32t    nfuncs;       int         (*client_attach)( int reg_hdl, void *user );       int         (*client_detach)( int reg_hdl, void *user );       \/* \u2026 *\/   } io_hid_registrant_funcs_t;<\/code><\/pre>\n<p>  <\/p>\n<p><em>io_hid_registrant_funcs_t<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0441 <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c, \u0438\u043d\u0430\u0447\u0435 \u2013 <strong>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435<\/strong> \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041a\u0430\u0436\u0434\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043e\u0442 <em>HID<\/em>-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>client_attach<\/em>\/<em>client_detach<\/em> \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f\/\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a\/\u043e\u0442 <em>io-hid<\/em>. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/programmers_guide\/ddk\/HID\/api\/io_hid_registrant_funcs_t.html\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0437 \u0447\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440. \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0439 \u043f\u043e <em>RS-232<\/em> \u043c\u044b\u0448\u0438.<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<h1 id=\"implementaciya-hid-drayvera\">\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f HID-\u0414\u0440\u0430\u0439\u0432\u0435\u0440\u0430<\/h1>\n<p>  <\/p>\n<h3 id=\"zapolnyaem-strukturu-io_hid_dll_entry_t\">\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <em>io_hid_dll_entry_t<\/em><\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;sys\/io-hid.h>  io_hid_dll_entry_t io_hid_dll_entry = {     \"devh-sample\",     _IO_HID_DLL_NFUNCS,     init,     stop };<\/code><\/pre>\n<p>  <\/p>\n<p><em>name<\/em> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 <em>io-hid<\/em>. \u041f\u0440\u0435\u0444\u0438\u043a\u0441 <strong>\u201cdevh-\u201d<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 <em>HID<\/em>-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c \u0438\u043c\u0435\u043d \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432. <em>_IO_HID_DLL_NENTRY<\/em> \u2013 \u043c\u0430\u043a\u0440\u043e\u0441 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 <em>io_hid_dll_entry_t<\/em>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 io-hid \u0441 devh-sample.so<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">io-hid -d sample &amp;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438\u043b\u0438<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">io-hid &amp; mount -T io-hid devh-sample.so<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0417\u0430\u0432\u0435\u0434\u0435\u043c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0445\/\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">typedef struct _ctrl {     void                *dll_hdl;     io_hid_self_t       *ioh;     char                *path;     pthread_t           tid;     int                 fd; } ctrl_t;  typedef struct _sample {     int                 hid_hdl; } sample_t;  ctrl_t  Ctrl;<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440?<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 <em>HID<\/em>-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0435 \u0438 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<p>  <\/p>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438 \u0442. \u0434. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u043f\u043e\u0440\u0442\u043e\u0432, \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 <em>HID<\/em>-\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0432\u0430\u043d\u0438\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0432\u0432\u043e\u0434\u0430 (\u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448, \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043c\u044b\u0448\u0438 \u0438 \u0442. \u0434.), \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u0443 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0438 \u0445\u043e\u0442\u044f\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <em>HID<\/em>-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u043e\u043b\u044f \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u043d\u043e \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 (<em>hid_hdl<\/em>).<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043d-\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0439. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<p><strong><a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/programmers_guide\/ddk\/HID\/module\/init.html\"><em>io_hid_dll_entry_t :: init<\/em><\/a><\/strong><\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0448\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u041e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 <em>io-hid<\/em>.<br \/>  \u0412 \u043d\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0434\u043d\u0443 \u043e\u043f\u0446\u0438\u044e \u2013 \u043f\u0443\u0442\u044c \u043a \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 <em>serial<\/em>-\u043f\u043e\u0440\u0442\u0430):<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">char *opts[] = {     \"path\",     NULL };  int start_driver( char *options ) {     char *value;      Ctrl.path = \"\/dev\/ser1\";      while ( options &amp;&amp; *options != '\\0' )     {         switch ( getsubopt( &amp;options, opts, &amp;value ) )         {             case 0:                 if ( value != NULL )                     Ctrl.path = value;                 break;             default:                 break;         }     }      return (EOK); }<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c <a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/programmers_guide\/ddk\/HID\/module\/hidd_device_ident_t.html\"><em>hidd_device_ident_t<\/em><\/a> \u0438 <a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/programmers_guide\/ddk\/HID\/module\/io_hid_registrant_t.html\"><em>io_hid_registrant_t<\/em><\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043e\u0442\u0447\u0435\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static unsigned char rdesc[] = {     \/* ... *\/ };  int get_report_descriptor ( sample_t *sample ) {     hidd_device_ident_t device_ident;     io_hid_registrant_t dev;     int                 sample_hdl;      int result = EOK;      device_ident.vendor_id = 0;     device_ident.product_id = 0;     device_ident.version = 0x100;      dev.flags = 0;     dev.device_ident = &amp;device_ident;     dev.desc = rdesc;     dev.dlen = sizeof (rdesc);     dev.user_hdl = sample;      dev.funcs = &amp;sample_funcs;      result = (*Ctrl.ioh->reg)( Ctrl.dll_hdl, &amp;dev, &amp;sample_hdl );     if ( result == EOK )         sample->hid_hdl = sample_hdl;      return (result); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 <em>hidd_device_ident_t<\/em> \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0432\u0432\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f <em>io_hid_registrant_t<\/em> \u2013 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<p>  <\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void *event_hdl_polling( void *data ) {     sample_t            *sample;     uint8_t             buffer[256];     int                 count, i;     uint32_t            packet_len;      sample = (sample_t *)data;      memset( buffer, 0, sizeof( uint8_t ) * 256 );      for ( ;; )     {           memset( buffer, 0, sizeof( uint8_t ) * 256 );          count = read( Ctrl.fd, buffer, sizeof( uint8_t ) * 256 );         if ( count > 0 )         {             \/*               * \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445              * \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430,              * \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c              *\/              \/* ... *\/              \/* \u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 io-hid *\/             (*Ctrl.ioh->send_report)( sample->hid_hdl,                                       (uint8_t *)buffer,                                       (uint32_t)packet_len );         }     }      return NULL; }<\/code><\/pre>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int init( void *dll_hdl, dispatch_t *dpp, io_hid_self_t *ioh, char *args ) {     pthread_attr_t      attr;     sample_t            sample;      int result = EOK;      Ctrl.dll_hdl = dll_hdl;     Ctrl.ioh     = ioh;      ThreadCtl( _NTO_TCTL_IO, 0 );      memset( &amp;Ctrl, 0, sizeof( Ctrl ) );      start_driver( args );      if ( (Ctrl.fd = open( Ctrl.path, O_RDONLY )) == -1 )         return (EXIT_FAILURE);      get_report_descriptor( &amp;sample );      pthread_attr_init( &amp;attr );      result = pthread_create( &amp;Ctrl.tid, &amp;attr,                                 (void *)event_hdl_polling, &amp;sample );      if ( result != EOK )         return (EXIT_FAILURE);      return (EOK); }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 rdesc?<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>rdesc \u2013 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0440\u0435\u043f\u043e\u0440\u0442\u043e\u0432 (<em>Report Descriptors<\/em>). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0432\u043e\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. C\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0445 \u043e\u0442\u0447\u0435\u0442\u0430\u0445, \u0438 \u043a\u0430\u043a \u043e\u043d\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static unsigned char rdesc[] = {     0x05, 0x01,     \/\/ Usage Page(Generic Desktop)     0x09, 0x02,     \/\/ Usage (Mouse)     0xa1, 0x01,     \/\/ Collection(Application)     0x09, 0x01,         \/\/ Usage(Pointer)     0xa1, 0x00,         \/\/ Collection(Physical)     0x05, 0x09,             \/\/ Usage Page(Button)     0x19, 0x01,             \/\/ Usage Min(1)     0x29, 0x03,             \/\/ Usage Max(3)     0x15, 0x00,             \/\/ Logical Min(0)     0x25, 0x01,             \/\/ Logical Max(1)     0x95, 0x03,             \/\/ Report Count(3)     0x75, 0x01,             \/\/ Report Size(1)     0x81, 0x02,             \/\/ Input(Data,Variable,Absolute)     0x95, 0x01,             \/\/ Report Count(1)     0x75, 0x05,             \/\/ Report Size(5)     0x81, 0x03,             \/\/ Input(Cnst,Variable,Absolute)     0x05, 0x01,             \/\/ Usage Page(Generic Desktop)     0x09, 0x30,             \/\/ Usage(X)     0x09, 0x31,             \/\/ Usage(Y)     0x15, 0x81,             \/\/ Logical Min(-127)     0x25, 0x7F,             \/\/ Logical Max(127)     0x75, 0x08,             \/\/ Report Size(8)     0x95, 0x02,             \/\/ Report Count(2)     0x81, 0x06,             \/\/ Input(Data,Variable,Rel)     0xc0,               \/\/ End Collection     0xc0            \/\/ End Collection };<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong><a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/programmers_guide\/ddk\/HID\/module\/shutdown.html\"><em>io_hid_dll_entry_t :: stop<\/em><\/a><br \/>  <\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0434\u0435\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 <em>init<\/em> \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int stop( void *dll_hdl ) {     pthread_cancel( Ctrl.tid );     pthread_join( Ctrl.tid, NULL );     close( Ctrl.fd );      return (EOK); }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"zapolnyaem-strukturu-io_hid_registrant_funcs_t\">\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <em>io_hid_registrant_funcs_t<\/em><\/h3>\n<p>  <\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 <em>io_hid_registrant_t<\/em> \u043c\u044b \u043d\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u0440\u043e <em>sample_funcs<\/em>. \u0412\u044b\u0448\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <em>io_hid_registrant_funcs_t<\/em> \u2013 <em>sample_funcs<\/em> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u044e.<\/p>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 <em>stub<\/em> \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 <em>EOK<\/em>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int client_attach( int reg_hdl, void *user ) {     return (EOK); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c <em>io_hid_registrant_funcs_t<\/em> \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u043c <em>_IO_HID_REG_NFUNCS<\/em> \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;sys\/io-hid.h>  static io_hid_registrant_funcs_t sample_funcs = {     _IO_HID_REG_NFUNCS,     client_attach,     client_detach,     rbuffer_alloc,     rbuffer_free,     report_read,     report_write,     get_idle,     set_idle,     get_protocol,     set_protocol,     get_string,     get_indexed_string,     reset, };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u043c\u044b\u0448\u0438 <em>RS-232<\/em>, \u043d\u0443\u0436\u0434\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f <strong>\u043b\u0438\u0448\u044c<\/strong> \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0433\u043e <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/3k\/hp\/av\/3khpavlvkigndcaifxbw4j8w9co.jpeg\" alt=\"\u041e\u0431\u0449\u0438\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b HID-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\" title=\"\u041e\u0431\u0449\u0438\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b HID-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\" data-src=\"https:\/\/habrastorage.org\/webt\/3k\/hp\/av\/3khpavlvkigndcaifxbw4j8w9co.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/git.kpda.ru\/drivers\/hid\">\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a>. \u0422\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f <em>USB<\/em>-\u0442\u0430\u0447\u0441\u043a\u0440\u0438\u043d\u043e\u0432 <em>Egalax<\/em> \u0438 <em>GPIO<\/em>-\u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440.<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<h1 id=\"vmesto-zaklyucheniya\">\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h1>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c \u043a\u0440\u0430\u0442\u043a\u043e \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <em>HID<\/em>-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u041d\u0435\u0439\u0442\u0440\u0438\u043d\u043e. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043d\u043e\u0435 <em>API<\/em> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/programmers_guide\/ddk\/HID.html\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (<a href=\"https:\/\/help.kpda.ru\/neutrino\/2021\/help\/topic\/ru.kpda.doc.os\/html\/system_architecture\/kernel\/5_Resource_Managers.html\">\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/a>) \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (<em>I2C<\/em>, <em>SPI<\/em>, <em>etc<\/em>.), \u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u0441 \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<blockquote><p><b><a href=\"https:\/\/t.me\/CBD_BC\"> \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043d\u0430\u0448 \u043a\u0430\u043d\u0430\u043b, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0432 \u043a\u0443\u0440\u0441\u0435 \u0441\u0432\u0435\u0436\u0438\u0445 \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/623\/8de\/b40\/6238deb40cb4bc8689f3847783931e73.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/623\/8de\/b40\/6238deb40cb4bc8689f3847783931e73.png\"\/><\/a><\/b><\/p><\/blockquote>\n<p><a href=\"https:\/\/kpda.ru\/products\/kpda10964\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/f2f\/a7a\/967\/f2fa7a9678d8b92a5ca57a59aeaea0fe.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f2f\/a7a\/967\/f2fa7a9678d8b92a5ca57a59aeaea0fe.png\"\/><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/783582\/\"> https:\/\/habr.com\/ru\/articles\/783582\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/mc\/3d\/2d\/mc3d2dfobdlwboi6iwg--bnzc_o.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/mc\/3d\/2d\/mc3d2dfobdlwboi6iwg--bnzc_o.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0438\u0440 <strong>Human Interface Device<\/strong> (<em>HID<\/em>) \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 <a href=\"https:\/\/kpda.ru\/products\/kpda10964\/\">\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u00ab\u041d\u0435\u0439\u0442\u0440\u0438\u043d\u043e\u00bb<\/a>. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u0440\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 <em>HID<\/em> \u0438 \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0432\u0432\u043e\u0434\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0437\u0430\u0442\u0440\u043e\u043d\u0435\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043d\u043e\u0433\u043e <em>API<\/em> \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 <em>HID<\/em>-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u043c, \u043d\u043e, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-364161","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=364161"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364161\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}