mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 01:51:53 +08:00
Add support for PiKVM Switch and related features
This commit introduces several new components and improvements: - Added Switch module with firmware update and configuration support - Implemented new media streaming capabilities - Updated various UI elements and CSS styles - Enhanced keyboard and mouse event handling - Added new validators and configuration options - Updated Python version support to 3.13 - Improved error handling and logging
This commit is contained in:
@@ -20,13 +20,12 @@
|
||||
# ========================================================================== #
|
||||
|
||||
|
||||
import os
|
||||
import errno
|
||||
import argparse
|
||||
|
||||
from ...validators.basic import valid_bool
|
||||
from ...validators.basic import valid_int_f0
|
||||
from ...validators.os import valid_abs_file
|
||||
from ...validators.os import valid_abs_path
|
||||
|
||||
from ... import usb
|
||||
|
||||
@@ -72,10 +71,10 @@ def main(argv: (list[str] | None)=None) -> None:
|
||||
parser.add_argument("-i", "--instance", default=0, type=valid_int_f0,
|
||||
metavar="<N>", help="Drive instance (0 for KVMD drive)")
|
||||
parser.add_argument("--set-cdrom", default=None, type=valid_bool,
|
||||
metavar="<1|0|yes|no>", help="Set CD-ROM flag")
|
||||
metavar="<1|0|yes|no>", help="Set CD/DVD flag")
|
||||
parser.add_argument("--set-rw", default=None, type=valid_bool,
|
||||
metavar="<1|0|yes|no>", help="Set RW flag")
|
||||
parser.add_argument("--set-image", default=None, type=valid_abs_file,
|
||||
parser.add_argument("--set-image", default=None, type=valid_abs_path,
|
||||
metavar="<path>", help="Set the image file")
|
||||
parser.add_argument("--eject", action="store_true",
|
||||
help="Eject the image")
|
||||
@@ -103,10 +102,10 @@ def main(argv: (list[str] | None)=None) -> None:
|
||||
set_param("ro", str(int(not options.set_rw)))
|
||||
|
||||
if options.set_image:
|
||||
if not os.path.isfile(options.set_image):
|
||||
raise SystemExit(f"Not a file: {options.set_image}")
|
||||
# if not os.path.isfile(options.set_image):
|
||||
# raise SystemExit(f"Not a file: {options.set_image}")
|
||||
set_param("file", options.set_image)
|
||||
|
||||
print("Image file: ", (get_param("file") or "<none>"))
|
||||
print("CD-ROM flag:", ("yes" if int(get_param("cdrom")) else "no"))
|
||||
print("CD/DVD flag:", ("yes" if int(get_param("cdrom")) else "no"))
|
||||
print("RW flag: ", ("no" if int(get_param("ro")) else "yes"))
|
||||
|
||||
Reference in New Issue
Block a user