From 6ea7dcc05f724f175ccea69d8cb095d405d41dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drahoslav=20Bedn=C3=A1=C5=99?= Date: Thu, 19 Aug 2021 02:37:13 +0200 Subject: [PATCH] Fixes permission error Closes #70 --- rpio.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpio.go b/rpio.go index ea3962b..3ff8997 100644 --- a/rpio.go +++ b/rpio.go @@ -705,9 +705,9 @@ func Open() (err error) { var file *os.File // 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) - 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 { return