#!/bin/env python3
# SPDX-License-Identifier: GPL-2.0
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Benjamin Tissoires <benjamin.tissoires@gmail.com>
# Copyright (c) 2020 Red Hat, Inc.
#
from .test_keyboard import ArrayKeyboard, TestArrayKeyboard
from hidtools.util import BusType
import libevdev
import logging
from . import base
logger = logging.getLogger("hidtools.test.ite-keyboard" )
KERNEL_MODULE = base.KernelModule("itetech" , "hid_ite" )
class KbdData(object):
pass
# The ITE keyboards have an issue regarding the Wifi key:
# nothing comes in when pressing the key, but we get a null
# event on the key release.
# This test covers this case.
class ITEKeyboard(ArrayKeyboard):
# fmt: off
report_descriptor = [
0 x06, 0 x85, 0 xff, # Usage Page (Vendor Usage Page 0xff85)
0 x09, 0 x95, # Usage (Vendor Usage 0x95) 3
0 xa1, 0 x01, # Collection (Application) 5
0 x85, 0 x5a, # .Report ID (90) 7
0 x09, 0 x01, # .Usage (Vendor Usage 0x01) 9
0 x15, 0 x00, # .Logical Minimum (0) 11
0 x26, 0 xff, 0 x00, # .Logical Maximum (255) 13
0 x75, 0 x08, # .Report Size (8) 16
0 x95, 0 x10, # .Report Count (16) 18
0 xb1, 0 x00, # .Feature (Data,Arr,Abs) 20
0 xc0, # End Collection 22
0 x05, 0 x01, # Usage Page (Generic Desktop) 23
0 x09, 0 x06, # Usage (Keyboard) 25
0 xa1, 0 x01, # Collection (Application) 27
0 x85, 0 x01, # .Report ID (1) 29
0 x75, 0 x01, # .Report Size (1) 31
0 x95, 0 x08, # .Report Count (8) 33
0 x05, 0 x07, # .Usage Page (Keyboard) 35
0 x19, 0 xe0, # .Usage Minimum (224) 37
0 x29, 0 xe7, # .Usage Maximum (231) 39
0 x15, 0 x00, # .Logical Minimum (0) 41
0 x25, 0 x01, # .Logical Maximum (1) 43
0 x81, 0 x02, # .Input (Data,Var,Abs) 45
0 x95, 0 x01, # .Report Count (1) 47
0 x75, 0 x08, # .Report Size (8) 49
0 x81, 0 x03, # .Input (Cnst,Var,Abs) 51
0 x95, 0 x05, # .Report Count (5) 53
0 x75, 0 x01, # .Report Size (1) 55
0 x05, 0 x08, # .Usage Page (LEDs) 57
0 x19, 0 x01, # .Usage Minimum (1) 59
0 x29, 0 x05, # .Usage Maximum (5) 61
0 x91, 0 x02, # .Output (Data,Var,Abs) 63
0 x95, 0 x01, # .Report Count (1) 65
0 x75, 0 x03, # .Report Size (3) 67
0 x91, 0 x03, # .Output (Cnst,Var,Abs) 69
0 x95, 0 x06, # .Report Count (6) 71
0 x75, 0 x08, # .Report Size (8) 73
0 x15, 0 x00, # .Logical Minimum (0) 75
0 x26, 0 xff, 0 x00, # .Logical Maximum (255) 77
0 x05, 0 x07, # .Usage Page (Keyboard) 80
0 x19, 0 x00, # .Usage Minimum (0) 82
0 x2a, 0 xff, 0 x00, # .Usage Maximum (255) 84
0 x81, 0 x00, # .Input (Data,Arr,Abs) 87
0 xc0, # End Collection 89
0 x05, 0 x0c, # Usage Page (Consumer Devices) 90
0 x09, 0 x01, # Usage (Consumer Control) 92
0 xa1, 0 x01, # Collection (Application) 94
0 x85, 0 x02, # .Report ID (2) 96
0 x19, 0 x00, # .Usage Minimum (0) 98
0 x2a, 0 x3c, 0 x02, # .Usage Maximum (572) 100
0 x15, 0 x00, # .Logical Minimum (0) 103
0 x26, 0 x3c, 0 x02, # .Logical Maximum (572) 105
0 x75, 0 x10, # .Report Size (16) 108
0 x95, 0 x01, # .Report Count (1) 110
0 x81, 0 x00, # .Input (Data,Arr,Abs) 112
0 xc0, # End Collection 114
0 x05, 0 x01, # Usage Page (Generic Desktop) 115
0 x09, 0 x0c, # Usage (Wireless Radio Controls) 117
0 xa1, 0 x01, # Collection (Application) 119
0 x85, 0 x03, # .Report ID (3) 121
0 x15, 0 x00, # .Logical Minimum (0) 123
0 x25, 0 x01, # .Logical Maximum (1) 125
0 x09, 0 xc6, # .Usage (Wireless Radio Button) 127
0 x95, 0 x01, # .Report Count (1) 129
0 x75, 0 x01, # .Report Size (1) 131
0 x81, 0 x06, # .Input (Data,Var,Rel) 133
0 x75, 0 x07, # .Report Size (7) 135
0 x81, 0 x03, # .Input (Cnst,Var,Abs) 137
0 xc0, # End Collection 139
0 x05, 0 x88, # Usage Page (Vendor Usage Page 0x88) 140
0 x09, 0 x01, # Usage (Vendor Usage 0x01) 142
0 xa1, 0 x01, # Collection (Application) 144
0 x85, 0 x04, # .Report ID (4) 146
0 x19, 0 x00, # .Usage Minimum (0) 148
0 x2a, 0 xff, 0 xff, # .Usage Maximum (65535) 150
0 x15, 0 x00, # .Logical Minimum (0) 153
0 x26, 0 xff, 0 xff, # .Logical Maximum (65535) 155
0 x75, 0 x08, # .Report Size (8) 158
0 x95, 0 x02, # .Report Count (2) 160
0 x81, 0 x02, # .Input (Data,Var,Abs) 162
0 xc0, # End Collection 164
0 x05, 0 x01, # Usage Page (Generic Desktop) 165
0 x09, 0 x80, # Usage (System Control) 167
0 xa1, 0 x01, # Collection (Application) 169
0 x85, 0 x05, # .Report ID (5) 171
0 x19, 0 x81, # .Usage Minimum (129) 173
0 x29, 0 x83, # .Usage Maximum (131) 175
0 x15, 0 x00, # .Logical Minimum (0) 177
0 x25, 0 x01, # .Logical Maximum (1) 179
0 x95, 0 x08, # .Report Count (8) 181
0 x75, 0 x01, # .Report Size (1) 183
0 x81, 0 x02, # .Input (Data,Var,Abs) 185
0 xc0, # End Collection 187
]
# fmt: on
def __init__(
self,
rdesc=report_descriptor,
name=None ,
input_info=(BusType.USB, 0 x06CB, 0 x2968),
):
super().__init__(rdesc, name, input_info)
def event(self, keys, reportID=None , application=None ):
application = application or "Keyboard"
return super().event(keys, reportID, application)
class TestITEKeyboard(TestArrayKeyboard):
kernel_modules = [KERNEL_MODULE]
def create_device(self):
return ITEKeyboard()
def test_wifi_key(self):
uhdev = self.uhdev
syn_event = self.syn_event
# the following sends a 'release' event on the Wifi key.
# the kernel is supposed to translate this into Wifi key
# down and up
r = [0 x03, 0 x00]
uhdev.call_input_event(r)
expected = [syn_event]
expected.append(libevdev.InputEvent(libevdev.EV_KEY.KEY_RFKILL, 1 ))
events = uhdev.next_sync_events()
self.debug_reports([r], uhdev, events)
self.assertInputEventsIn(expected, events)
expected = [syn_event]
expected.append(libevdev.InputEvent(libevdev.EV_KEY.KEY_RFKILL, 0 ))
# the kernel sends the two down/up key events in a batch, no need to
# call events = uhdev.next_sync_events()
self.debug_reports([], uhdev, events)
self.assertInputEventsIn(expected, events)
Messung V0.5 in Prozent C=95 H=89 G=91
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-08)
¤
*© Formatika GbR, Deutschland