core: update Keyboard platform to simply return error
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
af21d98074
commit
80cb23de32
|
@ -135,13 +135,13 @@ func configure() (err error) {
|
|||
}
|
||||
|
||||
// restores the TTY to the original state
|
||||
func restore() (errs []error) {
|
||||
if _, err := stty("echo"); err != nil {
|
||||
return []error{err}
|
||||
func restore() (err error) {
|
||||
if _, err = stty("echo"); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := stty(originalState); err != nil {
|
||||
return []error{err}
|
||||
if _, err = stty(originalState); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
@ -66,9 +66,9 @@ func (k *Driver) Connection() gobot.Connection { return nil }
|
|||
|
||||
// Start initializes keyboard by grabbing key events as they come in and
|
||||
// publishing a key event
|
||||
func (k *Driver) Start() (errs []error) {
|
||||
if err := k.connect(k); err != nil {
|
||||
return []error{err}
|
||||
func (k *Driver) Start() (err error) {
|
||||
if err = k.connect(k); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
go k.listen(k)
|
||||
|
@ -77,7 +77,7 @@ func (k *Driver) Start() (errs []error) {
|
|||
}
|
||||
|
||||
// Halt stops camera driver
|
||||
func (k *Driver) Halt() (errs []error) {
|
||||
func (k *Driver) Halt() (err error) {
|
||||
if originalState != "" {
|
||||
return restore()
|
||||
}
|
||||
|
|
|
@ -27,10 +27,10 @@ func TestKeyboardDriver(t *testing.T) {
|
|||
|
||||
func TestKeyboardDriverStart(t *testing.T) {
|
||||
d := initTestKeyboardDriver()
|
||||
gobottest.Assert(t, len(d.Start()), 0)
|
||||
gobottest.Assert(t, d.Start(), nil)
|
||||
}
|
||||
|
||||
func TestKeyboardDriverHalt(t *testing.T) {
|
||||
d := initTestKeyboardDriver()
|
||||
gobottest.Assert(t, len(d.Halt()), 0)
|
||||
gobottest.Assert(t, d.Halt(), nil)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue