From 546adad373c5d5ee9bab47d6a87928c47dd8a19f Mon Sep 17 00:00:00 2001 From: XTRM-Unraid Date: Sun, 1 Feb 2026 18:31:49 +0200 Subject: [PATCH] Restore HID++ for Nobara->Mac, keep Mac->Nobara monitor-only --- scripts/kvm/README.md | 88 ++++++++++++++++++++++++------------------- scripts/kvm/to_mac.sh | 34 +++++++++++++++-- 2 files changed, 79 insertions(+), 43 deletions(-) diff --git a/scripts/kvm/README.md b/scripts/kvm/README.md index f8ceefd..8daf36a 100644 --- a/scripts/kvm/README.md +++ b/scripts/kvm/README.md @@ -1,7 +1,5 @@ # KVM Switch: Mac ↔ Nobara -Simple monitor switching via DDC/CI. Peripherals switched manually via Easy-Switch button. - ## Hardware - **Monitor:** Dell U3821DW (USB-C to Mac, HDMI 2 to Nobara) @@ -10,6 +8,13 @@ Simple monitor switching via DDC/CI. Peripherals switched manually via Easy-Swit - **Bolt #1:** Connected to Nobara (Channel 2) - **Bolt #2:** Connected to Mac via monitor USB hub (Channel 3) +## Switching Behavior + +| Direction | Monitor | Peripherals | +|-----------|---------|-------------| +| Nobara → Mac | Auto (DDC) | Auto (HID++) | +| Mac → Nobara | Auto (DDC) | Manual Easy-Switch | + ## Channel Setup | Channel | Connection | Computer | @@ -17,66 +22,71 @@ Simple monitor switching via DDC/CI. Peripherals switched manually via Easy-Swit | 2 | Bolt #1 | Nobara | | 3 | Bolt #2 | Mac | -## Mac Setup - -### Install m1ddc -```bash -brew install m1ddc -``` - -### Copy script -```bash -mkdir -p ~/scripts -cp to_nobara.sh ~/scripts/ -chmod +x ~/scripts/to_nobara.sh -``` - -### Usage -```bash -~/scripts/to_nobara.sh -# Then press Easy-Switch on keyboard/mouse to Channel 2 -``` +--- ## Nobara Setup -### Install ddcutil +### 1. Install dependencies ```bash sudo dnf install ddcutil sudo usermod -aG i2c $USER -# Reboot required +# Reboot required for i2c group ``` -### Copy script +### 2. Install hidapitester +```bash +mkdir -p ~/bin +curl -sL https://github.com/todbot/hidapitester/releases/latest/download/hidapitester-linux-amd64.zip -o /tmp/hidapitester.zip +unzip -o /tmp/hidapitester.zip -d ~/bin/ +chmod +x ~/bin/hidapitester +``` + +### 3. Udev rule for Bolt +```bash +echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c548", MODE="0666"' | sudo tee /etc/udev/rules.d/99-logitech-bolt.rules +sudo udevadm control --reload-rules && sudo udevadm trigger +``` + +### 4. Copy script ```bash mkdir -p ~/scripts cp to_mac.sh ~/scripts/ chmod +x ~/scripts/to_mac.sh ``` -### Set keyboard shortcut (GNOME) +### 5. Keyboard shortcut (Ctrl+Shift+Up) +Settings → Keyboard → Custom Shortcuts: +- Name: KVM to Mac +- Command: /home/USER/scripts/to_mac.sh +- Shortcut: Ctrl+Shift+Up + +--- + +## Mac Setup + +### 1. Install m1ddc ```bash -# Add custom shortcut for Ctrl+Shift+Up -gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/kvm/']" -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/kvm/ name 'KVM to Mac' -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/kvm/ command '/home/$USER/scripts/to_mac.sh' -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/kvm/ binding 'Up' +brew install m1ddc ``` -### Usage +### 2. Copy script ```bash -~/scripts/to_mac.sh -# Then press Easy-Switch on keyboard/mouse to Channel 3 +mkdir -p ~/scripts +cp to_nobara.sh ~/scripts/ +chmod +x ~/scripts/to_nobara.sh ``` +### 3. Usage +```bash +~/scripts/to_nobara.sh +# Then press Easy-Switch on keyboard/mouse to Channel 2 +``` + +--- + ## DDC Input Codes (Dell U3821DW) | Input | Code | |-------|------| | HDMI 2 | 18 | | USB-C | 27 | - -## Troubleshooting - -### Monitor doesn't switch -- Enable DDC/CI: Monitor Menu → Others → DDC/CI → On -- Linux: Ensure user in i2c group, reboot after adding diff --git a/scripts/kvm/to_mac.sh b/scripts/kvm/to_mac.sh index de5e094..bc514d1 100755 --- a/scripts/kvm/to_mac.sh +++ b/scripts/kvm/to_mac.sh @@ -1,12 +1,38 @@ #!/bin/bash # KVM Switch: Nobara → Mac -# Switches monitor to USB-C -# Peripherals: manually press Easy-Switch to Channel 3 +# Switches monitor to USB-C and peripherals to Host 3 (Mac) +# +# Device mapping: +# Keyboard: device 0x02, feature 0x0A +# Mouse: device 0x03, feature 0x0E +# +# Host mapping: +# Host 2 (0x01): Nobara +# Host 3 (0x02): Mac + +HIDAPITESTER="$HOME/bin/hidapitester" echo "Switching to Mac..." + +# 1. Switch Mouse 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 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 echo " Monitor -> USB-C..." if command -v ddcutil &>/dev/null; then - ddcutil setvcp 60 27 2>/dev/null && echo "Done! Press Easy-Switch for Channel 3" || echo "Monitor switch failed" + ddcutil setvcp 60 27 2>/dev/null || \ + echo " [WARN] Monitor switch failed" else - echo "ddcutil not installed: sudo dnf install ddcutil" + echo " [WARN] ddcutil not installed" fi + +echo "Done!"