sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget /translations/zh_CN/hid/hidintromodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget /translations/zh_TW/hid/hidintromodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget /translations/it_IT/hid/hidintromodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget /translations/ja_JP/hid/hidintromodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget /translations/ko_KR/hid/hidintromodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget /translations/pt_BR/hid/hidintromodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget /translations/sp_SP/hid/hidintromodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh:/var/lib/git/docbuild/linux/Documentation/hid/hidintro.rsthKubhsection)}(hhh](htitle)}(h&Introduction to HID report descriptorsh]h&Introduction to HID report descriptors}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThis 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]hThis 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.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubhtopic)}(hhh]h bullet_list)}(hhh](h list_item)}(hhh]h)}(hhh]h reference)}(hhh]h Introduction}(hjhhhNhNubah}(h]id4ah ]h"]h$]h&]refid introductionuh1hhhubah}(h]h ]h"]h$]h&]uh1hhhubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh](h)}(hhh]j)}(hhh]hParsing HID report descriptors}(hj#hhhNhNubah}(h]id5ah ]h"]h$]h&]refidparsing-hid-report-descriptorsuh1hhj ubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]h)}(hhh]h)}(hhh]j)}(hhh]h!Output, Input and Feature Reports}(hjBhhhNhNubah}(h]id6ah ]h"]h$]h&]refid output-input-and-feature-reportsuh1hhj?ubah}(h]h ]h"]h$]h&]uh1hhj<ubah}(h]h ]h"]h$]h&]uh1hhj9ubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh]h)}(hhh]j)}(hhh]h(Collections, Report IDs and Evdev events}(hjphhhNhNubah}(h]id7ah ]h"]h$]h&]refid'collections-report-ids-and-evdev-eventsuh1hhjmubah}(h]h ]h"]h$]h&]uh1hhjjubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh]h)}(hhh]j)}(hhh]hEvents}(hjhhhNhNubah}(h]id8ah ]h"]h$]h&]refideventsuh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh](h)}(hhh]j)}(hhh]hWhen something does not work}(hjhhhNhNubah}(h]id9ah ]h"]h$]h&]refidwhen-something-does-not-workuh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh](h)}(hhh]h)}(hhh]j)}(hhh]hQuirks}(hjhhhNhNubah}(h]id10ah ]h"]h$]h&]refidquirksuh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]h)}(hhh]j)}(hhh]hFixing HID report descriptors}(hjhhhNhNubah}(h]id11ah ]h"]h$]h&]refidfixing-hid-report-descriptorsuh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]h)}(hhh]j)}(hhh]h)Modifying the transmitted data on the fly}(hjhhhNhNubah}(h]id12ah ]h"]h$]h&]refid)modifying-the-transmitted-data-on-the-flyuh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]h)}(hhh]j)}(hhh]hWriting a specialized driver}(hj9hhhNhNubah}(h]id13ah ]h"]h$]h&]refidwriting-a-specialized-driveruh1hhj6ubah}(h]h ]h"]h$]h&]uh1hhj3ubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhhhhNhNubah}(h]contentsah ](contentslocaleh"]contentsah$]h&]uh1hhhhK hhhhubhcompound)}(hhh]htoctree)}(hhh]h}(h]h ]h"]h$]h&]h hid/hidintroentries]Nhid/hidreport-parsinga includefiles]jamaxdepthKcaptionNglobhidden includehiddennumberedK titlesonly rawentries]uh1jvhhhKhjsubah}(h]h ]toctree-wrapperah"]h$]h&]uh1jqhhhhhhhNubh)}(hhh](h)}(h Introductionh]h Introduction}(hjhhhNhNubah}(h]h ]h"]h$]h&]refidj uh1hhjhhhhhKubh)}(hHID 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]hHID 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXThis 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](hOThis is because modern HID devices do advertise their capabilities through the }(hjhhhNhNubhemphasis)}(h*HID report descriptor*h]hHID report descriptor}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/, a fixed set of bytes describing exactly what }(hjhhhNhNubj)}(h *HID reports*h]h HID reports}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh 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”.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK#hjhhubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjhhubh)}(hXThe 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]hXThe 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK0hjhhubh)}(hThe format of HID report descriptors is described by two documents, available from the `USB Implementers Forum `_ `HID web page `_ address:h](hWThe format of HID report descriptors is described by two documents, available from the }(hjhhhNhNubj)}(h0`USB Implementers Forum `_h]hUSB Implementers Forum}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameUSB Implementers Forumrefurihttps://www.usb.org/uh1hhjubhtarget)}(h h]h}(h]usb-implementers-forumah ]h"]usb implementers forumah$]h&]refurij/uh1j0 referencedKhjubh }(hjhhhNhNubj)}(h)`HID web page `_h]h HID web page}(hjDhhhNhNubah}(h]h ]h"]h$]h&]name HID web pagej.https://www.usb.org/hiduh1hhjubj1)}(h h]h}(h] hid-web-pageah ]h"] hid web pageah$]h&]refurijTuh1j0j?Khjubh address:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK7hjhhubh 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)}(hthe `HID USB Device Class Definition `_ (HID Spec from now on)h]h)}(hthe `HID USB Device Class Definition `_ (HID Spec from now on)h](hthe }(hjyhhhNhNubj)}(hi`HID USB Device Class Definition `_h]hHID USB Device Class Definition}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameHID USB Device Class Definitionj.Dhttps://www.usb.org/document-library/device-class-definition-hid-111uh1hhjyubj1)}(hG h]h}(h]hid-usb-device-class-definitionah ]h"]hid usb device class definitionah$]h&]refurijuh1j0j?Khjyubh (HID Spec from now on)}(hjyhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK;hjuubah}(h]h ]h"]h$]h&]uh1hhjrubh)}(hathe `HID Usage Tables `_ (HUT from now on) h]h)}(h`the `HID Usage Tables `_ (HUT from now on)h](hthe }(hjhhhNhNubj)}(hJ`HID Usage Tables `_h]hHID Usage Tables}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameHID Usage Tablesj.4https://usb.org/document-library/hid-usage-tables-14uh1hhjubj1)}(h7 h]h}(h]hid-usage-tablesah ]h"]hid usage tablesah$]h&]refurijuh1j0j?Khjubh (HUT from now on)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK=hjubah}(h]h ]h"]h$]h&]uh1hhjrubeh}(h]h ]h"]h$]h&]bullet*uh1hhhhK;hjnubah}(h]h ]h"]h$]h&]uh1jlhhhK;hjhhubh)}(hThe HID subsystem can deal with different transport drivers (USB, I2C, Bluetooth, etc.). See Documentation/hid/hid-transport.rst.h]hThe HID subsystem can deal with different transport drivers (USB, I2C, Bluetooth, etc.). See Documentation/hid/hid-transport.rst.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hjhhubeh}(h]jah ]h"] introductionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hParsing HID report descriptorsh]hParsing HID report descriptors}(hjhhhNhNubah}(h]h ]h"]h$]h&]jj,uh1hhj hhhhhKCubh)}(hThe 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](h0The current list of HID devices can be found at }(hjhhhNhNubhliteral)}(h``/sys/bus/hid/devices/``h]h/sys/bus/hid/devices/}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j%hjubh. For each device, say }(hjhhhNhNubj&)}(h/``/sys/bus/hid/devices/0003\:093A\:2510.0002/``h]h+/sys/bus/hid/devices/0003\:093A\:2510.0002/}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1j%hjubh3, one can read the corresponding report descriptor:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKEhj hhubh 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 |....| 00000034h]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}hjSsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKIhj hhubh)}(hhOptional: 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 }(hjahhhNhNubhfootnote_reference)}(h [#hidraw]_h]h1}(hjkhhhNhNubah}(h]id1ah ]h"]h$]h&]autoKjhidrawdocnamejuh1jihjaresolvedKubh.}(hjahhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKPhj hhubh)}(hXThe 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]hXThe 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShj hhubh)}(hXHID report descriptors can, in principle, be painstakingly parsed by hand, byte by byte.h]hXHID report descriptors can, in principle, be painstakingly parsed by hand, byte by byte.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hj hhubh)}(hA 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]hA 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hj hhubh)}(hIn practice you should not parse HID report descriptors by hand; rather, you should use an existing parser. Among all the available onesh]hIn practice you should not parse HID report descriptors by hand; rather, you should use an existing parser. Among all the available ones}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhj hhubjm)}(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 }(hjhhhNhNubj)}(hQ`USB Descriptor and Request Parser `_h]h!USB Descriptor and Request Parser}(hjhhhNhNubah}(h]h ]h"]h$]h&]name!USB Descriptor and Request Parserj.*http://eleccelerator.com/usbdescreqparser/uh1hhjubj1)}(h- h]h}(h]!usb-descriptor-and-request-parserah ]h"]!usb descriptor and request parserah$]h&]refurijuh1j0j?Khjubh;}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKehjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(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]hhidrdd}(hj hhhNhNubah}(h]h ]h"]h$]h&]namehidrddj."https://github.com/abend0c1/hidrdduh1hhjubj1)}(h% h]h}(h]hidrddah ]h"]hidrddah$]h&]refurijuh1j0j?Khjubh, that provides very detailed and somewhat verbose descriptions (verbosity can be useful if you are not familiar with HID report descriptors);}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKghjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(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}(hj?hhhNhNubah}(h]h ]h"]h$]h&]name hid-toolsj.1https://gitlab.freedesktop.org/libevdev/hid-toolsuh1hhj;ubj1)}(h4 h]h}(h] hid-toolsah ]h"] hid-toolsah$]h&]refurijOuh1j0j?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;hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKkhj7ubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhKehjubah}(h]h ]h"]h$]h&]uh1jlhhhKehj hhubh)}(hParsing the mouse HID report descriptor with `hid-tools `_ leads to (explanations interposed)::h](h-Parsing the mouse HID report descriptor with }(hjyhhhNhNubj)}(h@`hid-tools `_h]h hid-tools}(hjhhhNhNubah}(h]h ]h"]h$]h&]name hid-toolsj.1https://gitlab.freedesktop.org/libevdev/hid-toolsuh1hhjyubj1)}(h4 h]h}(h]id2ah ]h"]h$] hid-toolsah&]refurijuh1j0j?Khjyubh$ leads to (explanations interposed):}(hjyhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKqhj hhubjR)}(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) 10h]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}hjsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKuhj hhubh)}(hwhat follows is a button ::h]hwhat follows is a button}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK~hj hhubjR)}(h# 0x19, 0x01, // Usage Minimum (1) 12 # 0x29, 0x03, // Usage Maximum (3) 14h]h# 0x19, 0x01, // Usage Minimum (1) 12 # 0x29, 0x03, // Usage Maximum (3) 14}hjsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(hBfirst 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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(h# 0x15, 0x00, // Logical Minimum (0) 16 # 0x25, 0x01, // Logical Maximum (1) 18h]h# 0x15, 0x00, // Logical Minimum (0) 16 # 0x25, 0x01, // Logical Maximum (1) 18}hjsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(hVeach button can send values from 0 up to including 1 (i.e. they are binary buttons) ::h]hSeach button can send values from 0 up to including 1 (i.e. they are binary buttons)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(hI# 0x75, 0x01, // Report Size (1) 20h]hI# 0x75, 0x01, // Report Size (1) 20}hjsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(h)each button is sent as exactly one bit ::h]h&each button is sent as exactly one bit}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(hI# 0x95, 0x03, // Report Count (3) 22h]hI# 0x95, 0x03, // Report Count (3) 22}hjsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(hAand there are three of those bits (matching the three buttons) ::h]h>and there are three of those bits (matching the three buttons)}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(hI# 0x81, 0x02, // Input (Data,Var,Abs) 24h]hI# 0x81, 0x02, // Input (Data,Var,Abs) 24}hj5sbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(hit'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]hit’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”}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(hI# 0x75, 0x05, // Report Size (5) 26h]hI# 0x75, 0x05, // Report Size (5) 26}hjQsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(h7five additional padding bits, needed to reach a byte ::h]h4five additional padding bits, needed to reach a byte}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(hI# 0x95, 0x01, // Report Count (1) 28h]hI# 0x95, 0x01, // Report Count (1) 28}hjmsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(h)those five bits are repeated only once ::h]h&those five bits are repeated only once}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(hI# 0x81, 0x01, // Input (Cnst,Arr,Abs) 30h]hI# 0x81, 0x01, // Input (Cnst,Arr,Abs) 30}hjsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(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 }(hjMhhhNhNubj)}(h*report*h]hreport}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjMubhF of four bytes. We can check the values sent by resorting e.g. to the }(hjMhhhNhNubhtitle_reference)}(h`hid-recorder`h]h hid-recorder}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1jghjMubh tool, from }(hjMhhhNhNubj)}(h@`hid-tools `_h]h hid-tools}(hj{hhhNhNubah}(h]h ]h"]h$]h&]name hid-toolsj.1https://gitlab.freedesktop.org/libevdev/hid-toolsuh1hhjMubj1)}(h4 h]h}(h]id3ah ]h"]h$] hid-toolsah&]refurijuh1j0j?KhjMubha: The sequence of bytes sent by clicking and releasing button 1, then button 2, then button 3 is:}(hjMhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjR)}(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 00h]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}hjsbah}(h]h ]h"]h$]h&]hhuh1jQhhhKhj hhubh)}(hThis 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