€•Œ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/hidintro”Œ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/hidintro”Œ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/hidintro”Œ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/hidintro”Œ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/hidintro”Œ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/hidintro”Œ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/hidintro”Œ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³Œ:/var/lib/git/docbuild/linux/Documentation/hid/hidintro.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒ&Introduction to HID report descriptors”h]”hŒ&Introduction to HID report descriptors”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hŒ¾This chapter is meant to give a broad overview of what HID report descriptors are, and of how a casual (non-kernel) programmer can deal with HID devices that are not working well with Linux.”h]”hŒ¾This chapter is meant to give a broad overview of what HID report descriptors are, and of how a casual (non-kernel) programmer can deal with HID devices that are not working well with Linux.”…”�”}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhŒtopic”“”)�”}”(hhh]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hhh]”hÞ)�”}”(hhh]”hŒ reference”“”)�”}”(hhh]”hŒ Introduction”…”�”}”(hjh²hh³Nh´Nubah}”(h]”Œid4”ah ]”h"]”h$]”h&]”Œrefid”Œ introduction”uh1hÿhhüubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhhùubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôubhø)�”}”(hhh]”(hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒParsing HID report descriptors”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”Œid5”ah ]”h"]”h$]”h&]”Œrefid”Œparsing-hid-report-descriptors”uh1hÿhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjubhó)�”}”(hhh]”hø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒ!Output, Input and Feature Reports”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”Œid6”ah ]”h"]”h$]”h&]”Œrefid”Œ output-input-and-feature-reports”uh1hÿhj?ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhj<ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hj9ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôubhø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒ(Collections, Report IDs and Evdev events”…”�”}”(hjph²hh³Nh´Nubah}”(h]”Œid7”ah ]”h"]”h$]”h&]”Œrefid”Œ'collections-report-ids-and-evdev-events”uh1hÿhjmubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjjubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôubhø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒEvents”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”Œid8”ah ]”h"]”h$]”h&]”Œrefid”Œevents”uh1hÿhj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjŒubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôubhø)�”}”(hhh]”(hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒWhen something does not work”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”Œid9”ah ]”h"]”h$]”h&]”Œrefid”Œwhen-something-does-not-work”uh1hÿhj±ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhj®ubhó)�”}”(hhh]”(hø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒQuirks”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”Œid10”ah ]”h"]”h$]”h&]”Œrefid”Œquirks”uh1hÿhjÐubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjÊubhø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒFixing HID report descriptors”…”�”}”(hjõh²hh³Nh´Nubah}”(h]”Œid11”ah ]”h"]”h$]”h&]”Œrefid”Œfixing-hid-report-descriptors”uh1hÿhjòubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjïubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjÊubhø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒ)Modifying the transmitted data on the fly”…”�”}”(hjh²hh³Nh´Nubah}”(h]”Œid12”ah ]”h"]”h$]”h&]”Œrefid”Œ)modifying-the-transmitted-data-on-the-fly”uh1hÿhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjÊubhø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒWriting a specialized driver”…”�”}”(hj9h²hh³Nh´Nubah}”(h]”Œid13”ah ]”h"]”h$]”h&]”Œrefid”Œwriting-a-specialized-driver”uh1hÿhj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhj3ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjÊubeh}”(h]”h ]”h"]”h$]”h&]”uh1hòhj®ubeh}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôubhø)�”}”(hhh]”hÞ)�”}”(hhh]”j)�”}”(hhh]”hŒ'Input Device Registration and Lifecycle”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”Œid14”ah ]”h"]”h$]”h&]”Œrefid”Œ'input-device-registration-and-lifecycle”uh1hÿhjdubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjaubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôubeh}”(h]”h ]”h"]”h$]”h&]”uh1hòhhïh²hh³Nh´Nubah}”(h]”Œcontents”ah ]”(Œcontents”Œlocal”eh"]”Œcontents”ah$]”h&]”uh1híh³hÇh´K hhÊh²hubhŒcompound”“”)�”}”(hhh]”hŒtoctree”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”hŒ hid/hidintro”Œentries”]”NŒhid/hidreport-parsing”†”aŒ includefiles”]”j¦aŒmaxdepth”KŒcaption”NŒglob”‰Œhidden”‰Œ includehidden”‰Œnumbered”KŒ titlesonly”‰Œ rawentries”]”uh1j˜h³hÇh´Khj•ubah}”(h]”h ]”Œtoctree-wrapper”ah"]”h$]”h&]”uh1j“hhÊh²hh³hÇh´NubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Introduction”h]”hŒ Introduction”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefid”j uh1hÍhjºh²hh³hÇh´KubhÞ)�”}”(hŒŸHID stands for Human Interface Device, and can be whatever device you are using to interact with a computer, be it a mouse, a touchpad, a tablet, a microphone.”h]”hŒŸHID stands for Human Interface Device, and can be whatever device you are using to interact with a computer, be it a mouse, a touchpad, a tablet, a microphone.”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjºh²hubhÞ)�”}”(hXkMany HID devices work out the box, even if their hardware is different. For example, mice can have any number of buttons; they may have a wheel; movement sensitivity differs between different models, and so on. Nonetheless, most of the time everything just works, without the need to have specialized code in the kernel for every mouse model developed since 1970.”h]”hXkMany HID devices work out the box, even if their hardware is different. For example, mice can have any number of buttons; they may have a wheel; movement sensitivity differs between different models, and so on. Nonetheless, most of the time everything just works, without the need to have specialized code in the kernel for every mouse model developed since 1970.”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjºh²hubhÞ)�”}”(hX‘This is because modern HID devices do advertise their capabilities through the *HID report descriptor*, a fixed set of bytes describing exactly what *HID reports* may be sent between the device and the host and the meaning of each individual bit in those reports. For example, a HID Report Descriptor may specify that "in a report with ID 3 the bits from 8 to 15 is the delta x coordinate of a mouse".”h]”(hŒOThis is because modern HID devices do advertise their capabilities through the ”…”�”}”(hjèh²hh³Nh´NubhŒemphasis”“”)�”}”(hŒ*HID report descriptor*”h]”hŒHID report descriptor”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jðhjèubhŒ/, a fixed set of bytes describing exactly what ”…”�”}”(hjèh²hh³Nh´Nubjñ)�”}”(hŒ *HID reports*”h]”hŒ HID reports”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jðhjèubhŒó may be sent between the device and the host and the meaning of each individual bit in those reports. For example, a HID Report Descriptor may specify that “in a report with ID 3 the bits from 8 to 15 is the delta x coordinate of a mouseâ€�.”…”�”}”(hjèh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K#hjºh²hubhÞ)�”}”(hXUThe HID report itself then merely carries the actual data values without any extra meta information. Note that HID reports may be sent from the device ("Input Reports", i.e. input events), to the device ("Output Reports" to e.g. change LEDs) or used for device configuration ("Feature reports"). A device may support one or more HID reports.”h]”hXaThe HID report itself then merely carries the actual data values without any extra meta information. Note that HID reports may be sent from the device (“Input Reportsâ€�, i.e. input events), to the device (“Output Reportsâ€� to e.g. change LEDs) or used for device configuration (“Feature reportsâ€�). A device may support one or more HID reports.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K*hjºh²hubhÞ)�”}”(hX“The HID subsystem is in charge of parsing the HID report descriptors, and converts HID events into normal input device interfaces (see Documentation/hid/hid-transport.rst). Devices may misbehave because the HID report descriptor provided by the device is wrong, or because it needs to be dealt with in a special way, or because some special device or interaction mode is not handled by the default code.”h]”hX“The HID subsystem is in charge of parsing the HID report descriptors, and converts HID events into normal input device interfaces (see Documentation/hid/hid-transport.rst). Devices may misbehave because the HID report descriptor provided by the device is wrong, or because it needs to be dealt with in a special way, or because some special device or interaction mode is not handled by the default code.”…”�”}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K0hjºh²hubhÞ)�”}”(hŒºThe format of HID report descriptors is described by two documents, available from the `USB Implementers Forum `_ `HID web page `_ address:”h]”(hŒWThe format of HID report descriptors is described by two documents, available from the ”…”�”}”(hj8h²hh³Nh´Nubj)�”}”(hŒ0`USB Implementers Forum `_”h]”hŒUSB Implementers Forum”…”�”}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒUSB Implementers Forum”Œrefuri”Œhttps://www.usb.org/”uh1hÿhj8ubhŒtarget”“”)�”}”(hŒ ”h]”h}”(h]”Œusb-implementers-forum”ah ]”h"]”Œusb implementers forum”ah$]”h&]”Œrefuri”jQuh1jRŒ referenced”Khj8ubhŒ ”…”�”}”(hj8h²hh³Nh´Nubj)�”}”(hŒ)`HID web page `_”h]”hŒ HID web page”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ HID web page”jPŒhttps://www.usb.org/hid”uh1hÿhj8ubjS)�”}”(hŒ ”h]”h}”(h]”Œ hid-web-page”ah ]”h"]”Œ hid web page”ah$]”h&]”Œrefuri”jvuh1jRjaKhj8ubhŒ address:”…”�”}”(hj8h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K7hjºh²hubhŒ block_quote”“”)�”}”(hŒì* the `HID USB Device Class Definition `_ (HID Spec from now on) * the `HID Usage Tables `_ (HUT from now on) ”h]”hó)�”}”(hhh]”(hø)�”}”(hŒ„the `HID USB Device Class Definition `_ (HID Spec from now on)”h]”hÞ)�”}”(hŒ„the `HID USB Device Class Definition `_ (HID Spec from now on)”h]”(hŒthe ”…”�”}”(hj›h²hh³Nh´Nubj)�”}”(hŒi`HID USB Device Class Definition `_”h]”hŒHID USB Device Class Definition”…”�”}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒHID USB Device Class Definition”jPŒDhttps://www.usb.org/document-library/device-class-definition-hid-111”uh1hÿhj›ubjS)�”}”(hŒG ”h]”h}”(h]”Œhid-usb-device-class-definition”ah ]”h"]”Œhid usb device class definition”ah$]”h&]”Œrefuri”j³uh1jRjaKhj›ubhŒ (HID Spec from now on)”…”�”}”(hj›h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K;hj—ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hj”ubhø)�”}”(hŒathe `HID Usage Tables `_ (HUT from now on) ”h]”hÞ)�”}”(hŒ`the `HID Usage Tables `_ (HUT from now on)”h]”(hŒthe ”…”�”}”(hjÕh²hh³Nh´Nubj)�”}”(hŒJ`HID Usage Tables `_”h]”hŒHID Usage Tables”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒHID Usage Tables”jPŒ4https://usb.org/document-library/hid-usage-tables-14”uh1hÿhjÕubjS)�”}”(hŒ7 ”h]”h}”(h]”Œhid-usage-tables”ah ]”h"]”Œhid usage tables”ah$]”h&]”Œrefuri”jíuh1jRjaKhjÕubhŒ (HUT from now on)”…”�”}”(hjÕh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K=hjÑubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hj”ubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1hòh³hÇh´K;hj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŽh³hÇh´K;hjºh²hubhÞ)�”}”(hŒ�The HID subsystem can deal with different transport drivers (USB, I2C, Bluetooth, etc.). See Documentation/hid/hid-transport.rst.”h]”hŒ�The HID subsystem can deal with different transport drivers (USB, I2C, Bluetooth, etc.). See Documentation/hid/hid-transport.rst.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K?hjºh²hubeh}”(h]”jah ]”h"]”Œ introduction”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒParsing HID report descriptors”h]”hŒParsing HID report descriptors”…”�”}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jËj,uh1hÍhj.h²hh³hÇh´KCubhÞ)�”}”(hŒÃThe current list of HID devices can be found at ``/sys/bus/hid/devices/``. For each device, say ``/sys/bus/hid/devices/0003\:093A\:2510.0002/``, one can read the corresponding report descriptor::”h]”(hŒ0The current list of HID devices can be found at ”…”�”}”(hj?h²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``/sys/bus/hid/devices/``”h]”hŒ/sys/bus/hid/devices/”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jGhj?ubhŒ. For each device, say ”…”�”}”(hj?h²hh³Nh´NubjH)�”}”(hŒ/``/sys/bus/hid/devices/0003\:093A\:2510.0002/``”h]”hŒ+/sys/bus/hid/devices/0003\:093A\:2510.0002/”…”�”}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jGhj?ubhŒ3, one can read the corresponding report descriptor:”…”�”}”(hj?h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KEhj.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”…”�”}”hjusbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´KIhj.h²hubhÞ)�”}”(hŒhOptional: the HID report descriptor can be read also by directly accessing the hidraw driver [#hidraw]_.”h]”(hŒ]Optional: the HID report descriptor can be read also by directly accessing the hidraw driver ”…”�”}”(hjƒh²hh³Nh´NubhŒfootnote_reference”“”)�”}”(hŒ [#hidraw]_”h]”hŒ1”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”Œid1”ah ]”h"]”h$]”h&]”Œauto”KjËŒhidraw”Œdocname”j£uh1j‹hjƒŒresolved”KubhŒ.”…”�”}”(hjƒh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KPhj.h²hubhÞ)�”}”(hX¬The basic structure of HID report descriptors is defined in the HID spec, while HUT "defines constants that can be interpreted by an application to identify the purpose and meaning of a data field in a HID report". Each entry is defined by at least two bytes, where the first one defines what type of value is following and is described in the HID spec, while the second one carries the actual value and is described in the HUT.”h]”hX°The basic structure of HID report descriptors is defined in the HID spec, while HUT “defines constants that can be interpreted by an application to identify the purpose and meaning of a data field in a HID reportâ€�. Each entry is defined by at least two bytes, where the first one defines what type of value is following and is described in the HID spec, while the second one carries the actual value and is described in the HUT.”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KShj.h²hubhÞ)�”}”(hŒXHID report descriptors can, in principle, be painstakingly parsed by hand, byte by byte.”h]”hŒXHID report descriptors can, in principle, be painstakingly parsed by hand, byte by byte.”…”�”}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K[hj.h²hubhÞ)�”}”(hŒªA short introduction on how to do this is sketched in Documentation/hid/hidreport-parsing.rst; you only need to understand it if you need to patch HID report descriptors.”h]”hŒªA short introduction on how to do this is sketched in Documentation/hid/hidreport-parsing.rst; you only need to understand it if you need to patch HID report descriptors.”…”�”}”(hjÆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K^hj.h²hubhÞ)�”}”(hŒˆIn practice you should not parse HID report descriptors by hand; rather, you should use an existing parser. Among all the available ones”h]”hŒˆIn practice you should not parse HID report descriptors by hand; rather, you should use an existing parser. Among all the available ones”…”�”}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kbhj.h²hubj�)�”}”(hX@* the online `USB Descriptor and Request Parser `_; * `hidrdd `_, that provides very detailed and somewhat verbose descriptions (verbosity can be useful if you are not familiar with HID report descriptors); * `hid-tools `_, a complete utility set that allows, among other things, to record and replay the raw HID reports and to debug and replay HID devices. It is being actively developed by the Linux HID subsystem maintainers. ”h]”hó)�”}”(hhh]”(hø)�”}”(hŒ]the online `USB Descriptor and Request Parser `_;”h]”hÞ)�”}”(hŒ]the online `USB Descriptor and Request Parser `_;”h]”(hŒ the online ”…”�”}”(hjíh²hh³Nh´Nubj)�”}”(hŒQ`USB Descriptor and Request Parser `_”h]”hŒ!USB Descriptor and Request Parser”…”�”}”(hjõh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ!USB Descriptor and Request Parser”jPŒ*http://eleccelerator.com/usbdescreqparser/”uh1hÿhjíubjS)�”}”(hŒ- ”h]”h}”(h]”Œ!usb-descriptor-and-request-parser”ah ]”h"]”Œ!usb descriptor and request parser”ah$]”h&]”Œrefuri”juh1jRjaKhjíubhŒ;”…”�”}”(hjíh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kehjéubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjæubhø)�”}”(hŒ¼`hidrdd `_, that provides very detailed and somewhat verbose descriptions (verbosity can be useful if you are not familiar with HID report descriptors);”h]”hÞ)�”}”(hŒ¼`hidrdd `_, that provides very detailed and somewhat verbose descriptions (verbosity can be useful if you are not familiar with HID report descriptors);”h]”(j)�”}”(hŒ.`hidrdd `_”h]”hŒhidrdd”…”�”}”(hj+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œhidrdd”jPŒ"https://github.com/abend0c1/hidrdd”uh1hÿhj'ubjS)�”}”(hŒ% ”h]”h}”(h]”Œhidrdd”ah ]”h"]”Œhidrdd”ah$]”h&]”Œrefuri”j;uh1jRjaKhj'ubhŒŽ, that provides very detailed and somewhat verbose descriptions (verbosity can be useful if you are not familiar with HID report descriptors);”…”�”}”(hj'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kghj#ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjæubhø)�”}”(hX`hid-tools `_, a complete utility set that allows, among other things, to record and replay the raw HID reports and to debug and replay HID devices. It is being actively developed by the Linux HID subsystem maintainers. ”h]”hÞ)�”}”(hX`hid-tools `_, a complete utility set that allows, among other things, to record and replay the raw HID reports and to debug and replay HID devices. It is being actively developed by the Linux HID subsystem maintainers.”h]”(j)�”}”(hŒ@`hid-tools `_”h]”hŒ hid-tools”…”�”}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ hid-tools”jPŒ1https://gitlab.freedesktop.org/libevdev/hid-tools”uh1hÿhj]ubjS)�”}”(hŒ4 ”h]”h}”(h]”Œ hid-tools”ah ]”h"]”Œ hid-tools”ah$]”h&]”Œrefuri”jquh1jRjaKhj]ubhŒÎ, a complete utility set that allows, among other things, to record and replay the raw HID reports and to debug and replay HID devices. It is being actively developed by the Linux HID subsystem maintainers.”…”�”}”(hj]h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KkhjYubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjæubeh}”(h]”h ]”h"]”h$]”h&]”jjuh1hòh³hÇh´Kehjâubah}”(h]”h ]”h"]”h$]”h&]”uh1jŽh³hÇh´Kehj.h²hubhÞ)�”}”(hŒ’Parsing the mouse HID report descriptor with `hid-tools `_ leads to (explanations interposed)::”h]”(hŒ-Parsing the mouse HID report descriptor with ”…”�”}”(hj›h²hh³Nh´Nubj)�”}”(hŒ@`hid-tools `_”h]”hŒ hid-tools”…”�”}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ hid-tools”jPŒ1https://gitlab.freedesktop.org/libevdev/hid-tools”uh1hÿhj›ubjS)�”}”(hŒ4 ”h]”h}”(h]”Œid2”ah ]”h"]”h$]”Œ hid-tools”ah&]”Œrefuri”j³uh1jRjaKhj›ubhŒ$ leads to (explanations interposed):”…”�”}”(hj›h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kqhj.h²hubjt)�”}”(hX$ ./hid-decode /sys/bus/hid/devices/0003\:093A\:2510.0002/report_descriptor # device 0:0 # 0x05, 0x01, // Usage Page (Generic Desktop) 0 # 0x09, 0x02, // Usage (Mouse) 2 # 0xa1, 0x01, // Collection (Application) 4 # 0x09, 0x01, // Usage (Pointer) 6 # 0xa1, 0x00, // Collection (Physical) 8 # 0x05, 0x09, // Usage Page (Button) 10”h]”hX$ ./hid-decode /sys/bus/hid/devices/0003\:093A\:2510.0002/report_descriptor # device 0:0 # 0x05, 0x01, // Usage Page (Generic Desktop) 0 # 0x09, 0x02, // Usage (Mouse) 2 # 0xa1, 0x01, // Collection (Application) 4 # 0x09, 0x01, // Usage (Pointer) 6 # 0xa1, 0x00, // Collection (Physical) 8 # 0x05, 0x09, // Usage Page (Button) 10”…”�”}”hjËsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´Kuhj.h²hubhÞ)�”}”(hŒwhat follows is a button ::”h]”hŒwhat follows is a button”…”�”}”(hjÙh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K~hj.h²hubjt)�”}”(hŒ“# 0x19, 0x01, // Usage Minimum (1) 12 # 0x29, 0x03, // Usage Maximum (3) 14”h]”hŒ“# 0x19, 0x01, // Usage Minimum (1) 12 # 0x29, 0x03, // Usage Maximum (3) 14”…”�”}”hjçsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K€hj.h²hubhÞ)�”}”(hŒBfirst button is button number 1, last button is button number 3 ::”h]”hŒ?first button is button number 1, last button is button number 3”…”�”}”(hjõh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kƒhj.h²hubjt)�”}”(hŒ“# 0x15, 0x00, // Logical Minimum (0) 16 # 0x25, 0x01, // Logical Maximum (1) 18”h]”hŒ“# 0x15, 0x00, // Logical Minimum (0) 16 # 0x25, 0x01, // Logical Maximum (1) 18”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K…hj.h²hubhÞ)�”}”(hŒVeach button can send values from 0 up to including 1 (i.e. they are binary buttons) ::”h]”hŒSeach button can send values from 0 up to including 1 (i.e. they are binary buttons)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kˆhj.h²hubjt)�”}”(hŒI# 0x75, 0x01, // Report Size (1) 20”h]”hŒI# 0x75, 0x01, // Report Size (1) 20”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K‹hj.h²hubhÞ)�”}”(hŒ)each button is sent as exactly one bit ::”h]”hŒ&each button is sent as exactly one bit”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K�hj.h²hubjt)�”}”(hŒI# 0x95, 0x03, // Report Count (3) 22”h]”hŒI# 0x95, 0x03, // Report Count (3) 22”…”�”}”hj;sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K�hj.h²hubhÞ)�”}”(hŒAand there are three of those bits (matching the three buttons) ::”h]”hŒ>and there are three of those bits (matching the three buttons)”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K‘hj.h²hubjt)�”}”(hŒI# 0x81, 0x02, // Input (Data,Var,Abs) 24”h]”hŒI# 0x81, 0x02, // Input (Data,Var,Abs) 24”…”�”}”hjWsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K“hj.h²hubhÞ)�”}”(hŒ½it's actual Data (not constant padding), they represent a single variable (Var) and their values are Absolute (not relative); See HID spec Sec. 6.2.2.5 "Input, Output, and Feature Items" ::”h]”hŒÀit’s actual Data (not constant padding), they represent a single variable (Var) and their values are Absolute (not relative); See HID spec Sec. 6.2.2.5 “Input, Output, and Feature Itemsâ€�”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K•hj.h²hubjt)�”}”(hŒI# 0x75, 0x05, // Report Size (5) 26”h]”hŒI# 0x75, 0x05, // Report Size (5) 26”…”�”}”hjssbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K™hj.h²hubhÞ)�”}”(hŒ7five additional padding bits, needed to reach a byte ::”h]”hŒ4five additional padding bits, needed to reach a byte”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K›hj.h²hubjt)�”}”(hŒI# 0x95, 0x01, // Report Count (1) 28”h]”hŒI# 0x95, 0x01, // Report Count (1) 28”…”�”}”hj�sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K�hj.h²hubhÞ)�”}”(hŒ)those five bits are repeated only once ::”h]”hŒ&those five bits are repeated only once”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KŸhj.h²hubjt)�”}”(hŒI# 0x81, 0x01, // Input (Cnst,Arr,Abs) 30”h]”hŒI# 0x81, 0x01, // Input (Cnst,Arr,Abs) 30”…”�”}”hj«sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´K¡hj.h²hubhÞ)�”}”(hŒ`_: The sequence of bytes sent by clicking and releasing button 1, then button 2, then button 3 is::”h]”(hŒ-Indeed, for any event, the mouse will send a ”…”�”}”(hjoh²hh³Nh´Nubjñ)�”}”(hŒ*report*”h]”hŒreport”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jðhjoubhŒF of four bytes. We can check the values sent by resorting e.g. to the ”…”�”}”(hjoh²hh³Nh´NubhŒtitle_reference”“”)�”}”(hŒ`hid-recorder`”h]”hŒ hid-recorder”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j‰hjoubhŒ tool, from ”…”�”}”(hjoh²hh³Nh´Nubj)�”}”(hŒ@`hid-tools `_”h]”hŒ hid-tools”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ hid-tools”jPŒ1https://gitlab.freedesktop.org/libevdev/hid-tools”uh1hÿhjoubjS)�”}”(hŒ4 ”h]”h}”(h]”Œid3”ah ]”h"]”h$]”Œ hid-tools”ah&]”Œrefuri”j­uh1jRjaKhjoubhŒa: The sequence of bytes sent by clicking and releasing button 1, then button 2, then button 3 is:”…”�”}”(hjoh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KÌhj.h²hubjt)�”}”(hXS$ sudo ./hid-recorder /dev/hidraw1 .... output of hid-decode .... # Button: 1 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000000.000000 4 01 00 00 00 # Button: 0 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000000.183949 4 00 00 00 00 # Button: 0 1 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000001.959698 4 02 00 00 00 # Button: 0 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000002.103899 4 00 00 00 00 # Button: 0 0 1 | # | X: 0 | Y: 0 | Wheel: 0 E: 000004.855799 4 04 00 00 00 # Button: 0 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000005.103864 4 00 00 00 00”h]”hXS$ sudo ./hid-recorder /dev/hidraw1 .... output of hid-decode .... # Button: 1 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000000.000000 4 01 00 00 00 # Button: 0 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000000.183949 4 00 00 00 00 # Button: 0 1 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000001.959698 4 02 00 00 00 # Button: 0 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000002.103899 4 00 00 00 00 # Button: 0 0 1 | # | X: 0 | Y: 0 | Wheel: 0 E: 000004.855799 4 04 00 00 00 # Button: 0 0 0 | # | X: 0 | Y: 0 | Wheel: 0 E: 000005.103864 4 00 00 00 00”…”�”}”hjÅsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jsh³hÇh´KÑhj.h²hubhÞ)�”}”(hŒïThis example shows that when button 2 is clicked, the bytes ``02 00 00 00`` are sent, and the immediately subsequent event (``00 00 00 00``) is the release of button 2 (no buttons are pressed, remember that the data values are *absolute*).”h]”(hŒinput; /* Initialize private data and capabilities here */ set_bit(EV_FF, input->evbit); return input_ff_create_memless(input, NULL, my_play_effect); } static struct hid_driver my_driver = { .name = "my_driver", .probe = my_probe, .input_configured = my_input_configured, };”h]”hXªstatic int my_input_configured(struct hid_device *hdev, struct hid_input *hidinput) { struct input_dev *input = hidinput->input; /* Initialize private data and capabilities here */ set_bit(EV_FF, input->evbit); return input_ff_create_memless(input, NULL, my_play_effect); } static struct hid_driver my_driver = { .name = "my_driver", .probe = my_probe, .input_configured = my_input_configured, };”…”�”}”hjÝsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œc”Œhighlight_args”}”uh1jsh³hÇh´M+hj4h²hubhÞ)�”}”(hŒ¥Drivers that require even more control over the lifecycle should mask out ``HID_CONNECT_HIDINPUT`` and call ``input_register_device()`` manually when they are ready.”h]”(hŒJDrivers that require even more control over the lifecycle should mask out ”…”�”}”(hjðh²hh³Nh´NubjH)�”}”(hŒ``HID_CONNECT_HIDINPUT``”h]”hŒHID_CONNECT_HIDINPUT”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jGhjðubhŒ and call ”…”�”}”(hjðh²hh³Nh´NubjH)�”}”(hŒ``input_register_device()``”h]”hŒinput_register_device()”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jGhjðubhŒ manually when they are ready.”…”�”}”(hjðh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M<hj4h²hubeh}”(h]”jvah ]”h"]”Œ'input device registration and lifecycle”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´Mubeh}”(h]”Œ&introduction-to-hid-report-descriptors”ah ]”h"]”Œ&introduction to 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”jTŒ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”}”Œhidraw”]”j�asŒrefids”}”j�]”j�asŒnameids”}”(j.j+j�j‹j+jj]jZj€j}j½jºj÷jôj¯j2jj jEjBj{jxj¨jQj jj• j¡j1jÃjŒjâj@jj˜j&j*jHj#j�j&jvuŒ nametypes”}”(j.‰j�‰j+‰j]ˆj€ˆj½ˆj÷ˆj¯‰jˆjEˆj{ˆj¨‰j ‰j• ‰j1‰jŒ‰j@‰j˜‰j*‰j#ˆj&‰uh}”(j+hÊj‹hïjjºjZjTj}jwjºj´jôjîj2j.j—j�j jjBj<jxjrjºj´j´j®jQjejj²j¡j jÃj˜ jâj[ jj�j&jCjHj›j�jÌjvj4j jj,j#jKjBjyjpj›j’j½j´jÜjÓjþjõj jjBj9jpjguŒ footnote_refs”}”j”]”j�asŒ citation_refs”}”Œ autofootnotes”]”jÌaŒautofootnote_refs”]”j�aŒsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”jbKs…”R”Œparse_messages”]”(hŒsystem_message”“”)�”}”(hhh]”hÞ)�”}”(hŒ,Duplicate explicit target name: "hid-tools".”h]”hŒ0Duplicate explicit target name: “hid-toolsâ€�.”…”�”}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhj¼ubah}”(h]”h ]”h"]”h$]”h&]”jºaŒlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kuh1jºhj.h²hh³hÇh´Ksubj»)�”}”(hhh]”hÞ)�”}”(hŒ,Duplicate explicit target name: "hid-tools".”h]”hŒ0Duplicate explicit target name: “hid-toolsâ€�.”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjØubah}”(h]”h ]”h"]”h$]”h&]”j´aŒlevel”KŒtype”jÕŒsource”hÇŒline”Kuh1jºhj.h²hh³hÇh´KÏubeŒtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.