~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/hid/hidreport-parsing.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/hid/hidreport-parsing.rst (Version linux-6.12-rc7) and /Documentation/hid/hidreport-parsing.rst (Version linux-6.6.60)


  1 .. SPDX-License-Identifier: GPL-2.0                 1 .. SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 ========================================            3 ========================================
  4 Manual parsing of HID report descriptors            4 Manual parsing of HID report descriptors
  5 ========================================            5 ========================================
  6                                                     6 
  7 Consider again the mouse HID report descriptor      7 Consider again the mouse HID report descriptor
  8 introduced in Documentation/hid/hidintro.rst::      8 introduced in Documentation/hid/hidintro.rst::
  9                                                     9 
 10   $ hexdump -C /sys/bus/hid/devices/0003\:093A     10   $ hexdump -C /sys/bus/hid/devices/0003\:093A\:2510.0002/report_descriptor
 11   00000000  05 01 09 02 a1 01 09 01  a1 00 05      11   00000000  05 01 09 02 a1 01 09 01  a1 00 05 09 19 01 29 03  |..............).|
 12   00000010  15 00 25 01 75 01 95 03  81 02 75      12   00000010  15 00 25 01 75 01 95 03  81 02 75 05 95 01 81 01  |..%.u.....u.....|
 13   00000020  05 01 09 30 09 31 09 38  15 81 25      13   00000020  05 01 09 30 09 31 09 38  15 81 25 7f 75 08 95 03  |...0.1.8..%.u...|
 14   00000030  81 06 c0 c0                            14   00000030  81 06 c0 c0                                       |....|
 15   00000034                                         15   00000034
 16                                                    16 
 17 and try to parse it by hand.                       17 and try to parse it by hand.
 18                                                    18 
 19 Start with the first number, 0x05: it carries      19 Start with the first number, 0x05: it carries 2 bits for the
 20 length of the item, 2 bits for the type of the     20 length of the item, 2 bits for the type of the item and 4 bits for the
 21 function::                                         21 function::
 22                                                    22 
 23   +----------+                                     23   +----------+
 24   | 00000101 |                                     24   | 00000101 |
 25   +----------+                                     25   +----------+
 26           ^^                                       26           ^^
 27           ---- Length of data (see HID spec 6.     27           ---- Length of data (see HID spec 6.2.2.2)
 28         ^^                                         28         ^^
 29         ------ Type of the item (see HID spec      29         ------ Type of the item (see HID spec 6.2.2.2, then jump to 6.2.2.7)
 30     ^^^^                                           30     ^^^^
 31     --------- Function of the item (see HID sp     31     --------- Function of the item (see HID spec 6.2.2.7, then HUT Sec 3)
 32                                                    32 
 33 In our case, the length is 1 byte, the type is     33 In our case, the length is 1 byte, the type is ``Global`` and the
 34 function is ``Usage Page``, thus for parsing t     34 function is ``Usage Page``, thus for parsing the value 0x01 in the second byte
 35 we need to refer to HUT Sec 3.                     35 we need to refer to HUT Sec 3.
 36                                                    36 
 37 The second number is the actual data, and its      37 The second number is the actual data, and its meaning can be found in
 38 the HUT. We have a ``Usage Page``, thus we nee     38 the HUT. We have a ``Usage Page``, thus we need to refer to HUT
 39 Sec. 3, "Usage Pages"; from there, one sees th     39 Sec. 3, "Usage Pages"; from there, one sees that ``0x01`` stands for
 40 ``Generic Desktop Page``.                          40 ``Generic Desktop Page``.
 41                                                    41 
 42 Moving now to the second two bytes, and follow     42 Moving now to the second two bytes, and following the same scheme,
 43 ``0x09`` (i.e. ``00001001``) will be followed      43 ``0x09`` (i.e. ``00001001``) will be followed by one byte (``01``)
 44 and is a ``Local`` item (``10``). Thus, the me     44 and is a ``Local`` item (``10``). Thus, the meaning of the remaining four bits
 45 (``0000``) is given in the HID spec Sec. 6.2.2     45 (``0000``) is given in the HID spec Sec. 6.2.2.8 "Local Items", so that
 46 we have a ``Usage``. From HUT, Sec. 4, "Generi     46 we have a ``Usage``. From HUT, Sec. 4, "Generic Desktop Page",  we see that
 47 0x02 stands for ``Mouse``.                         47 0x02 stands for ``Mouse``.
 48                                                    48 
 49 The following numbers can be parsed in the sam     49 The following numbers can be parsed in the same way.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php