From b9975f025a7dd3ba4fcfde03be9176618ef9aa5b Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Tue, 19 Apr 2016 00:17:10 +0200
Subject: improved audio switch port config


diff --git a/sample-config.toml b/sample-config.toml
index cdd27da..e31db07 100644
--- a/sample-config.toml
+++ b/sample-config.toml
@@ -3,10 +3,10 @@ dev = "/dev/ttyUSB0"
 baud = 19200
 timeout = "500ms"
 unit = 0
-ports = [ { name = "master_main", number = 1 },
-          { name = "master_music", number = 2 },
-          { name = "standby_main", number = 3 },
-          { name = "standby_music", number = 4 } ]
+ports = [ { server = "master", channel = "main", number = 1 },
+          { server = "master", channel = "music", number = 2 },
+          { server = "standby", channel = "main", number = 3 },
+          { server = "standby", channel = "music", number = 4 } ]
 
 [servers]
 
diff --git a/src/rhctl/audio_switch_command.go b/src/rhctl/audio_switch_command.go
index 3c67b3c..1c2e2fb 100644
--- a/src/rhctl/audio_switch_command.go
+++ b/src/rhctl/audio_switch_command.go
@@ -76,6 +76,10 @@ func (i *SwitchInputNum) FromString(str string) error {
 	return nil
 }
 
+func (i *SwitchInputNum) UnmarshalTOML(data []byte) error {
+	return i.FromString(string(data))
+}
+
 type SwitchOutputNum uint
 
 func (o SwitchOutputNum) String() string {
diff --git a/src/rhctl/conf.go b/src/rhctl/conf.go
index b6f21ca..77ab174 100644
--- a/src/rhctl/conf.go
+++ b/src/rhctl/conf.go
@@ -36,8 +36,9 @@ type Config struct {
 		Timeout  Duration     `toml:"timeout"`
 		Unit     SwitchUnitID `toml:"unit"`
 		Ports    []struct {
-			Name   string `toml:"name"`
-			Number uint   `toml:"number"`
+			Server  string         `toml:"server"`
+			Channel string         `toml:"channel"`
+			Number  SwitchInputNum `toml:"number"`
 		}
 	}
 
-- 
cgit v0.10.2