€• Œ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”hhhubh)�”}”(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”ˆuh1hhhubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/it_IT/hid/hidintro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/ja_JP/hid/hidintro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/ko_KR/hid/hidintro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(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”ˆuh1hhhubh)�”}”(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”ˆuh1hhhubeh}”(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”…”�”}”(hj h²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Ýhj ubhó)�”}”(hhh]”hø)�”}”(hhh]”hÞ)�”}”(hhh]”j )�”}”(hhh]”hŒ!Output, Input and Feature Reports”…”�”}”(hjB h²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÷hj9 ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôubhø)�”}”(hhh]”hÞ)�”}”(hhh]”j )�”}”(hhh]”hŒ(Collections, Report IDs and Evdev events”…”�”}”(hjp h²hh³Nh´Nubah}”(h]”Œid7”ah ]”h"]”h$]”h&]”Œrefid”Œ'collections-report-ids-and-evdev-events”uh1hÿhjm ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhjj ubah}”(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”…”�”}”(hj h²hh³Nh´Nubah}”(h]”Œid12”ah ]”h"]”h$]”h&]”Œrefid”Œ)modifying-the-transmitted-data-on-the-fly”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ŒWriting a specialized driver”…”�”}”(hj9 h²hh³Nh´Nubah}”(h]”Œid13”ah ]”h"]”h$]”h&]”Œrefid”Œwriting-a-specialized-driver”uh1hÿhj6 ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhj3 ubah}”(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”…”�”}”(hjg h²hh³Nh´Nubah}”(h]”Œid14”ah ]”h"]”h$]”h&]”Œrefid”Œ'input-device-registration-and-lifecycle”uh1hÿhjd ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhja ubah}”(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Þ)�”}”(hXk Many 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]”hXk Many 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”…”�”}”(hj h²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Þ)�”}”(hXU The 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]”hXa The 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.”…”�”}”(hj h²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 ”…”�”}”(hj8 h²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ÿhj8 ubhŒtarget”“”)�”}”(hŒ ”h]”h}”(h]”Œusb-implementers-forum”ah ]”h"]”Œusb implementers forum”ah$]”h&]”Œrefuri”jQ uh1jR Œ
referenced”Khj8 ubhŒ
”…”�”}”(hj8 h²hh³Nh´Nubj )�”}”(hŒ)`HID web page `_”h]”hŒHID web page”…”�”}”(hjf h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒHID web page”jP Œhttps://www.usb.org/hid”uh1hÿhj8 ubjS )�”}”(hŒ ”h]”h}”(h]”Œhid-web-page”ah ]”h"]”Œhid web page”ah$]”h&]”Œrefuri”jv uh1jR ja Khj8 ubhŒ address:”…”�”}”(hj8 h²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³ uh1jR ja Khj› 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í uh1jR ja KhjÕ 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.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K?hjº h²hubeh}”(h]”j ah ]”h"]”Œintroduction”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒParsing HID report descriptors”h]”hŒParsing HID report descriptors”…”�”}”(hj1 h²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/”…”�”}”(hjI h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jG hj? 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&]”uh1jG hj? 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”…”�”}”hju sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1js h³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”j uh1jR ja Khjí 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; uh1jR ja Khj' 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”…”�”}”(hja 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]”Œ hid-tools”ah ]”h"]”Œ hid-tools”ah$]”h&]”Œrefuri”jq uh1jR ja Khj] 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´KkhjY ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hjæ ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1hò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³ uh1jR ja Khj› 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Æuh1js h³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Æuh1js h³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”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1js h³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)”…”�”}”(hj h²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”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1js h³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Æuh1js h³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)”…”�”}”(hjI h²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”…”�”}”hjW sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1js h³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â€�”…”�”}”(hje h²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”…”�”}”hjs sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1js h³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Æuh1js h³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Æuh1js h³hÇh´K¡hj. h²hubhÞ)�”}”(hŒ