€•T,Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”(hhŒparent”hubaŒ 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)”…””}”(hhhh2ubah}”(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”…””}”(hhhhFubah}”(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”…””}”(hhhhZubah}”(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”…””}”(hhhhnubah}”(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ŒSpanish”…””}”(hhhh‚ubah}”(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”…””}”(hhhh£ubah}”(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½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:”…””}”(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”…””}”(hhhhÜubah}”(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ì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:”…””}”(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:”hhø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)”…””}”(hhhjubah}”(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 ”…””}”(hŒ/In our case, the length is 1 byte, the type is ”hjhžhhŸNh NubhŒliteral”“”)”}”(hŒ ``Global``”h]”hŒGlobal”…””}”(hhhj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒ and the function is ”…””}”(hŒ and the function is ”hjhžhhŸNh Nubj)”}”(hŒ``Usage Page``”h]”hŒ Usage Page”…””}”(hhhj3hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒS, thus for parsing the value 0x01 in the second byte we need to refer to HUT Sec 3.”…””}”(hŒS, thus for parsing the value 0x01 in the second byte we need to refer to HUT Sec 3.”hjhž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 ”…””}”(hŒYThe second number is the actual data, and its meaning can be found in the HUT. We have a ”hjLhžhhŸNh Nubj)”}”(hŒ``Usage Page``”h]”hŒ Usage Page”…””}”(hhhjUhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjLubhŒT, thus we need to refer to HUT Sec. 3, “Usage Pagesâ€; from there, one sees that ”…””}”(hŒP, thus we need to refer to HUT Sec. 3, "Usage Pages"; from there, one sees that ”hjLhžhhŸNh Nubj)”}”(hŒ``0x01``”h]”hŒ0x01”…””}”(hhhjhhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjLubhŒ stands for ”…””}”(hŒ stands for ”hjLhžhhŸNh Nubj)”}”(hŒ``Generic Desktop Page``”h]”hŒGeneric Desktop Page”…””}”(hhhj{hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjLubhŒ.”…””}”(hŒ.”hjLhž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, ”…””}”(hŒCMoving now to the second two bytes, and following the same scheme, ”hj”hžhhŸNh Nubj)”}”(hŒ``0x09``”h]”hŒ0x09”…””}”(hhhjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒ (i.e. ”…””}”(hŒ (i.e. ”hj”hžhhŸNh Nubj)”}”(hŒ ``00001001``”h]”hŒ00001001”…””}”(hhhj°hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒ ) will be followed by one byte (”…””}”(hŒ ) will be followed by one byte (”hj”hžhhŸNh Nubj)”}”(hŒ``01``”h]”hŒ01”…””}”(hhhjÃhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒ ) and is a ”…””}”(hŒ ) and is a ”hj”hžhhŸNh Nubj)”}”(hŒ ``Local``”h]”hŒLocal”…””}”(hhhjÖhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒ item (”…””}”(hŒ item (”hj”hžhhŸNh Nubj)”}”(hŒ``10``”h]”hŒ10”…””}”(hhhjéhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒ1). Thus, the meaning of the remaining four bits (”…””}”(hŒ1). Thus, the meaning of the remaining four bits (”hj”hžhhŸNh Nubj)”}”(hŒ``0000``”h]”hŒ0000”…””}”(hhhjühžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒM) is given in the HID spec Sec. 6.2.2.8 “Local Itemsâ€, so that we have a ”…””}”(hŒI) is given in the HID spec Sec. 6.2.2.8 "Local Items", so that we have a ”hj”hžhhŸNh Nubj)”}”(hŒ ``Usage``”h]”hŒUsage”…””}”(hhhjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒM. From HUT, Sec. 4, “Generic Desktop Pageâ€, we see that 0x02 stands for ”…””}”(hŒI. From HUT, Sec. 4, "Generic Desktop Page", we see that 0x02 stands for ”hj”hžhhŸNh Nubj)”}”(hŒ ``Mouse``”h]”hŒMouse”…””}”(hhhj"hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj”ubhŒ.”…””}”(hjhj”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<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”jsŒ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Œ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”‰Œfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œ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”‰Œ embed_images”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”jMjJsŒ nametypes”}”jMNsh}”jJh¶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.