mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-24 13:48:49 +08:00
sysfs: pause briefly to allow udev rules to apply when exporting PWMPin
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
298b175108
commit
1dc8de699c
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PWMPin is the interface for sysfs PWM interactions
|
||||
@ -65,6 +66,11 @@ func (p *PWMPin) Export() error {
|
||||
}
|
||||
}
|
||||
|
||||
// Pause to avoid race condition in case there is any udev rule
|
||||
// that changes file permissions on newly exported PWMPin. This
|
||||
// is a common circumstance when running as a non-root user.
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user