periph / devices

Go·Hardware·Lean - Device drivers
https://periph.io
Apache License 2.0
83 stars 37 forks source link

LIRC requires line break for SEND_ONCE #56

Closed emulatorchen closed 1 year ago

emulatorchen commented 1 year ago

Describe the bug Dunno since when but lirc requires a linebreak for SEND_ONCE or It will throw bad send packet error You can refer the source code https://github.com/aldebaran/lirc/blob/master/daemons/lircd.c#L774

To Reproduce Steps to reproduce the behavior:

  1. Run program
    
    package main

import ( "periph.io/x/host/v3" )

func main() { irConn, err := lirc.New() err = irConn.Emit("RemoteConfiguredInLIRC", ir.Key("CommandConfiguredInLIRC")) }


2. Run it.
3. See error
Check syslog and find 
`bad send packet`
Or no command was logged as triggered in syslog

**Expected behavior**
The SEND_ONCE should be triggered and there should have no error like "bad send packet"

**Platform (please complete the following information):**
 - OS: Ubuntu 20.04
 - Board Raspberry Pi 4

**Additional context**
Confirmed that change the line lirc.go:67 from 
`_, err := fmt.Fprintf(c.w, "SEND_ONCE %s %s", remote, key)`
to
`_, err := fmt.Fprintf(c.w, "SEND_ONCE %s %s\n", remote, key)`
will work