From e87942a5a9893918d0ce7ea015dd712ddb4b1793 Mon Sep 17 00:00:00 2001 From: mofeng-git Date: Thu, 21 Aug 2025 17:29:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20CH9329=20HID=20?= =?UTF-8?q?=E8=8A=AF=E7=89=87=E6=96=AD=E8=81=94=E8=87=AA=E5=8A=A8=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 当 CH9329 芯片通信异常时自动发送复位命令 - 增加 2 秒延迟等待芯片恢复连接 - 防止 HID 功能因芯片断联而失效 代码来自 https://github.com/mofeng-git/One-KVM/pull/164 代码作者 https://github.com/snltty --- kvmd/plugins/hid/ch9329/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kvmd/plugins/hid/ch9329/__init__.py b/kvmd/plugins/hid/ch9329/__init__.py index ed3f5dcf..c90ebeba 100644 --- a/kvmd/plugins/hid/ch9329/__init__.py +++ b/kvmd/plugins/hid/ch9329/__init__.py @@ -232,7 +232,11 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst led_byte = conn.xfer(cmd) except ChipResponseError as ex: self.__set_state_online(False) - get_logger(0).error("Invalid chip response: %s", tools.efmt(ex)) + get_logger(0).error("Invalid chip response: %s,%s", self.__device_path, tools.efmt(ex)) + try: + conn.xfer(b"\x00\x0F\x00") + except Exception: + return False time.sleep(2) else: if led_byte >= 0: