#!/bin/bash # KVM Switch: Mac → Nobara # STATUS: NEEDS WORK - HID++ feature indices need to be discovered on Mac # # Host mapping (0-indexed in HID++): # Host 2 (0x01): Nobara (xtrm-pc) # Host 3 (0x02): Mac (Kaloyan's MacBook Air) # # TODO: Find correct HID++ feature indices on Mac's Bolt receiver # The feature indices discovered on Nobara were: # Mouse (device 0x03): feature 0x0E # Keyboard (device 0x02): feature 0x0A # These may differ on Mac - need to verify with hidapitester or similar tool HIDAPITESTER="$HOME/bin/hidapitester" echo "Switching to Nobara..." # 1. Switch Monitor to HDMI 2 (Dell U3821DW input code: 18) echo " Monitor -> HDMI 2..." if command -v m1ddc &>/dev/null; then m1ddc set input 18 2>/dev/null || \ echo " [WARN] Monitor switch failed (DDC/CI disabled or not connected via USB-C)" else echo " [WARN] m1ddc not installed: brew install m1ddc" fi # 2. Switch Mouse (MX Master 4) to Host 2 (Nobara) # TODO: Verify device index and feature index on Mac echo " Mouse -> Nobara..." "$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \ --open --length 7 --send-output 0x10,0x03,0x0E,0x10,0x01,0x00,0x00 2>/dev/null || \ echo " [WARN] Mouse switch failed" # 3. Switch Keyboard (MX Keys S) to Host 2 (Nobara) # TODO: Verify device index and feature index on Mac echo " Keyboard -> Nobara..." "$HIDAPITESTER" --vidpid 046d/c548 --usage 0x0001 --usagePage 0xff00 \ --open --length 7 --send-output 0x10,0x02,0x0A,0x10,0x01,0x00,0x00 2>/dev/null || \ echo " [WARN] Keyboard switch failed" echo "Done!"