#!/bin/env python3
# SPDX-License-Identifier: GPL-2.0
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Benjamin Tissoires <benjamin.tissoires@gmail.com>
# Copyright (c) 2021 Red Hat, Inc.
#
from . import base
import copy
from enum import Enum
from hidtools.util import BusType
import libevdev
import logging
import pytest
from typing import Dict, List, Optional, Tuple
logger = logging.getLogger("hidtools.test.tablet")
class BtnTouch(Enum):
"""Represents whether the BTN_TOUCH event is set to True or False"""
DOWN = True
UP = False
class ToolType(Enum):
PEN = libevdev.EV_KEY.BTN_TOOL_PEN
RUBBER = libevdev.EV_KEY.BTN_TOOL_RUBBER
class BtnPressed(Enum):
"""Represents whether a button is pressed on the stylus"""
PRIMARY_PRESSED = libevdev.EV_KEY.BTN_STYLUS
SECONDARY_PRESSED = libevdev.EV_KEY.BTN_STYLUS2
THIRD_PRESSED = libevdev.EV_KEY.BTN_STYLUS3
class PenState(Enum):
"""Pen states according to Microsoft reference:
https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
We extend it with the various buttons when we need to check them.
"""
PEN_IS_OUT_OF_RANGE = BtnTouch.UP,