mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
using evdev instead of string constants
This commit is contained in:
@@ -51,6 +51,7 @@ RUN pacman --noconfirm --ask=4 -Syy \
|
||||
python-qrcode \
|
||||
python-pyserial \
|
||||
python-pyudev \
|
||||
python-evdev \
|
||||
python-setproctitle \
|
||||
python-psutil \
|
||||
python-netifaces \
|
||||
|
||||
@@ -29,6 +29,7 @@ _AtxApiPart.switch_power
|
||||
_UsbKey.arduino_modifier_code
|
||||
|
||||
_KeyMapping.web_name
|
||||
_KeyMapping.evdev_name
|
||||
_KeyMapping.mcu_code
|
||||
_KeyMapping.usb_key
|
||||
_KeyMapping.ps2_key
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# ========================================================================== #
|
||||
# #
|
||||
# KVMD - The main PiKVM daemon. #
|
||||
# #
|
||||
# Copyright (C) 2018-2024 Maxim Devaev <mdevaev@gmail.com> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
# ========================================================================== #
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from kvmd.keyboard.mappings import KEYMAP
|
||||
|
||||
|
||||
# =====
|
||||
def test_ok__keymap() -> None:
|
||||
assert KEYMAP["KeyA"].mcu.code == 1
|
||||
|
||||
|
||||
def test_fail__keymap() -> None:
|
||||
with pytest.raises(KeyError):
|
||||
print(KEYMAP["keya"])
|
||||
@@ -24,7 +24,7 @@ from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from kvmd.keyboard.mappings import KEYMAP
|
||||
from kvmd.keyboard.mappings import WEB_TO_EVDEV
|
||||
|
||||
from kvmd.validators import ValidatorError
|
||||
from kvmd.validators.hid import valid_hid_key
|
||||
@@ -35,7 +35,7 @@ from kvmd.validators.hid import valid_hid_mouse_delta
|
||||
|
||||
# =====
|
||||
def test_ok__valid_hid_key() -> None:
|
||||
for key in KEYMAP:
|
||||
for key in WEB_TO_EVDEV:
|
||||
print(valid_hid_key(key))
|
||||
print(valid_hid_key(key + " "))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user