Files
infrastructure/scripts/kvm/to_mac.sh
XTRM-Unraid 2d67ba5cb5
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add KVM scripts for Mac/Nobara switching
- to_mac.sh: Switch from Nobara to Mac (monitor USB-C, peripherals Ch3)
- to_nobara.sh: Switch from Mac to Nobara (monitor HDMI2, peripherals Ch2)
- README.md: Setup instructions for both machines

Uses DDC/CI for monitor and HID++ for Logitech Bolt peripherals.
2026-02-01 11:46:24 +02:00

40 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# KVM Switch: Nobara → Mac
# Switches monitor to USB-C and peripherals to Channel 3 (Mac Bolt via monitor hub)
#
# Channel setup:
# Channel 2 (0x01): Bolt #1 → Nobara
# Channel 3 (0x02): Bolt #2 → Mac (via monitor USB hub)
set -e
HIDAPITESTER="$HOME/bin/hidapitester"
[ -x "$HIDAPITESTER" ] || HIDAPITESTER="/usr/local/bin/hidapitester"
echo "Switching to Mac..."
# 1. 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)"
else
echo " [WARN] ddcutil not installed: sudo dnf install ddcutil"
fi
# 2. Switch Mouse (MX Master 3S) to Channel 3 (Mac Bolt)
# Device index 0x01 - adjust if mouse was paired in different order
echo " Mouse -> Channel 3..."
"$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \
--open --length 7 --send-output 0x10,0x01,0x09,0x1b,0x02,0x00,0x00 2>/dev/null || \
echo " [WARN] Mouse switch failed"
# 3. Switch Keyboard (MX Keys S) to Channel 3 (Mac Bolt)
# Device index 0x02 - adjust if keyboard was paired in different order
echo " Keyboard -> Channel 3..."
"$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \
--open --length 7 --send-output 0x10,0x02,0x09,0x1b,0x02,0x00,0x00 2>/dev/null || \
echo " [WARN] Keyboard switch failed"
echo "Done!"