mirror of
https://github.com/kidoman/embd
synced 2024-12-22 12:50:19 +01:00
gpio: don't fail if pin is already exported
This commit is contained in:
parent
938a071c1a
commit
091d6f5588
@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
@ -69,6 +70,9 @@ func (p *digitalPin) export() error {
|
||||
}
|
||||
defer exporter.Close()
|
||||
_, err = exporter.WriteString(strconv.Itoa(p.n))
|
||||
if e, ok := err.(*os.PathError); ok && e.Err == syscall.EBUSY {
|
||||
return nil // EBUSY -> the pin has already been exported
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user