Jump to content

orangePi5plus Unable to use wiringOP


Allen

Recommended Posts

Armbian 23.08.0-trunk Bookworm with Linux 5.10.160-rk35xx

 

root@orangepi5-plus:~# gpio -v
gpio version: 2.46
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

  * Device tree is enabled.
  *--> Orange Pi 5 Plus
root@orangepi5-plus:~# gpio readall
wiringPiSetup: mmap (GPIO) failed: Operation not permitted

 

Link to comment
Share on other sites

Hello!
I also have this issue!
I believe it's a kernel flag to allow read/write of dev/mem
Anyway of changing that without compiling a custom kernel?

Strace log

root@orangepi5-plus:~# strace gpio readall
execve("/usr/local/bin/gpio", ["gpio", "readall"], 0xffffd664ff88 /* 21 vars */) = 0
brk(NULL)                               = 0xaaaac110a000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff8f698000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=99325, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 99325, PROT_READ, MAP_PRIVATE, 3, 0) = 0xffff8f64b000
close(3)                                = 0
openat(AT_FDCWD, "/usr/local/lib/libwiringPi.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=154496, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 266552, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff8f609000
mmap(0xffff8f610000, 201016, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xffff8f610000
munmap(0xffff8f609000, 28672)           = 0
munmap(0xffff8f642000, 33080)           = 0
mprotect(0xffff8f627000, 61440, PROT_NONE) = 0
mmap(0xffff8f636000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0xffff8f636000
mmap(0xffff8f640000, 4408, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffff8f640000
close(3)                                = 0
openat(AT_FDCWD, "/usr/local/lib/libwiringPiDev.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=37016, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 167040, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff8f5e7000
mmap(0xffff8f5f0000, 101504, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xffff8f5f0000
munmap(0xffff8f5e7000, 36864)           = 0
munmap(0xffff8f609000, 27776)           = 0
mprotect(0xffff8f5f6000, 61440, PROT_NONE) = 0
mmap(0xffff8f605000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0xffff8f605000
mmap(0xffff8f607000, 7296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffff8f607000
close(3)                                = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\340u\2\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=1641496, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 1810024, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff8f436000
mmap(0xffff8f440000, 1744488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xffff8f440000
munmap(0xffff8f436000, 40960)           = 0
munmap(0xffff8f5ea000, 24168)           = 0
mprotect(0xffff8f5c9000, 61440, PROT_NONE) = 0
mmap(0xffff8f5d8000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x188000) = 0xffff8f5d8000
mmap(0xffff8f5de000, 48744, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffff8f5de000
close(3)                                = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=551064, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 680048, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff8f399000
mmap(0xffff8f3a0000, 614512, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xffff8f3a0000
munmap(0xffff8f399000, 28672)           = 0
munmap(0xffff8f437000, 32880)           = 0
mprotect(0xffff8f426000, 61440, PROT_NONE) = 0
mmap(0xffff8f435000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x85000) = 0xffff8f435000
close(3)                                = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\20\25\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=186296, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 348512, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff8f34a000
mmap(0xffff8f350000, 282976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xffff8f350000
munmap(0xffff8f34a000, 24576)           = 0
munmap(0xffff8f396000, 37216)           = 0
mprotect(0xffff8f37d000, 61440, PROT_NONE) = 0
mmap(0xffff8f38c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2c000) = 0xffff8f38c000
mmap(0xffff8f38e000, 29024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffff8f38e000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff8f696000
set_tid_address(0xffff8f696b10)         = 11233
set_robust_list(0xffff8f696b20, 24)     = 0
rseq(0xffff8f6971e0, 0x20, 0, 0xd428bc00) = 0
mprotect(0xffff8f5d8000, 16384, PROT_READ) = 0
mprotect(0xffff8f38c000, 4096, PROT_READ) = 0
mprotect(0xffff8f435000, 4096, PROT_READ) = 0
mprotect(0xffff8f605000, 4096, PROT_READ) = 0
mprotect(0xffff8f636000, 4096, PROT_READ) = 0
mprotect(0xaaaaab06d000, 4096, PROT_READ) = 0
mprotect(0xffff8f69d000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0xffff8f64b000, 99325)           = 0
geteuid()                               = 0
getrandom("\x97\x05\x6a\x79\xe5\x03\x78\xac", 8, GRND_NONBLOCK) = 8
brk(NULL)                               = 0xaaaac110a000
brk(0xaaaac112b000)                     = 0xaaaac112b000
openat(AT_FDCWD, "/etc/orangepi-release", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/armbian-release", O_RDONLY) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=464, ...}, AT_EMPTY_PATH) = 0
read(3, "# PLEASE DO NOT EDIT THIS FILE\nB"..., 4096) = 464
close(3)                                = 0
openat(AT_FDCWD, "/dev/mem", O_RDWR|O_SYNC|O_CLOEXEC) = 3  #ERROS HERE -dan
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0x300b000) = -1 EPERM (Operation not permitted)
write(2, "wiringPiSetup: mmap (GPIO) faile"..., 59wiringPiSetup: mmap (GPIO) failed: Operation not permitted
) = 59
exit_group(1)                           = ?
+++ exited with 1 +++

 

Link to comment
Share on other sites

I've just compiled a new kernel with almost the default config, the things I've changed have nothing to do with access to the GPIO pins and I've never seen these errors. What have you tried? Did you install the right branch of Wiringpi? 

 

git clone https://github.com/orangepi-xunlong/wiringOP.git --branch next

cd wiringOP
./build clean
./build 

 

Then just run "GPIO read all"

Works here without root, perhaps the default user groups have been changed? But first see if this works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines