diff options
Diffstat (limited to 'src/rhctl/audio_switch.go')
-rw-r--r-- | src/rhctl/audio_switch.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rhctl/audio_switch.go b/src/rhctl/audio_switch.go index f8c1cb1..27449cf 100644 --- a/src/rhctl/audio_switch.go +++ b/src/rhctl/audio_switch.go @@ -25,6 +25,8 @@ import ( "fmt" "strings" "time" + + "code.helsinki.at/goserial" ) type SwitchResult uint8 @@ -106,7 +108,7 @@ type SwitchState struct { } type AudioSwitch struct { - port *SerialPort + port *goserial.Port timeout time.Duration Inputs ConfigSwitchInputs current *SwitchCommand @@ -342,7 +344,7 @@ func (sw *AudioSwitch) Run() { } sw.current = nil sw.timer = nil - case data := <-sw.port.rx: + case data := <-sw.port.RX: sw.handleData(data) } } else { @@ -358,10 +360,10 @@ func (sw *AudioSwitch) Run() { } else { rhdl.Printf("sending '%s' to switch", c) sw.current = cmd - sw.port.tx <- c + sw.port.TX <- c sw.timer = time.NewTimer(sw.timeout) } - case data := <-sw.port.rx: + case data := <-sw.port.RX: sw.handleData(data) } } @@ -380,7 +382,7 @@ func SwitchInit(conf *Config) (sw *AudioSwitch, err error) { sw.Commands = make(chan *SwitchCommand, 16) sw.Updates = make(chan SwitchUpdate, 32) - if sw.port, err = SerialOpen(conf.Audioswitch.Device, conf.Audioswitch.Baudrate, ""); err != nil { + if sw.port, err = goserial.Open(conf.Audioswitch.Device, conf.Audioswitch.Baudrate, ""); err != nil { err = fmt.Errorf("Audioswitch: error opening serial port: %s", err) return } |