{"id":324015,"date":"2021-05-30T21:00:24","date_gmt":"2021-05-30T21:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=324015"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=324015","title":{"rendered":"Stm32 + USB \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 C++. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435. \u0414\u0435\u043b\u0430\u0435\u043c CDC"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b Stm32, \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/549296\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439<\/a> \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 (\u043f\u043e\u0447\u0442\u0438) \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 HID \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0415\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c USB \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 COM-\u043f\u043e\u0440\u0442 (VCP) \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 CDC. \u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c\u0443 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 UART, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<h2>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b<\/h2>\n<p>\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u0430 CDC \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430: \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u0442\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 (\u0445\u043e\u0442\u044f, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043f\u043e\u043d\u044f\u043b, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438) \u0438 \u043d\u0430\u0431\u043e\u0440 &#171;\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439&#187;, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">template &lt;uint8_t _Number, uint8_t _AlternateSetting, uint8_t _SubClass, uint8_t _Protocol, typename _Ep0, typename _Endpoint, typename... _Functionals&gt; class CdcCommInterface : public Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::Comm, _SubClass, _Protocol, _Ep0, _Endpoint&gt; {   using Base = Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::Comm, _SubClass, _Protocol, _Ep0, _Endpoint&gt;;   static LineCoding _lineCoding;   ...<\/code><\/pre>\n<p>\u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0440\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 (setup) \u043f\u0430\u043a\u0435\u0442\u0430:<\/p>\n<ul>\n<li>\n<p><strong>SET_LINE_CODING:<\/strong> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043b\u0438\u043d\u0438\u0438: Baudrate, Stop Bits, Parity, Data bits. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f (\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043b <a href=\"https:\/\/github.com\/saewave\/STM32F103-USB-CDC-CMSIS\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0442 <\/a>\u043f\u0440\u043e\u0435\u043a\u0442), \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>Putty<\/em>), \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p><strong>GET_LINE_CODING: <\/strong>\u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>SET_CONTROL_LINE_STATE: <\/strong>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043b\u0438\u043d\u0438\u0438 (RTS, DTR \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 setup-\u043f\u0430\u043a\u0435\u0442\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">switch (static_cast&lt;CdcRequest&gt;(setup-&gt;Request)) { case CdcRequest::SetLineCoding:   if(setup-&gt;Length == 7)   {     \/\/ Wait line coding     _Ep0::SetOutDataTransferCallback([]{       memcpy(&amp;_lineCoding, reinterpret_cast&lt;const void*&gt;(_Ep0::RxBuffer), 7);       _Ep0::ResetOutDataTransferCallback();       _Ep0::SendZLP();     });     _Ep0::SetRxStatus(EndpointStatus::Valid);   }   break; case CdcRequest::GetLineCoding:   _Ep0::SendData(&amp;_lineCoding, sizeof(LineCoding));   break; case CdcRequest::SetControlLineState:   _Ep0::SendZLP();   break; default:   break; }<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043f\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u044f variadic-\u043e\u0432, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438:<\/p>\n<pre><code class=\"cpp\">static uint16_t FillDescriptor(InterfaceDescriptor* descriptor) {   uint16_t totalLength = sizeof(InterfaceDescriptor);      *descriptor = InterfaceDescriptor {     .Number = _Number,     .AlternateSetting = _AlternateSetting,     .EndpointsCount = Base::EndpointsCount,     .Class = DeviceAndInterfaceClass::Comm,     .SubClass = _SubClass,     .Protocol = _Protocol   };    uint8_t* functionalDescriptors = reinterpret_cast&lt;uint8_t*&gt;(descriptor);    ((totalLength += _Functionals::FillDescriptor(&amp;functionalDescriptors[totalLength])), ...);    EndpointDescriptor* endpointDescriptors = reinterpret_cast&lt;EndpointDescriptor*&gt;(&amp;functionalDescriptors[totalLength]);   totalLength += _Endpoint::FillDescriptor(endpointDescriptors);    return totalLength; }<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0439, \u043e\u043d \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0442\u043e\u0447\u0435\u043a (\u0442\u043e\u0447\u043d\u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439). \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"cpp\">template &lt;uint8_t _Number, uint8_t _AlternateSetting, uint8_t _SubClass, uint8_t _Protocol, typename _Ep0, typename _Endpoint&gt; class CdcDataInterface : public Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::CdcData, _SubClass, _Protocol, _Ep0, _Endpoint&gt; {   using Base = Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::CdcData, _SubClass, _Protocol, _Ep0, _Endpoint&gt;;   ...<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0438 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0432 CDC-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435, \u0438\u0437 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 4 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438: <em>Header, CallManagement, ACM, Union<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"cpp\">template&lt;uint8_t _Number, typename _Ep0, typename _Endpoint&gt; using DefaultCdcCommInterface = CdcCommInterface&lt;_Number, 0, 0x02, 0x01, _Ep0, _Endpoint, HeaderFunctional, CallManagementFunctional, AcmFunctional, UnionFunctional&gt;;<\/code><\/pre>\n<h2>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0434\u0432\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 (Interrupt \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e Bulk \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e), \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043e\u0431\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043d\u0438\u043c\u0438 \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"cpp\">using CdcCommEndpointBase = InEndpointBase&lt;1, EndpointType::Interrupt, 8, 0xff&gt;; using CdcDataEndpointBase = BidirectionalEndpointBase&lt;2, EndpointType::Bulk, 32, 0&gt;;  using EpInitializer = EndpointsInitializer&lt;DefaultEp0, CdcCommEndpointBase, CdcDataEndpointBase&gt;;  using Ep0 = EpInitializer::ExtendEndpoint&lt;DefaultEp0&gt;; using CdcCommEndpoint = EpInitializer::ExtendEndpoint&lt;CdcCommEndpointBase&gt;; using CdcDataEndpoint = EpInitializer::ExtendEndpoint&lt;CdcDataEndpointBase&gt;;  using CdcComm = DefaultCdcCommInterface&lt;0, Ep0, CdcCommEndpoint&gt;; using CdcData = CdcDataInterface&lt;1, 0, 0, 0, Ep0, CdcDataEndpoint&gt;;  using Config = Configuration&lt;0, 250, false, false, CdcComm, CdcData&gt;; using MyDevice = Device&lt;0x0200, DeviceAndInterfaceClass::Comm, 0, 0, 0x0483, 0x5711, 0, Ep0, Config&gt;;<\/code><\/pre>\n<p>\u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0447\u0442\u043e \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0438 \u0432\u044b\u0434\u0430\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435):<\/p>\n<pre><code class=\"cpp\">template&lt;&gt; void CdcDataEndpoint::HandleRx() {   uint8_t* data = reinterpret_cast&lt;uint8_t*&gt;(CdcDataEndpoint::RxBuffer);   uint8_t size = CdcDataEndpoint::RxBufferCount::Get();    if(size &gt; 0)   {     if(data[0] == '0')     {       Led::Clear();       CdcDataEndpoint::SendData(\"LED is turn off\\r\\n\", 17);     }     if(data[0] == '1')     {       Led::Set();       CdcDataEndpoint::SendData(\"LED is turn on\\r\\n\", 16);     }   }   CdcDataEndpoint::SetRxStatus(EndpointStatus::Valid); }<\/code><\/pre>\n<h2>\u041e\u0442\u043b\u0430\u0434\u043a\u0430 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 USB-\u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u043f\u0438\u0448\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043b\u0438\u0447\u043d\u043e \u044f.<\/p>\n<p>\u0422\u0430\u043a \u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0434\u0435\u0448\u0435\u0432\u044b\u0439 \u043a\u043b\u043e\u043d Seale Logic \u0438 \u0435\u0441\u043b\u0438 \u0431\u044b \u0431\u044b\u043b \u0432 \u043d\u0430\u043b\u0438\u0447\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043f\u043f\u0430\u0440\u0430\u0442, \u0442\u043e \u0432\u0441\u0435 \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0435\u0449\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0445\u043e\u0441\u0442\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u0443 \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0448\u043b\u0438.<\/p>\n<p>WireShark \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c UsbPcap \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u044b\u043c, \u043e\u043d \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0430\u0440\u0441\u0438\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c &#8212; \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b. \u041d\u0435 \u043d\u0430\u0448\u0435\u043b \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435, \u043a\u0440\u043e\u043c\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e PID, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 <em>GET_DEVICE_DESCRIPTOR. <\/em>\u0424\u0438\u043b\u044c\u0442\u0440: <em>&#171;usb.idProduct == 0x5711&#187;<\/em>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2ce\/7ba\/f32\/2ce7baf3242e4b9f74c0912835abc353.PNG\" width=\"654\" height=\"337\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>contains<\/em>. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 (\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u0430). \u0424\u0438\u043b\u044c\u0442\u0440: <em>&#171;usb.addr contains &#171;1.19&#187;&#187;.<\/em><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/555\/cf9\/d8e\/555cf9d8e6c4f1a8e1eadf8393485ea1.PNG\" width=\"1183\" height=\"617\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e UsbPcap \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043e\u043f\u0438\u0448\u0443 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u043f\u0430\u043b \u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u043d\u0435\u0440\u0432\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 usbpcap<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u0432\u0435\u043b \u0441\u0435\u0431\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 SSD, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 Windows 10 To Go (Windows, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0438). \u0425\u043e\u0442\u044f Microsoft \u0432\u0440\u043e\u0434\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043e\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u0432 \u0446\u0435\u043b\u043e\u043c \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0440\u0438\u0445\u043e\u0436\u0443 \u0441 \u0434\u0438\u0441\u043a\u043e\u043c \u0432 \u043d\u043e\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0433\u0440\u0443\u0436\u0443\u0441\u044c \u0441 \u043d\u0435\u0433\u043e, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0438 \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e (\u0438 \u0431\u044b\u0441\u0442\u0440\u043e) \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b Windows \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0430\u0441\u044c \u0441 \u0441\u0438\u043d\u0438\u043c \u044d\u043a\u0440\u0430\u043d\u043e\u043c &#171;inaccessible boot device&#187;. \u041f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0446\u0435\u043b\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u043a \u0438 \u043d\u0435 \u0441\u043c\u043e\u0433, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c. \u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0442\u0430 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u043f\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435. \u0421\u043f\u0443\u0441\u0442\u044f \u043f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u043f\u044f\u0442\u044c \u043d\u0435 \u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f, \u043d\u0430\u0447\u0430\u043b \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u043b. \u0412\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u0430\u043a \u0440\u0430\u0437 WireShark \u0441 usbpcap. \u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0444\u043e\u0440\u0443\u043c\u043e\u0432 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043c\u044b\u0448\u043a\u043e\u0439\/\u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 usbpcap. \u0421\u043d\u0435\u0441 \u0447\u0435\u0440\u0435\u0437 LiveCD \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0438 Windows \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430\u0441\u044c. \u041d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d \u043d\u0430 100%, \u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0435: \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 Windows \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 usbpcap, \u0442\u043e\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 USB, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043f\u0430\u0434\u0430\u0435\u0442 \u0432 BSOD. \u041e\u0447\u0435\u043d\u044c \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0436\u0430\u043b\u044c \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 Terminal v1.9b, \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 &#171;0&#187; \u0438 &#171;1&#187;.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/355\/24b\/6ea\/35524b6eac7016015b58f16e04733882.PNG\" width=\"891\" height=\"475\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/azhel12\/Zhele\/blob\/master\/examples\/CdcExample.cpp\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>. \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 STM32F072B-DISCO. \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 HID, \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a) \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 CDC, \u043d\u0430 \u0432\u0441\u0435 \u0443\u0448\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u0435\u043d\u044c. \u0414\u0430\u043b\u0435\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043a\u043b\u0430\u0441\u0441 Mass Storage Device, \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c, \u043d\u0430\u0432\u0435\u0440\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f. \u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f.<\/p>\n<\/div>\n<p> \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\/post\/560048\/\"> https:\/\/habr.com\/ru\/post\/560048\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b Stm32, \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/549296\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439<\/a> \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 (\u043f\u043e\u0447\u0442\u0438) \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 HID \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0415\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c USB \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 COM-\u043f\u043e\u0440\u0442 (VCP) \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 CDC. \u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c\u0443 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 UART, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<h2>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b<\/h2>\n<p>\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u0430 CDC \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430: \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u0442\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 (\u0445\u043e\u0442\u044f, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043f\u043e\u043d\u044f\u043b, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438) \u0438 \u043d\u0430\u0431\u043e\u0440 &#171;\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439&#187;, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">template &lt;uint8_t _Number, uint8_t _AlternateSetting, uint8_t _SubClass, uint8_t _Protocol, typename _Ep0, typename _Endpoint, typename... _Functionals&gt; class CdcCommInterface : public Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::Comm, _SubClass, _Protocol, _Ep0, _Endpoint&gt; {   using Base = Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::Comm, _SubClass, _Protocol, _Ep0, _Endpoint&gt;;   static LineCoding _lineCoding;   ...<\/code><\/pre>\n<p>\u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0440\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 (setup) \u043f\u0430\u043a\u0435\u0442\u0430:<\/p>\n<ul>\n<li>\n<p><strong>SET_LINE_CODING:<\/strong> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043b\u0438\u043d\u0438\u0438: Baudrate, Stop Bits, Parity, Data bits. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f (\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043b <a href=\"https:\/\/github.com\/saewave\/STM32F103-USB-CDC-CMSIS\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0442 <\/a>\u043f\u0440\u043e\u0435\u043a\u0442), \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>Putty<\/em>), \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p><strong>GET_LINE_CODING: <\/strong>\u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>SET_CONTROL_LINE_STATE: <\/strong>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043b\u0438\u043d\u0438\u0438 (RTS, DTR \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 setup-\u043f\u0430\u043a\u0435\u0442\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">switch (static_cast&lt;CdcRequest&gt;(setup-&gt;Request)) { case CdcRequest::SetLineCoding:   if(setup-&gt;Length == 7)   {     \/\/ Wait line coding     _Ep0::SetOutDataTransferCallback([]{       memcpy(&amp;_lineCoding, reinterpret_cast&lt;const void*&gt;(_Ep0::RxBuffer), 7);       _Ep0::ResetOutDataTransferCallback();       _Ep0::SendZLP();     });     _Ep0::SetRxStatus(EndpointStatus::Valid);   }   break; case CdcRequest::GetLineCoding:   _Ep0::SendData(&amp;_lineCoding, sizeof(LineCoding));   break; case CdcRequest::SetControlLineState:   _Ep0::SendZLP();   break; default:   break; }<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043f\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u044f variadic-\u043e\u0432, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438:<\/p>\n<pre><code class=\"cpp\">static uint16_t FillDescriptor(InterfaceDescriptor* descriptor) {   uint16_t totalLength = sizeof(InterfaceDescriptor);      *descriptor = InterfaceDescriptor {     .Number = _Number,     .AlternateSetting = _AlternateSetting,     .EndpointsCount = Base::EndpointsCount,     .Class = DeviceAndInterfaceClass::Comm,     .SubClass = _SubClass,     .Protocol = _Protocol   };    uint8_t* functionalDescriptors = reinterpret_cast&lt;uint8_t*&gt;(descriptor);    ((totalLength += _Functionals::FillDescriptor(&amp;functionalDescriptors[totalLength])), ...);    EndpointDescriptor* endpointDescriptors = reinterpret_cast&lt;EndpointDescriptor*&gt;(&amp;functionalDescriptors[totalLength]);   totalLength += _Endpoint::FillDescriptor(endpointDescriptors);    return totalLength; }<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0439, \u043e\u043d \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0442\u043e\u0447\u0435\u043a (\u0442\u043e\u0447\u043d\u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439). \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"cpp\">template &lt;uint8_t _Number, uint8_t _AlternateSetting, uint8_t _SubClass, uint8_t _Protocol, typename _Ep0, typename _Endpoint&gt; class CdcDataInterface : public Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::CdcData, _SubClass, _Protocol, _Ep0, _Endpoint&gt; {   using Base = Interface&lt;_Number, _AlternateSetting, DeviceAndInterfaceClass::CdcData, _SubClass, _Protocol, _Ep0, _Endpoint&gt;;   ...<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0438 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0432 CDC-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435, \u0438\u0437 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 4 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438: <em>Header, CallManagement, ACM, Union<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"cpp\">template&lt;uint8_t _Number, typename _Ep0, typename _Endpoint&gt; using DefaultCdcCommInterface = CdcCommInterface&lt;_Number, 0, 0x02, 0x01, _Ep0, _Endpoint, HeaderFunctional, CallManagementFunctional, AcmFunctional, UnionFunctional&gt;;<\/code><\/pre>\n<h2>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0434\u0432\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 (Interrupt \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e Bulk \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e), \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043e\u0431\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043d\u0438\u043c\u0438 \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"cpp\">using CdcCommEndpointBase = InEndpointBase&lt;1, EndpointType::Interrupt, 8, 0xff&gt;; using CdcDataEndpointBase = BidirectionalEndpointBase&lt;2, EndpointType::Bulk, 32, 0&gt;;  using EpInitializer = EndpointsInitializer&lt;DefaultEp0, CdcCommEndpointBase, CdcDataEndpointBase&gt;;  using Ep0 = EpInitializer::ExtendEndpoint&lt;DefaultEp0&gt;; using CdcCommEndpoint = EpInitializer::ExtendEndpoint&lt;CdcCommEndpointBase&gt;; using CdcDataEndpoint = EpInitializer::ExtendEndpoint&lt;CdcDataEndpointBase&gt;;  using CdcComm = DefaultCdcCommInterface&lt;0, Ep0, CdcCommEndpoint&gt;; using CdcData = CdcDataInterface&lt;1, 0, 0, 0, Ep0, CdcDataEndpoint&gt;;  using Config = Configuration&lt;0, 250, false, false, CdcComm, CdcData&gt;; using MyDevice = Device&lt;0x0200, DeviceAndInterfaceClass::Comm, 0, 0, 0x0483, 0x5711, 0, Ep0, Config&gt;;<\/code><\/pre>\n<p>\u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0447\u0442\u043e \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0438 \u0432\u044b\u0434\u0430\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435):<\/p>\n<pre><code class=\"cpp\">template&lt;&gt; void CdcDataEndpoint::HandleRx() {   uint8_t* data = reinterpret_cast&lt;uint8_t*&gt;(CdcDataEndpoint::RxBuffer);   uint8_t size = CdcDataEndpoint::RxBufferCount::Get();    if(size &gt; 0)   {     if(data[0] == '0')     {       Led::Clear();       CdcDataEndpoint::SendData(\"LED is turn off\\r\\n\", 17);     }     if(data[0] == '1')     {       Led::Set();       CdcDataEndpoint::SendData(\"LED is turn on\\r\\n\", 16);     }   }   CdcDataEndpoint::SetRxStatus(EndpointStatus::Valid); }<\/code><\/pre>\n<h2>\u041e\u0442\u043b\u0430\u0434\u043a\u0430 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 USB-\u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u043f\u0438\u0448\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043b\u0438\u0447\u043d\u043e \u044f.<\/p>\n<p>\u0422\u0430\u043a \u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0434\u0435\u0448\u0435\u0432\u044b\u0439 \u043a\u043b\u043e\u043d Seale Logic \u0438 \u0435\u0441\u043b\u0438 \u0431\u044b \u0431\u044b\u043b \u0432 \u043d\u0430\u043b\u0438\u0447\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043f\u043f\u0430\u0440\u0430\u0442, \u0442\u043e \u0432\u0441\u0435 \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0435\u0449\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0445\u043e\u0441\u0442\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u0443 \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0448\u043b\u0438.<\/p>\n<p>WireShark \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c UsbPcap \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u044b\u043c, \u043e\u043d \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0430\u0440\u0441\u0438\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c &#8212; \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b. \u041d\u0435 \u043d\u0430\u0448\u0435\u043b \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435, \u043a\u0440\u043e\u043c\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e PID, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 <em>GET_DEVICE_DESCRIPTOR. <\/em>\u0424\u0438\u043b\u044c\u0442\u0440: <em>&#171;usb.idProduct == 0x5711&#187;<\/em>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>contains<\/em>. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 (\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u0430). \u0424\u0438\u043b\u044c\u0442\u0440: <em>&#171;usb.addr contains &#171;1.19&#187;&#187;.<\/em><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e UsbPcap \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043e\u043f\u0438\u0448\u0443 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u043f\u0430\u043b \u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u043d\u0435\u0440\u0432\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 usbpcap<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u0432\u0435\u043b \u0441\u0435\u0431\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 SSD, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 Windows 10 To Go (Windows, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0438). \u0425\u043e\u0442\u044f Microsoft \u0432\u0440\u043e\u0434\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043e\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u0432 \u0446\u0435\u043b\u043e\u043c \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0440\u0438\u0445\u043e\u0436\u0443 \u0441 \u0434\u0438\u0441\u043a\u043e\u043c \u0432 \u043d\u043e\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0433\u0440\u0443\u0436\u0443\u0441\u044c \u0441 \u043d\u0435\u0433\u043e, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0438 \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e (\u0438 \u0431\u044b\u0441\u0442\u0440\u043e) \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b Windows \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0430\u0441\u044c \u0441 \u0441\u0438\u043d\u0438\u043c \u044d\u043a\u0440\u0430\u043d\u043e\u043c &#171;inaccessible boot device&#187;. \u041f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0446\u0435\u043b\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u043a \u0438 \u043d\u0435 \u0441\u043c\u043e\u0433, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c. \u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0442\u0430 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u043f\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435. \u0421\u043f\u0443\u0441\u0442\u044f \u043f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u043f\u044f\u0442\u044c \u043d\u0435 \u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f, \u043d\u0430\u0447\u0430\u043b \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u043b. \u0412\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u0430\u043a \u0440\u0430\u0437 WireShark \u0441 usbpcap. \u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0444\u043e\u0440\u0443\u043c\u043e\u0432 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043c\u044b\u0448\u043a\u043e\u0439\/\u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 usbpcap. \u0421\u043d\u0435\u0441 \u0447\u0435\u0440\u0435\u0437 LiveCD \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0438 Windows \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430\u0441\u044c. \u041d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d \u043d\u0430 100%, \u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0435: \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 Windows \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 usbpcap, \u0442\u043e\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 USB, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043f\u0430\u0434\u0430\u0435\u0442 \u0432 BSOD. \u041e\u0447\u0435\u043d\u044c \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0436\u0430\u043b\u044c \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 Terminal v1.9b, \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 &#171;0&#187; \u0438 &#171;1&#187;.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/azhel12\/Zhele\/blob\/master\/examples\/CdcExample.cpp\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>. \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 STM32F072B-DISCO. \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 HID, \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a) \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 CDC, \u043d\u0430 \u0432\u0441\u0435 \u0443\u0448\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u0435\u043d\u044c. \u0414\u0430\u043b\u0435\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043a\u043b\u0430\u0441\u0441 Mass Storage Device, \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c, \u043d\u0430\u0432\u0435\u0440\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f. \u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f.<\/p>\n<\/div>\n<p> \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\/post\/560048\/\"> https:\/\/habr.com\/ru\/post\/560048\/<\/a><br \/><\/br><\/br><\/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-324015","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324015","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=324015"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324015\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}