mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
revision-specific
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
|
# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
|
||||||
# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
|
# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
|
||||||
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", KERNELS=="1-1.5:1.0", ATTR{index}=="0", GROUP="kvmd", SYMLINK+="kvmd-video"
|
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", PROGRAM="/usr/bin/kvmd-udev-hdmiusb-check rpi2 %b", ATTR{index}=="0", GROUP="kvmd", SYMLINK+="kvmd-video"
|
||||||
KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
|
KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
|
# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
|
||||||
# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
|
# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
|
||||||
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", KERNELS=="1-1.2:1.0", ATTR{index}=="0", GROUP="kvmd", SYMLINK+="kvmd-video"
|
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", PROGRAM="/usr/bin/kvmd-udev-hdmiusb-check rpi3 %b", ATTR{index}=="0", GROUP="kvmd", SYMLINK+="kvmd-video"
|
||||||
KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
|
KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
|
# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
|
||||||
# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
|
# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
|
||||||
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", KERNELS=="1-1.4:1.0", ATTR{index}=="0", GROUP="kvmd", SYMLINK+="kvmd-video"
|
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", PROGRAM="/usr/bin/kvmd-udev-hdmiusb-check rpi4 %b", ATTR{index}=="0", GROUP="kvmd", SYMLINK+="kvmd-video"
|
||||||
KERNEL=="hidg0", GROUP="kvmd", SYMLINK+="kvmd-hid-keyboard"
|
KERNEL=="hidg0", GROUP="kvmd", SYMLINK+="kvmd-hid-keyboard"
|
||||||
KERNEL=="hidg1", GROUP="kvmd", SYMLINK+="kvmd-hid-mouse"
|
KERNEL=="hidg1", GROUP="kvmd", SYMLINK+="kvmd-hid-mouse"
|
||||||
|
|||||||
56
scripts/kvmd-udev-hdmiusb-check
Executable file
56
scripts/kvmd-udev-hdmiusb-check
Executable file
@@ -0,0 +1,56 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ========================================================================== #
|
||||||
|
# #
|
||||||
|
# KVMD - The main Pi-KVM daemon. #
|
||||||
|
# #
|
||||||
|
# Copyright (C) 2018 Maxim Devaev <mdevaev@gmail.com> #
|
||||||
|
# #
|
||||||
|
# This program is free software: you can redistribute it and/or modify #
|
||||||
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or #
|
||||||
|
# (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, #
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
# GNU General Public License for more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License #
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||||
|
# #
|
||||||
|
# ========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# udevadm info -a -p $(udevadm info -q path -n /dev/video0)
|
||||||
|
|
||||||
|
board="$1"
|
||||||
|
port="$2"
|
||||||
|
|
||||||
|
# https://gist.github.com/mdevaev/6eb65be689142e5ac16da7542f50830f
|
||||||
|
model="`tr < /proc/device-tree/model -d '\000'`"
|
||||||
|
|
||||||
|
case "$board" in
|
||||||
|
"rpi2")
|
||||||
|
case "$model" in
|
||||||
|
"Raspberry Pi 2 Model B Rev 1.1")
|
||||||
|
if [ "$port" == "1-1.5:1.0" ]; then exit 0; else exit 1; fi;;
|
||||||
|
*) exit 0;;
|
||||||
|
esac;;
|
||||||
|
"rpi3")
|
||||||
|
case "$model" in
|
||||||
|
"Raspberry Pi 3 Model B Rev 1.2")
|
||||||
|
if [ "$port" == "1-1.5:1.0" ]; then exit 0; else exit 1; fi;;
|
||||||
|
"Raspberry Pi 3 Model B Plus Rev 1.3")
|
||||||
|
if [ "$port" == "1-1.2:1.0" ]; then exit 0; else exit 1; fi;;
|
||||||
|
*) exit 0;;
|
||||||
|
esac;;
|
||||||
|
"rpi4")
|
||||||
|
case "$model" in
|
||||||
|
"Raspberry Pi 4 Model B Rev 1.1")
|
||||||
|
if [ "$port" == "1-1.4:1.0" ]; then exit 0; else exit 1; fi;;
|
||||||
|
*) exit 0;;
|
||||||
|
esac;;
|
||||||
|
*) exit 1;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user