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