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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/hid/tests/test_hid_core.py

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 ] ~

  1 #!/bin/env python3
  2 # SPDX-License-Identifier: GPL-2.0
  3 # -*- coding: utf-8 -*-
  4 #
  5 # Copyright (c) 2017 Benjamin Tissoires <benjamin.tissoires@gmail.com>
  6 # Copyright (c) 2017 Red Hat, Inc.
  7 #
  8 # This program is free software: you can redistribute it and/or modify
  9 # it under the terms of the GNU General Public License as published by
 10 # the Free Software Foundation; either version 2 of the License, or
 11 # (at your option) any later version.
 12 #
 13 # This program is distributed in the hope that it will be useful,
 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 # GNU General Public License for more details.
 17 #
 18 # You should have received a copy of the GNU General Public License
 19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 20 #
 21 
 22 # This is for generic devices
 23 
 24 from . import base
 25 import logging
 26 
 27 logger = logging.getLogger("hidtools.test.hid")
 28 
 29 
 30 class TestCollectionOverflow(base.BaseTestCase.TestUhid):
 31     """
 32     Test class to test re-allocation of the HID collection stack in
 33     hid-core.c.
 34     """
 35 
 36     def create_device(self):
 37         # fmt: off
 38         report_descriptor = [
 39             0x05, 0x01,         # .Usage Page (Generic Desktop)
 40             0x09, 0x02,         # .Usage (Mouse)
 41             0xa1, 0x01,         # .Collection (Application)
 42             0x09, 0x02,         # ..Usage (Mouse)
 43             0xa1, 0x02,         # ..Collection (Logical)
 44             0x09, 0x01,         # ...Usage (Pointer)
 45             0xa1, 0x00,         # ...Collection (Physical)
 46             0x05, 0x09,         # ....Usage Page (Button)
 47             0x19, 0x01,         # ....Usage Minimum (1)
 48             0x29, 0x03,         # ....Usage Maximum (3)
 49             0x15, 0x00,         # ....Logical Minimum (0)
 50             0x25, 0x01,         # ....Logical Maximum (1)
 51             0x75, 0x01,         # ....Report Size (1)
 52             0x95, 0x03,         # ....Report Count (3)
 53             0x81, 0x02,         # ....Input (Data,Var,Abs)
 54             0x75, 0x05,         # ....Report Size (5)
 55             0x95, 0x01,         # ....Report Count (1)
 56             0x81, 0x03,         # ....Input (Cnst,Var,Abs)
 57             0xa1, 0x02,         # ....Collection (Logical)
 58             0x09, 0x01,         # .....Usage (Pointer)
 59             0xa1, 0x02,         # ....Collection (Logical)
 60             0x09, 0x01,         # .....Usage (Pointer)
 61             0xa1, 0x02,         # ....Collection (Logical)
 62             0x09, 0x01,         # .....Usage (Pointer)
 63             0xa1, 0x02,         # ....Collection (Logical)
 64             0x09, 0x01,         # .....Usage (Pointer)
 65             0xa1, 0x02,         # ....Collection (Logical)
 66             0x09, 0x01,         # .....Usage (Pointer)
 67             0xa1, 0x02,         # ....Collection (Logical)
 68             0x09, 0x01,         # .....Usage (Pointer)
 69             0xa1, 0x02,         # ....Collection (Logical)
 70             0x09, 0x01,         # .....Usage (Pointer)
 71             0xa1, 0x02,         # ....Collection (Logical)
 72             0x09, 0x01,         # .....Usage (Pointer)
 73             0xa1, 0x02,         # ....Collection (Logical)
 74             0x09, 0x01,         # .....Usage (Pointer)
 75             0xa1, 0x02,         # ....Collection (Logical)
 76             0x09, 0x01,         # .....Usage (Pointer)
 77             0xa1, 0x02,         # ....Collection (Logical)
 78             0x09, 0x01,         # .....Usage (Pointer)
 79             0xa1, 0x02,         # ....Collection (Logical)
 80             0x09, 0x01,         # .....Usage (Pointer)
 81             0xa1, 0x02,         # ....Collection (Logical)
 82             0x09, 0x01,         # .....Usage (Pointer)
 83             0xa1, 0x02,         # ....Collection (Logical)
 84             0x09, 0x01,         # .....Usage (Pointer)
 85             0xa1, 0x02,         # ....Collection (Logical)
 86             0x09, 0x01,         # .....Usage (Pointer)
 87             0xa1, 0x02,         # ....Collection (Logical)
 88             0x09, 0x01,         # .....Usage (Pointer)
 89             0xa1, 0x02,         # ....Collection (Logical)
 90             0x09, 0x01,         # .....Usage (Pointer)
 91             0x05, 0x01,         # .....Usage Page (Generic Desktop)
 92             0x09, 0x30,         # .....Usage (X)
 93             0x09, 0x31,         # .....Usage (Y)
 94             0x15, 0x81,         # .....Logical Minimum (-127)
 95             0x25, 0x7f,         # .....Logical Maximum (127)
 96             0x75, 0x08,         # .....Report Size (8)
 97             0x95, 0x02,         # .....Report Count (2)
 98             0x81, 0x06,         # .....Input (Data,Var,Rel)
 99             0xa1, 0x02,         # ...Collection (Logical)
100             0x85, 0x12,         # ....Report ID (18)
101             0x09, 0x48,         # ....Usage (Resolution Multiplier)
102             0x95, 0x01,         # ....Report Count (1)
103             0x75, 0x02,         # ....Report Size (2)
104             0x15, 0x00,         # ....Logical Minimum (0)
105             0x25, 0x01,         # ....Logical Maximum (1)
106             0x35, 0x01,         # ....Physical Minimum (1)
107             0x45, 0x0c,         # ....Physical Maximum (12)
108             0xb1, 0x02,         # ....Feature (Data,Var,Abs)
109             0x85, 0x1a,         # ....Report ID (26)
110             0x09, 0x38,         # ....Usage (Wheel)
111             0x35, 0x00,         # ....Physical Minimum (0)
112             0x45, 0x00,         # ....Physical Maximum (0)
113             0x95, 0x01,         # ....Report Count (1)
114             0x75, 0x10,         # ....Report Size (16)
115             0x16, 0x01, 0x80,   # ....Logical Minimum (-32767)
116             0x26, 0xff, 0x7f,   # ....Logical Maximum (32767)
117             0x81, 0x06,         # ....Input (Data,Var,Rel)
118             0xc0,               # ...End Collection
119             0xc0,               # ...End Collection
120             0xc0,               # ...End Collection
121             0xc0,               # ...End Collection
122             0xc0,               # ...End Collection
123             0xc0,               # ...End Collection
124             0xc0,               # ...End Collection
125             0xc0,               # ...End Collection
126             0xc0,               # ...End Collection
127             0xc0,               # ...End Collection
128             0xc0,               # ...End Collection
129             0xc0,               # ...End Collection
130             0xc0,               # ...End Collection
131             0xc0,               # ...End Collection
132             0xc0,               # ...End Collection
133             0xc0,               # ...End Collection
134             0xc0,               # ...End Collection
135             0xc0,               # ...End Collection
136             0xc0,               # ...End Collection
137             0xc0,               # ..End Collection
138             0xc0,               # .End Collection
139         ]
140         # fmt: on
141         return base.UHIDTestDevice(
142             name=None, rdesc=report_descriptor, application="Mouse"
143         )
144 
145     def test_rdesc(self):
146         """
147         This test can only check for negatives. If the kernel crashes, you
148         know why. If this test passes, either the bug isn't present or just
149         didn't get triggered. No way to know.
150 
151         For an explanation, see kernel patch
152             HID: core: replace the collection tree pointers with indices
153         """
154         pass

~ [ 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