tools/testing/selftests/hid/tests/test_apple_keyboard.py

Source file repositories/reference/linux-study-clean/tools/testing/selftests/hid/tests/test_apple_keyboard.py

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/hid/tests/test_apple_keyboard.py
Extension
.py
Size
19021 bytes
Lines
442
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/env python3
# SPDX-License-Identifier: GPL-2.0
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 Benjamin Tissoires <benjamin.tissoires@gmail.com>
# Copyright (c) 2019 Red Hat, Inc.
#

from .test_keyboard import ArrayKeyboard, TestArrayKeyboard
from hidtools.util import BusType
from . import base

import libevdev
import logging

logger = logging.getLogger("hidtools.test.apple-keyboard")

KERNEL_MODULE = base.KernelModule("apple", "hid-apple")


class KbdData(object):
    pass


class AppleKeyboard(ArrayKeyboard):
    # fmt: off
    report_descriptor = [
        0x05, 0x01,         # Usage Page (Generic Desktop)
        0x09, 0x06,         # Usage (Keyboard)
        0xa1, 0x01,         # Collection (Application)
        0x85, 0x01,         # .Report ID (1)
        0x05, 0x07,         # .Usage Page (Keyboard)
        0x19, 0xe0,         # .Usage Minimum (224)
        0x29, 0xe7,         # .Usage Maximum (231)
        0x15, 0x00,         # .Logical Minimum (0)
        0x25, 0x01,         # .Logical Maximum (1)
        0x75, 0x01,         # .Report Size (1)
        0x95, 0x08,         # .Report Count (8)
        0x81, 0x02,         # .Input (Data,Var,Abs)
        0x75, 0x08,         # .Report Size (8)
        0x95, 0x01,         # .Report Count (1)
        0x81, 0x01,         # .Input (Cnst,Arr,Abs)
        0x75, 0x01,         # .Report Size (1)
        0x95, 0x05,         # .Report Count (5)
        0x05, 0x08,         # .Usage Page (LEDs)
        0x19, 0x01,         # .Usage Minimum (1)
        0x29, 0x05,         # .Usage Maximum (5)
        0x91, 0x02,         # .Output (Data,Var,Abs)
        0x75, 0x03,         # .Report Size (3)
        0x95, 0x01,         # .Report Count (1)
        0x91, 0x01,         # .Output (Cnst,Arr,Abs)
        0x75, 0x08,         # .Report Size (8)
        0x95, 0x06,         # .Report Count (6)
        0x15, 0x00,         # .Logical Minimum (0)
        0x26, 0xff, 0x00,   # .Logical Maximum (255)
        0x05, 0x07,         # .Usage Page (Keyboard)
        0x19, 0x00,         # .Usage Minimum (0)
        0x2a, 0xff, 0x00,   # .Usage Maximum (255)
        0x81, 0x00,         # .Input (Data,Arr,Abs)
        0xc0,               # End Collection
        0x05, 0x0c,         # Usage Page (Consumer Devices)
        0x09, 0x01,         # Usage (Consumer Control)
        0xa1, 0x01,         # Collection (Application)
        0x85, 0x47,         # .Report ID (71)
        0x05, 0x01,         # .Usage Page (Generic Desktop)
        0x09, 0x06,         # .Usage (Keyboard)
        0xa1, 0x02,         # .Collection (Logical)
        0x05, 0x06,         # ..Usage Page (Generic Device Controls)
        0x09, 0x20,         # ..Usage (Battery Strength)
        0x15, 0x00,         # ..Logical Minimum (0)

Annotation

Implementation Notes