Skip to content

software kvm 활용하기 (feat. lan-mouse, ddcutil) #108

@eubnara

Description

@eubnara

ddcutil 를 이용한 스크립트를 실행하면 사용하는 모니터를 다른 포트로 입력전환하는 예시
kde 에서 특정 단축키를 이용해 해당 스크립트를 실행하도록 했다.

Image
❯ cat ~/bin/toggle_monitor.sh 
#!/bin/bash

HDMI="0x05"
DP="0x0f"

SCRIPT_DIR=$(dirname "$0")
CUR_VCP_FILE=$SCRIPT_DIR/.cur_vcp


#cur=`ddcutil getvcp 60  | awk '{print $NF}' | sed -nE 's/\(sl=([^\)]+)\)/\1/p'`
cur=`cat $CUR_VCP_FILE`


if [[ "$cur" == "$HDMI" ]]; then
    ddcutil --noverify --sleep-multiplier 0.0001 setvcp 60 $DP
    echo $DP > $CUR_VCP_FILE
else
    ddcutil --noverify --sleep-multiplier 0.0001 setvcp 60 $HDMI
    echo $HDMI > $CUR_VCP_FILE
fi
❯ ddcutil detect
Invalid display
   I2C bus:  /dev/i2c-14
   DRM connector:           card1-eDP-1
   EDID synopsis:
      Mfg id:               CSO - California Institute of Technology
      Model:                
      Product code:         5646  (0x160e)
      Serial number:        
      Binary serial number: 0 (0x00000000)
      Manufacture year:     2021,  Week: 0
   DDC communication failed
   This is an eDP laptop display. Laptop displays do not support DDC/CI.

Display 1
   I2C bus:  /dev/i2c-16
   DRM connector:           card1-DP-2
   EDID synopsis:
      Mfg id:               SAM - Samsung Electric Company
      Model:                S34J55x
      Product code:         3952  (0x0f70)
      Serial number:        H4LT400059
      Binary serial number: 1129796676 (0x43575444)
      Manufacture year:     2022,  Week: 16
   VCP version:         2.0


~ 
❯ ddcutil capabilities
Model: Not specified
MCCS version: 2.1
VCP Features:
   Feature: 02 (New control value)
   Feature: 04 (Restore factory defaults)
   Feature: 05 (Restore factory brightness/contrast defaults)
   Feature: 08 (Restore color defaults)
   Feature: 10 (Brightness)
   Feature: 12 (Contrast)
   Feature: 14 (Select color preset)
      Values:
         05: 6500 K
         08: 9300 K
         0b: User 1
         0c: User 2
   Feature: 16 (Video gain: Red)
   Feature: 18 (Video gain: Green)
   Feature: 1A (Video gain: Blue)
   Feature: 52 (Active control)
   Feature: 60 (Input Source)
      Values:
         11: HDMI-1
         12: HDMI-2
         0f: DisplayPort-1
   Feature: AC (Horizontal frequency)
   Feature: AE (Vertical frequency)
   Feature: B2 (Flat panel sub-pixel layout)
   Feature: B6 (Display technology type)
   Feature: C6 (Application enable key)
   Feature: C8 (Display controller type)
   Feature: C9 (Display firmware level)
   Feature: D6 (Power mode)
      Values:
         01: DPM: On,  DPMS: Off
         04: DPM: Off, DPMS: Off
         05: Write only value to turn off display
   Feature: DC (Display Mode)
      Values:
         00: Standard/Default mode
         02: Mixed
         03: Movie
         05: Games
   Feature: DF (VCP Version)
   Feature: FD (Manufacturer specific feature)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions