mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 09:40:30 +08:00
disabled instead of empty string
This commit is contained in:
parent
96481aa745
commit
a33efcaef3
@ -179,12 +179,12 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
|
||||
|
||||
if outputs1 & 0b10000000: # Dynamic
|
||||
if outputs2 & 0b00000001: # USB
|
||||
keyboard_outputs["available"].extend(["usb"])
|
||||
mouse_outputs["available"].extend(["usb", "usb_rel"])
|
||||
keyboard_outputs["available"].extend(["usb", "disabled"])
|
||||
mouse_outputs["available"].extend(["usb", "usb_rel", "disabled"])
|
||||
|
||||
if outputs2 & 0b00000010: # PS/2
|
||||
keyboard_outputs["available"].extend(["ps2"])
|
||||
mouse_outputs["available"].extend(["ps2"])
|
||||
keyboard_outputs["available"].extend(["ps2", "disabled"])
|
||||
mouse_outputs["available"].extend(["ps2", "disabled"])
|
||||
|
||||
active_keyboard = get_active_keyboard(outputs1)
|
||||
if active_keyboard in keyboard_outputs["available"]:
|
||||
|
||||
@ -38,14 +38,15 @@ class BaseEvent:
|
||||
|
||||
# =====
|
||||
_KEYBOARD_NAMES_TO_CODES = {
|
||||
"usb": 0b00000001,
|
||||
"ps2": 0b00000011,
|
||||
"disabled": 0b00000000,
|
||||
"usb": 0b00000001,
|
||||
"ps2": 0b00000011,
|
||||
}
|
||||
_KEYBOARD_CODES_TO_NAMES = tools.swapped_kvs(_KEYBOARD_NAMES_TO_CODES)
|
||||
|
||||
|
||||
def get_active_keyboard(outputs: int) -> str:
|
||||
return _KEYBOARD_CODES_TO_NAMES.get(outputs & 0b00000111, "")
|
||||
return _KEYBOARD_CODES_TO_NAMES.get(outputs & 0b00000111, "disabled")
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@ -62,15 +63,16 @@ class SetKeyboardOutputEvent(BaseEvent):
|
||||
|
||||
# =====
|
||||
_MOUSE_NAMES_TO_CODES = {
|
||||
"usb": 0b00001000,
|
||||
"usb_rel": 0b00010000,
|
||||
"ps2": 0b00011000,
|
||||
"disabled": 0b00000000,
|
||||
"usb": 0b00001000,
|
||||
"usb_rel": 0b00010000,
|
||||
"ps2": 0b00011000,
|
||||
}
|
||||
_MOUSE_CODES_TO_NAMES = tools.swapped_kvs(_MOUSE_NAMES_TO_CODES)
|
||||
|
||||
|
||||
def get_active_mouse(outputs: int) -> str:
|
||||
return _MOUSE_CODES_TO_NAMES.get(outputs & 0b00111000, "")
|
||||
return _MOUSE_CODES_TO_NAMES.get(outputs & 0b00111000, "disabled")
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
|
||||
@ -33,11 +33,11 @@ from .basic import valid_number
|
||||
|
||||
# =====
|
||||
def valid_hid_keyboard_output(arg: Any) -> str:
|
||||
return check_string_in_list(arg, "Keyboard output", ["usb", "ps2", ""])
|
||||
return check_string_in_list(arg, "Keyboard output", ["usb", "ps2", "disabled"])
|
||||
|
||||
|
||||
def valid_hid_mouse_output(arg: Any) -> str:
|
||||
return check_string_in_list(arg, "Mouse output", ["usb", "usb_rel", "ps2", ""])
|
||||
return check_string_in_list(arg, "Mouse output", ["usb", "usb_rel", "ps2", "disabled"])
|
||||
|
||||
|
||||
def valid_hid_key(arg: Any) -> str:
|
||||
|
||||
@ -118,9 +118,9 @@ export function Hid(__getResolution) {
|
||||
for (let args of [
|
||||
["USB", "usb"],
|
||||
["PS/2", "ps2"],
|
||||
["Off", ""],
|
||||
["Off", "disabled"],
|
||||
]) {
|
||||
if (keyboard_outputs.includes(args[1]) || !args[1]) {
|
||||
if (keyboard_outputs.includes(args[1])) {
|
||||
html += tools.radioMakeItem("hid-outputs-keyboard-radio", args[0], args[1]);
|
||||
}
|
||||
}
|
||||
@ -138,9 +138,9 @@ export function Hid(__getResolution) {
|
||||
["USB", "usb", false],
|
||||
["USB Relative", "usb_rel", true],
|
||||
["PS/2", "ps2", true],
|
||||
["Off", ""],
|
||||
["Off", "disabled"],
|
||||
]) {
|
||||
if (mouse_outputs.includes(args[1]) || !args[1]) {
|
||||
if (mouse_outputs.includes(args[1])) {
|
||||
html += tools.radioMakeItem("hid-outputs-mouse-radio", args[0], args[1]);
|
||||
has_relative = (has_relative || args[2]);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user