mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
simplified outputs api
This commit is contained in:
parent
f4a8a117c7
commit
5eff81061b
@ -174,18 +174,17 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
|
|||||||
if online and active_mouse in ["usb_rel", "ps2"]:
|
if online and active_mouse in ["usb_rel", "ps2"]:
|
||||||
absolute = False
|
absolute = False
|
||||||
|
|
||||||
keyboard_outputs: Dict = {"available": {}, "active": ""}
|
keyboard_outputs: Dict = {"available": [], "active": ""}
|
||||||
mouse_outputs: Dict = {"available": {}, "active": ""}
|
mouse_outputs: Dict = {"available": [], "active": ""}
|
||||||
|
|
||||||
if outputs & 0b10000000: # Dynamic
|
if outputs & 0b10000000: # Dynamic
|
||||||
if features & 0b00000001: # USB
|
if features & 0b00000001: # USB
|
||||||
keyboard_outputs["available"]["usb"] = {"name": "USB"}
|
keyboard_outputs["available"].extend(["usb"])
|
||||||
mouse_outputs["available"]["usb"] = {"name": "USB", "absolute": True}
|
mouse_outputs["available"].extend(["usb", "usb_rel"])
|
||||||
mouse_outputs["available"]["usb_rel"] = {"name": "USB Relative", "absolute": False}
|
|
||||||
|
|
||||||
if features & 0b00000010: # PS/2
|
if features & 0b00000010: # PS/2
|
||||||
keyboard_outputs["available"]["ps2"] = {"name": "PS/2"}
|
keyboard_outputs["available"].extend(["ps2"])
|
||||||
mouse_outputs["available"]["ps2"] = {"name": "PS/2"}
|
mouse_outputs["available"].extend(["ps2"])
|
||||||
|
|
||||||
active_keyboard = get_active_keyboard(outputs)
|
active_keyboard = get_active_keyboard(outputs)
|
||||||
if active_keyboard in keyboard_outputs["available"]:
|
if active_keyboard in keyboard_outputs["available"]:
|
||||||
|
|||||||
@ -131,7 +131,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
async def get_state(self) -> Dict:
|
async def get_state(self) -> Dict:
|
||||||
state = await self.__server.get_state()
|
state = await self.__server.get_state()
|
||||||
outputs: Dict = {"available": {}, "active": ""}
|
outputs: Dict = {"available": [], "active": ""}
|
||||||
return {
|
return {
|
||||||
"online": True,
|
"online": True,
|
||||||
"keyboard": {
|
"keyboard": {
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class Plugin(BaseHid):
|
|||||||
async def get_state(self) -> Dict:
|
async def get_state(self) -> Dict:
|
||||||
keyboard_state = await self.__keyboard_proc.get_state()
|
keyboard_state = await self.__keyboard_proc.get_state()
|
||||||
mouse_state = await self.__mouse_proc.get_state()
|
mouse_state = await self.__mouse_proc.get_state()
|
||||||
outputs: Dict = {"available": {}, "active": ""}
|
outputs: Dict = {"available": [], "active": ""}
|
||||||
return {
|
return {
|
||||||
"online": True,
|
"online": True,
|
||||||
"keyboard": {
|
"keyboard": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user