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,127 +1,82 @@
|
||||
# KVM Switch: Mac ↔ Nobara
|
||||
|
||||
Software KVM to switch Dell U3821DW monitor and Logitech MX peripherals between Mac and 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)
|
||||
- **Keyboard:** Logitech MX Keys S
|
||||
- **Mouse:** Logitech MX Master 3S
|
||||
- **Bolt #1:** Connected directly to Nobara
|
||||
- **Bolt #2:** Connected to Dell monitor USB hub (routes to Mac via USB-C)
|
||||
- **Mouse:** Logitech MX Master 4
|
||||
- **Bolt #1:** Connected to Nobara (Channel 2)
|
||||
- **Bolt #2:** Connected to Mac via monitor USB hub (Channel 3)
|
||||
|
||||
## Channel Setup
|
||||
|
||||
| Channel | Code | Connection | Computer |
|
||||
|---------|------|------------|----------|
|
||||
| 2 | 0x01 | Bolt #1 | Nobara |
|
||||
| 3 | 0x02 | Bolt #2 (via monitor) | Mac |
|
||||
| Channel | Connection | Computer |
|
||||
|---------|------------|----------|
|
||||
| 2 | Bolt #1 | Nobara |
|
||||
| 3 | Bolt #2 | Mac |
|
||||
|
||||
## Mac Setup
|
||||
|
||||
### Prerequisites
|
||||
### Install m1ddc
|
||||
```bash
|
||||
# Install m1ddc (DDC control for Apple Silicon)
|
||||
brew install m1ddc
|
||||
|
||||
# Install hidapitester
|
||||
curl -sL https://github.com/todbot/hidapitester/releases/latest/download/hidapitester-macos-arm64.zip -o /tmp/hidapitester.zip
|
||||
unzip -o /tmp/hidapitester.zip -d ~/bin/
|
||||
chmod +x ~/bin/hidapitester
|
||||
```
|
||||
|
||||
### Install Script
|
||||
### Copy script
|
||||
```bash
|
||||
mkdir -p ~/scripts
|
||||
cp to_nobara.sh ~/scripts/
|
||||
chmod +x ~/scripts/to_nobara.sh
|
||||
```
|
||||
|
||||
### Keyboard Shortcut (Logi Options+)
|
||||
1. Logi Options+ → MX Keys S → Smart Actions
|
||||
2. Create action triggered by F12
|
||||
3. Action: Open File → ~/scripts/to_nobara.sh
|
||||
### Usage
|
||||
```bash
|
||||
~/scripts/to_nobara.sh
|
||||
# Then press Easy-Switch on keyboard/mouse to Channel 2
|
||||
```
|
||||
|
||||
## Nobara Setup
|
||||
|
||||
### Prerequisites
|
||||
### Install ddcutil
|
||||
```bash
|
||||
# Install ddcutil
|
||||
sudo dnf install -y ddcutil
|
||||
|
||||
# Add user to i2c group (REBOOT REQUIRED)
|
||||
sudo dnf install ddcutil
|
||||
sudo usermod -aG i2c $USER
|
||||
|
||||
# Install hidapitester
|
||||
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
|
||||
rm /tmp/hidapitester.zip
|
||||
|
||||
# Udev rule for non-root HID access
|
||||
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
|
||||
# Reboot required
|
||||
```
|
||||
|
||||
### Install Script
|
||||
### Copy script
|
||||
```bash
|
||||
mkdir -p ~/scripts
|
||||
cp to_mac.sh ~/scripts/
|
||||
chmod +x ~/scripts/to_mac.sh
|
||||
```
|
||||
|
||||
### Keyboard Shortcut (GNOME)
|
||||
1. Settings → Keyboard → Custom Shortcuts
|
||||
2. Add shortcut:
|
||||
- Name: KVM to Mac
|
||||
- Command: /home/USER/scripts/to_mac.sh
|
||||
- Shortcut: F12
|
||||
|
||||
## Pairing Peripherals
|
||||
|
||||
Each device must be paired to BOTH Bolt receivers:
|
||||
|
||||
### MX Master 3S / MX Keys S
|
||||
1. Press Easy-Switch button to select channel (2 for Nobara, 3 for Mac)
|
||||
2. Hold 3 seconds until LED blinks fast
|
||||
3. Use Logi Options+ (Mac) or Solaar (Linux) to complete pairing
|
||||
|
||||
### Install Solaar (Linux)
|
||||
### Set keyboard shortcut (GNOME)
|
||||
```bash
|
||||
sudo dnf install solaar
|
||||
solaar &
|
||||
# Click "Pair new device" while peripheral is blinking
|
||||
# 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 '<Shift><Control>Up'
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Monitor doesn't switch
|
||||
- Check DDC/CI is enabled: Monitor Menu → Others → DDC/CI → On
|
||||
- Mac: Ensure USB-C cable supports data (not video-only)
|
||||
- Linux: Ensure user is in i2c group and rebooted
|
||||
|
||||
### Peripherals don't switch
|
||||
- Verify devices are paired to both Bolt receivers
|
||||
- Check device indices with: `solaar show` (Linux)
|
||||
- Device indices (0x01, 0x02) depend on pairing order
|
||||
|
||||
### Find correct device indices
|
||||
### Usage
|
||||
```bash
|
||||
# On Linux with solaar
|
||||
solaar show
|
||||
|
||||
# Or query via HID++
|
||||
hidapitester --vidpid 046d/c548 --list-detail
|
||||
~/scripts/to_mac.sh
|
||||
# Then press Easy-Switch on keyboard/mouse to Channel 3
|
||||
```
|
||||
|
||||
## DDC Input Codes (Dell U3821DW)
|
||||
|
||||
| Input | Code |
|
||||
|-------|------|
|
||||
| HDMI 1 | 17 |
|
||||
| HDMI 2 | 18 |
|
||||
| USB-C | 27 |
|
||||
| DP 1 | 15 |
|
||||
| DP 2 | 16 |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Monitor doesn't switch
|
||||
- Enable DDC/CI: Monitor Menu → Others → DDC/CI → On
|
||||
- Linux: Ensure user in i2c group, reboot after adding
|
||||
|
||||
@@ -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!"
|
||||
|
||||
@@ -1,42 +1,8 @@
|
||||
#!/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"
|
||||
# Switches monitor to HDMI 2
|
||||
# Peripherals: manually press Easy-Switch to Channel 2
|
||||
|
||||
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!"
|
||||
m1ddc set input 18 2>/dev/null && echo "Done! Press Easy-Switch for Channel 2" || echo "Monitor switch failed"
|
||||
|
||||
Reference in New Issue
Block a user