mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
添加 KVM 切换器支持
This commit is contained in:
32
configs/kvmd/kvm_input.sh
Executable file
32
configs/kvmd/kvm_input.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Written by @srepac FILENAME: input.sh
|
||||
# Input switcher script for use with KVM switches that use CTRL+CTRL+#
|
||||
# ... pass in # into the script
|
||||
#
|
||||
usage() {
|
||||
echo "usage: $0 <#> <pikvm-name-or-ip> where # is the input number on the KVM switch"
|
||||
exit 1
|
||||
}
|
||||
password=admin
|
||||
|
||||
#HOTKEY="ScrollLock"
|
||||
HOTKEY="ControlLeft"
|
||||
|
||||
if [[ "$1" == "" ]]; then
|
||||
usage
|
||||
else
|
||||
NUM="$1"
|
||||
fi
|
||||
|
||||
if [[ "$2" == "" ]]; then
|
||||
IP="localhost"
|
||||
else
|
||||
IP="$2"
|
||||
fi
|
||||
|
||||
OSD=$( echo $HOTKEY | sed -e 's/ControlLeft/CTRL/g' )
|
||||
echo "Sending $OSD + $OSD + $NUM to $IP"
|
||||
|
||||
curl -X POST -k -u admin:$password "https://$IP/api/hid/events/send_key?key=$HOTKEY" 2> /dev/null
|
||||
curl -X POST -k -u admin:$password "https://$IP/api/hid/events/send_key?key=$HOTKEY" 2> /dev/null
|
||||
curl -X POST -k -u admin:$password "https://$IP/api/hid/events/send_key?key=Digit${NUM}" 2> /dev/null
|
||||
@@ -59,6 +59,12 @@ kvmd:
|
||||
reset_press:
|
||||
type: cmd
|
||||
cmd: [/etc/kvmd/atx.sh, reset]
|
||||
input1:
|
||||
type: cmd
|
||||
cmd: [/etc/kvmd/kvm_input.sh, 1]
|
||||
input2:
|
||||
type: cmd
|
||||
cmd: [/etc/kvmd/kvm_input.sh, 2]
|
||||
scheme:
|
||||
wol_server1:
|
||||
driver: wol_server1
|
||||
@@ -80,18 +86,32 @@ kvmd:
|
||||
pin: 0
|
||||
mode: output
|
||||
switch: false
|
||||
input1-button:
|
||||
driver: input1
|
||||
pin: 0
|
||||
mode: output
|
||||
switch: false
|
||||
input2-button:
|
||||
driver: input2
|
||||
pin: 0
|
||||
mode: output
|
||||
switch: false
|
||||
view:
|
||||
header:
|
||||
title: 电源管理
|
||||
title: 高级功能
|
||||
table:
|
||||
- ["#电源管理"]
|
||||
- []
|
||||
- ["#短按(开/关机):", short_button|按下]
|
||||
- ["#长按(强制关机):", long_button|按下]
|
||||
- ["#重启:", reset_button|按下]
|
||||
- []
|
||||
- ["#网络唤醒"]
|
||||
- ["#被控机设备", wol_server1|网络唤醒]
|
||||
- []
|
||||
- ["#KVM 切换"]
|
||||
- ["#HDMI 1", input1-button|切换]
|
||||
- ["#HDMI 2", input2-button|切换]
|
||||
|
||||
|
||||
vnc:
|
||||
keymap: /usr/share/kvmd/keymaps/ru
|
||||
|
||||
Reference in New Issue
Block a user