€•Û(Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ)/translations/zh_CN/hid/hidreport-parsing”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/zh_TW/hid/hidreport-parsing”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/it_IT/hid/hidreport-parsing”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ja_JP/hid/hidreport-parsing”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ko_KR/hid/hidreport-parsing”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/pt_BR/hid/hidreport-parsing”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/sp_SP/hid/hidreport-parsing”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒC/var/lib/git/docbuild/linux/Documentation/hid/hidreport-parsing.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ(Manual parsing of HID report descriptors”h]”hŒ(Manual parsing of HID report descriptors”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)”}”(hŒ]Consider again the mouse HID report descriptor introduced in Documentation/hid/hidintro.rst::”h]”hŒ\Consider again the mouse HID report descriptor introduced in Documentation/hid/hidintro.rst:”…””}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhŒ literal_block”“”)”}”(hX‚$ hexdump -C /sys/bus/hid/devices/0003\:093A\:2510.0002/report_descriptor 00000000 05 01 09 02 a1 01 09 01 a1 00 05 09 19 01 29 03 |..............).| 00000010 15 00 25 01 75 01 95 03 81 02 75 05 95 01 81 01 |..%.u.....u.....| 00000020 05 01 09 30 09 31 09 38 15 81 25 7f 75 08 95 03 |...0.1.8..%.u...| 00000030 81 06 c0 c0 |....| 00000034”h]”hX‚$ hexdump -C /sys/bus/hid/devices/0003\:093A\:2510.0002/report_descriptor 00000000 05 01 09 02 a1 01 09 01 a1 00 05 09 19 01 29 03 |..............).| 00000010 15 00 25 01 75 01 95 03 81 02 75 05 95 01 81 01 |..%.u.....u.....| 00000020 05 01 09 30 09 31 09 38 15 81 25 7f 75 08 95 03 |...0.1.8..%.u...| 00000030 81 06 c0 c0 |....| 00000034”…””}”hhïsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1híh³hÇh´K hhÊh²hubhÞ)”}”(hŒand try to parse it by hand.”h]”hŒand try to parse it by hand.”…””}”(hhýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhÞ)”}”(hŒŽStart with the first number, 0x05: it carries 2 bits for the length of the item, 2 bits for the type of the item and 4 bits for the function::”h]”hŒStart with the first number, 0x05: it carries 2 bits for the length of the item, 2 bits for the type of the item and 4 bits for the function:”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhî)”}”(hX+----------+ | 00000101 | +----------+ ^^ ---- Length of data (see HID spec 6.2.2.2) ^^ ------ Type of the item (see HID spec 6.2.2.2, then jump to 6.2.2.7) ^^^^ --------- Function of the item (see HID spec 6.2.2.7, then HUT Sec 3)”h]”hX+----------+ | 00000101 | +----------+ ^^ ---- Length of data (see HID spec 6.2.2.2) ^^ ------ Type of the item (see HID spec 6.2.2.2, then jump to 6.2.2.7) ^^^^ --------- Function of the item (see HID spec 6.2.2.7, then HUT Sec 3)”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1híh³hÇh´KhhÊh²hubhÞ)”}”(hŒ¯In our case, the length is 1 byte, the type is ``Global`` and the function is ``Usage Page``, thus for parsing the value 0x01 in the second byte we need to refer to HUT Sec 3.”h]”(hŒ/In our case, the length is 1 byte, the type is ”…””}”(hj'h²hh³Nh´NubhŒliteral”“”)”}”(hŒ ``Global``”h]”hŒGlobal”…””}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hj'ubhŒ and the function is ”…””}”(hj'h²hh³Nh´Nubj0)”}”(hŒ``Usage Page``”h]”hŒ Usage Page”…””}”(hjCh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hj'ubhŒS, thus for parsing the value 0x01 in the second byte we need to refer to HUT Sec 3.”…””}”(hj'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K!hhÊh²hubhÞ)”}”(hŒäThe second number is the actual data, and its meaning can be found in the HUT. We have a ``Usage Page``, thus we need to refer to HUT Sec. 3, "Usage Pages"; from there, one sees that ``0x01`` stands for ``Generic Desktop Page``.”h]”(hŒYThe second number is the actual data, and its meaning can be found in the HUT. We have a ”…””}”(hj[h²hh³Nh´Nubj0)”}”(hŒ``Usage Page``”h]”hŒ Usage Page”…””}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hj[ubhŒT, thus we need to refer to HUT Sec. 3, “Usage Pagesâ€; from there, one sees that ”…””}”(hj[h²hh³Nh´Nubj0)”}”(hŒ``0x01``”h]”hŒ0x01”…””}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hj[ubhŒ stands for ”…””}”(hj[h²hh³Nh´Nubj0)”}”(hŒ``Generic Desktop Page``”h]”hŒGeneric Desktop Page”…””}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hj[ubhŒ.”…””}”(hj[h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K%hhÊh²hubhÞ)”}”(hXƒMoving now to the second two bytes, and following the same scheme, ``0x09`` (i.e. ``00001001``) will be followed by one byte (``01``) and is a ``Local`` item (``10``). Thus, the meaning of the remaining four bits (``0000``) is given in the HID spec Sec. 6.2.2.8 "Local Items", so that we have a ``Usage``. From HUT, Sec. 4, "Generic Desktop Page", we see that 0x02 stands for ``Mouse``.”h]”(hŒCMoving now to the second two bytes, and following the same scheme, ”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ``0x09``”h]”hŒ0x09”…””}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒ (i.e. ”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ ``00001001``”h]”hŒ00001001”…””}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒ ) will be followed by one byte (”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ``01``”h]”hŒ01”…””}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒ ) and is a ”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ ``Local``”h]”hŒLocal”…””}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒ item (”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ``10``”h]”hŒ10”…””}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒ1). Thus, the meaning of the remaining four bits (”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ``0000``”h]”hŒ0000”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒM) is given in the HID spec Sec. 6.2.2.8 “Local Itemsâ€, so that we have a ”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ ``Usage``”h]”hŒUsage”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒM. From HUT, Sec. 4, “Generic Desktop Pageâ€, we see that 0x02 stands for ”…””}”(hjŸh²hh³Nh´Nubj0)”}”(hŒ ``Mouse``”h]”hŒMouse”…””}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j/hjŸubhŒ.”…””}”(hjŸh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K*hhÊh²hubhÞ)”}”(hŒ4The following numbers can be parsed in the same way.”h]”hŒ4The following numbers can be parsed in the same way.”…””}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K1hhÊh²hubeh}”(h]”Œ(manual-parsing-of-hid-report-descriptors”ah ]”h"]”Œ(manual parsing of hid report descriptors”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jvŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”jPjMsŒ nametypes”}”jP‰sh}”jMhÊsŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.