mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
disable serial port for spi
This commit is contained in:
parent
fef625aee5
commit
55a6828039
@ -1,5 +1,6 @@
|
|||||||
# https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html
|
# https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html
|
||||||
|
|
||||||
|
|
||||||
from os import rename
|
from os import rename
|
||||||
from os import symlink
|
from os import symlink
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
|
|||||||
19
hid/patch.py
19
hid/patch.py
@ -1,5 +1,6 @@
|
|||||||
# https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html
|
# https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html
|
||||||
|
|
||||||
|
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
from os.path import join
|
from os.path import join
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -10,6 +11,12 @@ Import("env")
|
|||||||
|
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
|
def _get_pkg_path(name: str) -> str:
|
||||||
|
path = env.PioPlatform().get_package_dir(name)
|
||||||
|
assert exists(path)
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
def _get_libs() -> Dict[str, str]:
|
def _get_libs() -> Dict[str, str]:
|
||||||
return {
|
return {
|
||||||
builder.name: builder.path
|
builder.name: builder.path
|
||||||
@ -17,15 +24,17 @@ def _get_libs() -> Dict[str, str]:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _patch_lib(lib_path: str, patch_path: str) -> None:
|
def _patch(path: str, patch_path: str) -> None:
|
||||||
assert exists(lib_path)
|
assert exists(path)
|
||||||
flag_path: str = join(lib_path, f".{basename(patch_path)}.done")
|
flag_path: str = join(path, f".{basename(patch_path)}.done")
|
||||||
if not exists(flag_path):
|
if not exists(flag_path):
|
||||||
env.Execute(f"patch -p1 -d {lib_path} < {patch_path}")
|
env.Execute(f"patch -p1 -d {path} < {patch_path}")
|
||||||
env.Execute(lambda *_, **__: open(flag_path, "w").close())
|
env.Execute(lambda *_, **__: open(flag_path, "w").close())
|
||||||
|
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
|
_patch(_get_pkg_path("framework-arduino-avr"), "patches/serial.patch")
|
||||||
|
|
||||||
_libs = _get_libs()
|
_libs = _get_libs()
|
||||||
if "HID-Project" in _libs:
|
if "HID-Project" in _libs:
|
||||||
_patch_lib(_libs["HID-Project"], "patches/absmouse.patch")
|
_patch(_libs["HID-Project"], "patches/absmouse.patch")
|
||||||
|
|||||||
24
hid/patches/serial.patch
Normal file
24
hid/patches/serial.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
https://github.com/arduino/Arduino/issues/6387
|
||||||
|
--- a/cores/arduino/USBCore.cpp 2019-09-20 15:48:38.000000000 +0300
|
||||||
|
+++ b/cores/arduino/USBCore.cpp 2020-11-11 19:56:49.233690476 +0300
|
||||||
|
@@ -375,8 +375,10 @@
|
||||||
|
{
|
||||||
|
u8 i = setup.wIndex;
|
||||||
|
|
||||||
|
+#ifndef NO_SERIAL
|
||||||
|
if (CDC_ACM_INTERFACE == i)
|
||||||
|
return CDC_Setup(setup);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#ifdef PLUGGABLE_USB_ENABLED
|
||||||
|
return PluggableUSB().setup(setup);
|
||||||
|
@@ -466,7 +468,9 @@
|
||||||
|
{
|
||||||
|
u8 interfaces = 0;
|
||||||
|
|
||||||
|
+#ifndef NO_SERIAL
|
||||||
|
CDC_GetInterface(&interfaces);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#ifdef PLUGGABLE_USB_ENABLED
|
||||||
|
PluggableUSB().getInterface(&interfaces);
|
||||||
@ -102,6 +102,7 @@ extra_scripts =
|
|||||||
[_cmd_spi]
|
[_cmd_spi]
|
||||||
build_flags =
|
build_flags =
|
||||||
-DCMD_SPI
|
-DCMD_SPI
|
||||||
|
-DNO_SERIAL
|
||||||
upload_protocol = custom
|
upload_protocol = custom
|
||||||
upload_flags =
|
upload_flags =
|
||||||
-C
|
-C
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user