Simplify KVM scripts - monitor only, manual peripheral switch
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -1,39 +1,12 @@
|
||||
#!/bin/bash
|
||||
# KVM Switch: Nobara → Mac
|
||||
# Switches monitor to USB-C and peripherals to Host 3 (Mac)
|
||||
#
|
||||
# Host mapping (0-indexed in HID++):
|
||||
# Host 1 (0x01): Nobara (xtrm-pc)
|
||||
# Host 3 (0x02): Mac (Kaloyan's MacBook Air)
|
||||
#
|
||||
# HID++ command format: ReportID, DeviceIdx, FeatureIdx, Function, HostIdx, 0, 0
|
||||
# Mouse: device 0x03, feature 0x0E (CHANGE_HOST)
|
||||
# Keyboard: device 0x02, feature 0x0A (CHANGE_HOST)
|
||||
# Function 0x10 = setCurrentHost (function 0 << 4)
|
||||
|
||||
HIDAPITESTER="$HOME/bin/hidapitester"
|
||||
# Switches monitor to USB-C
|
||||
# Peripherals: manually press Easy-Switch to Channel 3
|
||||
|
||||
echo "Switching to Mac..."
|
||||
|
||||
# 1. Switch Mouse (MX Master 4) to Host 3 (Mac)
|
||||
echo " Mouse -> Mac..."
|
||||
"$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \
|
||||
--open --length 7 --send-output 0x10,0x03,0x0E,0x10,0x02,0x00,0x00 2>/dev/null || \
|
||||
echo " [WARN] Mouse switch failed"
|
||||
|
||||
# 2. Switch Keyboard (MX Keys S) to Host 3 (Mac)
|
||||
echo " Keyboard -> Mac..."
|
||||
"$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \
|
||||
--open --length 7 --send-output 0x10,0x02,0x0A,0x10,0x02,0x00,0x00 2>/dev/null || \
|
||||
echo " [WARN] Keyboard switch failed"
|
||||
|
||||
# 3. Switch Monitor to USB-C (Dell U3821DW input code: 27)
|
||||
echo " Monitor -> USB-C..."
|
||||
if command -v ddcutil &>/dev/null; then
|
||||
ddcutil setvcp 60 27 2>/dev/null || \
|
||||
echo " [WARN] Monitor switch failed (DDC/CI disabled or permissions issue)"
|
||||
ddcutil setvcp 60 27 2>/dev/null && echo "Done! Press Easy-Switch for Channel 3" || echo "Monitor switch failed"
|
||||
else
|
||||
echo " [WARN] ddcutil not installed"
|
||||
echo "ddcutil not installed: sudo dnf install ddcutil"
|
||||
fi
|
||||
|
||||
echo "Done!"
|
||||
|
||||
Reference in New Issue
Block a user