Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Config struct {
LocalAuthToken string `json:"local_auth_token"`
LocalAuthMode string `json:"localAuthMode"` //TODO: fix it with migration
WakeOnLanDevices []WakeOnLanDevice `json:"wake_on_lan_devices"`
EdidString string `json:"hdmi_edid_string"`
}

const configPath = "/userdata/kvm_config.json"
Expand Down
6 changes: 6 additions & 0 deletions jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ func rpcSetEDID(edid string) error {
if err != nil {
return err
}

// Save EDID to config, allowing it to be restored on reboot.
LoadConfig()
config.EdidString = edid
SaveConfig()

return nil
}

Expand Down
16 changes: 16 additions & 0 deletions native.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ func handleCtrlClient(conn net.Conn) {

ctrlSocketConn = conn

// Restore HDMI EDID if applicable
go restoreHdmiEdid()

readBuf := make([]byte, 4096)
for {
n, err := conn.Read(readBuf)
Expand Down Expand Up @@ -297,3 +300,16 @@ func ensureBinaryUpdated(destPath string) error {

return nil
}

// Restore the HDMI EDID value from the config.
// Called after successful connection to jetkvm_native.
func restoreHdmiEdid() {
LoadConfig()
if config.EdidString != "" {
logger.Infof("Restoring HDMI EDID to %v", config.EdidString)
_, err := CallCtrlAction("set_edid", map[string]interface{}{"edid": config.EdidString})
if err != nil {
logger.Errorf("Failed to restore HDMI EDID: %v", err)
}
}
}