mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-23 10:41:03 +01:00
parent
6d1cac1060
commit
6ea7dcc05f
4
rpio.go
4
rpio.go
|
@ -705,9 +705,9 @@ func Open() (err error) {
|
||||||
var file *os.File
|
var file *os.File
|
||||||
|
|
||||||
// Open fd for rw mem access; try dev/mem first (need root)
|
// Open fd for rw mem access; try dev/mem first (need root)
|
||||||
file, err = os.OpenFile("/dev/mem", os.O_RDWR|os.O_SYNC, 0)
|
file, err = os.OpenFile("/dev/mem", os.O_RDWR|os.O_SYNC, os.ModePerm)
|
||||||
if os.IsPermission(err) { // try gpiomem otherwise (some extra functions like clock and pwm setting wont work)
|
if os.IsPermission(err) { // try gpiomem otherwise (some extra functions like clock and pwm setting wont work)
|
||||||
file, err = os.OpenFile("/dev/gpiomem", os.O_RDWR|os.O_SYNC, 0)
|
file, err = os.OpenFile("/dev/gpiomem", os.O_RDWR|os.O_SYNC, os.ModePerm)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user