libgpiod
armbian linux를 사용하여 GPIO 이벤트를 모니터링 하려고 합니다 . ~에 따르면내 장치의 핀아웃(BananaPI Zero M2 /w H3 allwinner 칩)CON2-P18
테스트할 수 있도록 펄스 버튼에 핀을 걸어 놓았습니다 . 먼저 핀이 있는 라인을 찾아야 합니다.
# gpiofind "CON2-P18"
gpiochip0 68
그런 다음 모니터링하려고 시도하지만 gpiomon
운이 좋지 않습니다.
# gpiomon --rising-edge 0 68
gpiomon: error waiting for events: No such device
gpioget
하지만 유틸리티가 이를 인식하고 버튼 이벤트에서 제대로 실행된다는 것을 확인할 수 있습니다 .
# gpioget --bias=pull-down 0 68
0
root@bananapim2zero:~# gpioget --bias=pull-down 0 68
1
root@bananapim2zero:~# gpioget --bias=pull-down 0 68
0
유틸리티를 사용하여 설정할 수도 있습니다 gpioset
.
# gpioset -B pull-down gpiochip0 68=0
동일한 모니터링 프로세스를 확인했는데 CON2-P16
모든 것이 잘 작동합니다! 핀을 모니터링하려고 하면 동일한 오류와 동작이 발생합니다 CON2-P18
.
위의 핀/라인을 사용하여 PCB를 이미 설계하고 구축했기 때문에 단순히 다른 핀을 사용하는 것은 약간 번거롭습니다. gpiomon
무한 루프 대신 유틸리티를 사용하고 싶습니다 gpioget
.
내가 뭔가 잘못했거나 lib에 문제가 있습니까?
libgpiod v. 1.6.2-1
# uname -a
Linux bananapim2zero 6.1.11-sunxi #23.02.2 SMP Sat Feb 18 05:52:53 UTC 2023 armv7l GNU/Linux
감사해요!
편집하다:
strace
"오류" 명령 제공 $ strace sudo gpiomon --bias=pull-down --rising-edge gpiochip0 68
::
execve("/usr/bin/sudo", ["sudo", "gpiomon", "--bias=pull-down", "--rising-edge", "gpiochip0", "68"], 0xbed32684 /* 24 vars */) = 0
access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
brk(NULL) = 0x192b000
fcntl64(0, F_GETFD) = 0
fcntl64(1, F_GETFD) = 0
fcntl64(2, F_GETFD) = 0
access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fd6000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/v7l/neon/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls/v7l/neon/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/v7l/neon/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls/v7l/neon", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/v7l/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls/v7l/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/v7l/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls/v7l", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/neon/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls/neon/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/neon/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls/neon", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/tls/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/tls", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/v7l/neon/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/v7l/neon/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/v7l/neon/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/v7l/neon", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/v7l/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/v7l/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/v7l/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/v7l", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/neon/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/neon/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/neon/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/neon", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/vfp/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo/vfp", 0xbea15a10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/sudo/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sudo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=24663, ...}) = 0
mmap2(NULL, 24663, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6fcf000
close(3) = 0
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libaudit.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\364\"\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=107848, ...}) = 0
mmap2(NULL, 237700, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f74000
mprotect(0xb6f8d000, 65536, PROT_NONE) = 0
mmap2(0xb6f9d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0xb6f9d000
mmap2(0xb6f9f000, 61572, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f9f000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/sudo/libselinux.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libselinux.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0@R\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=108036, ...}) = 0
mmap2(NULL, 179236, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f48000
mprotect(0xb6f61000, 65536, PROT_NONE) = 0
mmap2(0xb6f71000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0xb6f71000
mmap2(0xb6f73000, 3108, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f73000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/sudo/libutil.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libutil.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\200\n\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=9800, ...}) = 0
mmap2(NULL, 73908, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f35000
mprotect(0xb6f37000, 61440, PROT_NONE) = 0
mmap2(0xb6f46000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0xb6f46000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/sudo/libsudo_util.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\320=\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=79628, ...}) = 0
mmap2(NULL, 145056, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f11000
mprotect(0xb6f24000, 61440, PROT_NONE) = 0
mmap2(0xb6f33000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0xb6f33000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/sudo/libpthread.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libpthread.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\25K\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=113596, ...}) = 0
mmap2(NULL, 152152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6eeb000
mprotect(0xb6efe000, 61440, PROT_NONE) = 0
mmap2(0xb6f0d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0xb6f0d000
mmap2(0xb6f0f000, 4696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f0f000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/sudo/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\331v\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=971712, ...}) = 0
mmap2(NULL, 1040988, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6dec000
mprotect(0xb6ed6000, 61440, PROT_NONE) = 0
mmap2(0xb6ee5000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe9000) = 0xb6ee5000
mmap2(0xb6ee8000, 8796, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6ee8000
close(3) = 0
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libcap-ng.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0H\16\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=13860, ...}) = 0
mmap2(NULL, 78068, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6dd8000
mprotect(0xb6ddb000, 61440, PROT_NONE) = 0
mmap2(0xb6dea000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0xb6dea000
close(3) = 0
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libpcre2-8.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250\31\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=415588, ...}) = 0
mmap2(NULL, 479836, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6d62000
mprotect(0xb6dc7000, 61440, PROT_NONE) = 0
mmap2(0xb6dd6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x64000) = 0xb6dd6000
close(3) = 0
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libdl.so.2", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0000\n\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=9772, ...}) = 0
mmap2(NULL, 73924, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6d4f000
mprotect(0xb6d51000, 61440, PROT_NONE) = 0
mmap2(0xb6d60000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0xb6d60000
close(3) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fcd000
set_tls(0xb6fcdbd0) = 0
mprotect(0xb6ee5000, 8192, PROT_READ) = 0
mprotect(0xb6d60000, 4096, PROT_READ) = 0
mprotect(0xb6f0d000, 4096, PROT_READ) = 0
mprotect(0xb6dd6000, 4096, PROT_READ) = 0
mprotect(0xb6dea000, 4096, PROT_READ) = 0
mprotect(0xb6f33000, 4096, PROT_READ) = 0
mprotect(0xb6f46000, 4096, PROT_READ) = 0
mprotect(0xb6f71000, 4096, PROT_READ) = 0
mprotect(0xb6f9d000, 4096, PROT_READ) = 0
mprotect(0x43f000, 4096, PROT_READ) = 0
mprotect(0xb6fd8000, 4096, PROT_READ) = 0
munmap(0xb6fcf000, 24663) = 0
set_tid_address(0xb6fcd778) = 10974
set_robust_list(0xb6fcd780, 12) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0xb6eef66d, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0xb6e13841}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0xb6eef6f1, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0xb6e13841}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
statfs("/sys/fs/selinux", 0xbea1655c) = -1 ENOENT (No such file or directory)
statfs("/selinux", {f_type=EXT2_SUPER_MAGIC, f_bsize=4096, f_blocks=7438627, f_bfree=6853088, f_bavail=6769594, f_files=1855392, f_ffree=1745592, f_fsid={val=[2118024466, 2550696797]}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_NOATIME}) = 0
brk(NULL) = 0x192b000
brk(0x194c000) = 0x194c000
openat(AT_FDCWD, "/proc/filesystems", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "nodev\tsysfs\nnodev\ttmpfs\nnodev\tbd"..., 1024) = 386
read(3, "", 1024) = 0
close(3) = 0
access("/etc/selinux/config", F_OK) = -1 ENOENT (No such file or directory)
prlimit64(0, RLIMIT_AS, NULL, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_AS, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}, NULL) = 0
prlimit64(0, RLIMIT_CORE, NULL, {rlim_cur=0, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_CPU, NULL, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_CPU, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}, NULL) = 0
prlimit64(0, RLIMIT_DATA, NULL, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_DATA, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}, NULL) = 0
prlimit64(0, RLIMIT_FSIZE, NULL, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_FSIZE, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}, NULL) = 0
prlimit64(0, RLIMIT_LOCKS, NULL, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_MEMLOCK, NULL, {rlim_cur=65536*1024, rlim_max=65536*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}, NULL) = -1 EPERM (Operation not permitted)
prlimit64(0, RLIMIT_NOFILE, {rlim_cur=256, rlim_max=RLIM64_INFINITY}, NULL) = -1 EPERM (Operation not permitted)
prlimit64(0, RLIMIT_NOFILE, {rlim_cur=1024*1024, rlim_max=1024*1024}, NULL) = 0
prlimit64(0, RLIMIT_NPROC, NULL, {rlim_cur=2962, rlim_max=2962}) = 0
prlimit64(0, RLIMIT_NPROC, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}, NULL) = -1 EPERM (Operation not permitted)
prlimit64(0, RLIMIT_NPROC, {rlim_cur=2962, rlim_max=2962}, NULL) = 0
prlimit64(0, RLIMIT_RSS, NULL, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_RSS, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}, NULL) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}, NULL) = 0
fcntl64(0, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(1, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(2, F_GETFL) = 0x2 (flags O_RDWR)
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=3041456, ...}) = 0
mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6b4f000
mmap2(NULL, 2596864, PROT_READ, MAP_PRIVATE, 3, 0x6d000) = 0xb68d5000
close(3) = 0
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=2329, ...}) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=2329, ...}) = 0
read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\10\0\0\0\0"..., 4096) = 2329
_llseek(3, -1479, [850], SEEK_CUR) = 0
read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\t\0\0\0\0"..., 4096) = 1479
close(3) = 0
stat64("/etc/sudo.conf", {st_mode=S_IFREG|0644, st_size=3975, ...}) = 0
openat(AT_FDCWD, "/etc/sudo.conf", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=3975, ...}) = 0
read(3, "#\n# Default /etc/sudo.conf file\n"..., 4096) = 3975
read(3, "", 4096) = 0
close(3) = 0
geteuid32() = 1000
access("/usr/local/bin/sudo", X_OK) = -1 ENOENT (No such file or directory)
access("/usr/bin/sudo", X_OK) = 0
stat64("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=135928, ...}) = 0
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=2996, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2996
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "sudo", 4sudo) = 4
write(2, ": ", 2: ) = 2
write(2, "effective uid is not 0, is /usr/"..., 133effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?) = 133
ioctl(2, TCGETS, {B9600 opost isig icanon echo ...}) = 0
) = 1
write(2, "\n", 1
) = 1
exit_group(1) = ?
+++ exited with 1 +++
"작업" $ sudo strace gpiomon --bias=pull-down --rising-edge gpiochip0 15
명령:
execve("/usr/bin/gpiomon", ["gpiomon", "--bias=pull-down", "--rising-edge", "gpiochip0", "15"], 0xbed83760 /* 16 vars */) = 0
brk(NULL) = 0x17ce000
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f11000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=24663, ...}) = 0
mmap2(NULL, 24663, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f0a000
close(3) = 0
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libgpiod.so.2", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260!\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=21952, ...}) = 0
mmap2(NULL, 86024, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6ed4000
mprotect(0xb6ed9000, 61440, PROT_NONE) = 0
mmap2(0xb6ee8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0xb6ee8000
close(3) = 0
openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\331v\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=971712, ...}) = 0
mmap2(NULL, 1040988, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6dd5000
mprotect(0xb6ebf000, 61440, PROT_NONE) = 0
mmap2(0xb6ece000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe9000) = 0xb6ece000
mmap2(0xb6ed1000, 8796, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6ed1000
close(3) = 0
set_tls(0xb6f12180) = 0
mprotect(0xb6ece000, 8192, PROT_READ) = 0
mprotect(0xb6ee8000, 4096, PROT_READ) = 0
mprotect(0x4a1000, 4096, PROT_READ) = 0
mprotect(0xb6f13000, 4096, PROT_READ) = 0
munmap(0xb6f0a000, 24663) = 0
rt_sigprocmask(SIG_BLOCK, [INT TERM], NULL, 8) = 0
signalfd4(-1, [INT TERM], 8, 0) = 3
openat(AT_FDCWD, "/dev", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC|O_DIRECTORY) = 4
fstat64(4, {st_mode=S_IFDIR|0755, st_size=3300, ...}) = 0
brk(NULL) = 0x17ce000
brk(0x17ef000) = 0x17ef000
getdents64(4, 0x17ce1b0 /* 165 entries */, 32768) = 4896
getdents64(4, 0x17ce1b0 /* 0 entries */, 32768) = 0
close(4) = 0
openat(AT_FDCWD, "/dev/gpiochip0", O_RDWR|O_CLOEXEC) = 4
lstat64("/dev/gpiochip0", {st_mode=S_IFCHR|0600, st_rdev=makedev(0xfe, 0), ...}) = 0
stat64("/dev/gpiochip0", {st_mode=S_IFCHR|0600, st_rdev=makedev(0xfe, 0), ...}) = 0
access("/sys/bus/gpio/devices/gpiochip0/dev", R_OK) = 0
openat(AT_FDCWD, "/sys/bus/gpio/devices/gpiochip0/dev", O_RDONLY) = 5
read(5, "254:0\n", 15) = 6
close(5) = 0
ioctl(4, GPIO_GET_CHIPINFO_IOCTL, 0xbee98018) = 0
openat(AT_FDCWD, "/dev/gpiochip1", O_RDWR|O_CLOEXEC) = 5
lstat64("/dev/gpiochip1", {st_mode=S_IFCHR|0600, st_rdev=makedev(0xfe, 0x1), ...}) = 0
stat64("/dev/gpiochip1", {st_mode=S_IFCHR|0600, st_rdev=makedev(0xfe, 0x1), ...}) = 0
access("/sys/bus/gpio/devices/gpiochip1/dev", R_OK) = 0
openat(AT_FDCWD, "/sys/bus/gpio/devices/gpiochip1/dev", O_RDONLY) = 6
read(6, "254:1\n", 15) = 6
close(6) = 0
ioctl(5, GPIO_GET_CHIPINFO_IOCTL, 0xbee98018) = 0
close(4) = 0
close(5) = 0
openat(AT_FDCWD, "/dev/gpiochip0", O_RDWR|O_CLOEXEC) = 4
lstat64("/dev/gpiochip0", {st_mode=S_IFCHR|0600, st_rdev=makedev(0xfe, 0), ...}) = 0
stat64("/dev/gpiochip0", {st_mode=S_IFCHR|0600, st_rdev=makedev(0xfe, 0), ...}) = 0
access("/sys/bus/gpio/devices/gpiochip0/dev", R_OK) = 0
openat(AT_FDCWD, "/sys/bus/gpio/devices/gpiochip0/dev", O_RDONLY) = 5
read(5, "254:0\n", 15) = 6
close(5) = 0
ioctl(4, GPIO_GET_CHIPINFO_IOCTL, 0xbee98058) = 0
ioctl(4, GPIO_GET_LINEINFO_IOCTL, 0xbee9807c) = 0
ioctl(4, GPIO_GET_LINEEVENT_IOCTL, 0xbee9809c) = 0
ioctl(4, GPIO_GET_LINEINFO_IOCTL, 0xbee9803c) = 0
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 1 ([{fd=5, revents=POLLIN}])
read(5, "\233\\D\336\201\10\0\0\1\0\0\0\0\0\0\0", 16) = 16
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0
write(1, "event: RISING EDGE offset: 15 t"..., 63event: RISING EDGE offset: 15 timestamp: [ 9353.872825499]
) = 63
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 1 ([{fd=5, revents=POLLIN}])
read(5, "\213\273\312\6\203\10\0\0\1\0\0\0\0\0\0\0", 16) = 16
write(1, "event: RISING EDGE offset: 15 t"..., 63event: RISING EDGE offset: 15 timestamp: [ 9358.847687563]
) = 63
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI}, {fd=3, events=POLLIN|POLLPRI}], 2, 10000^C) = 1 ([{fd=3, revents=POLLIN}])
strace: Process 10962 detached
답변1
Allwinner_H3_Datasheet 섹션 3.3 ~pg80에 따라(하단 링크를 통해)바나나 파이 페이지, EINT
핀만 인터럽트를 지원합니다.
동일한 Banana Pi 페이지에 따르면 CON2-P128
에 해당하므로 PC4
또는 핀 중 하나가 아니므 H3
로 인터럽트가 지원되지 않습니다.PA
PG
EINT
소프트웨어(커널 GPIO 드라이버나 커널 GPIO 드라이버 모두 libgpiod
)가 이 라인이 인터럽트를 제공하도록 할 수 있는 방법은 없습니다. 유일한 옵션은 해당 라인을 폴링하거나 EINT
핀 중 하나로 전환하는 것입니다 .
libgpiod v2
gpioset
그런데, 성능 최적화로 행 값을 얻기 위해 대화형 모드를 사용하도록 제안한 의견 중 하나입니다 . 이 모드의 작성자로서 이것은 작동하지 않습니다. gpioset
라인 출력이 저장되고 반환된 값은 get
라인이 현재 설정된 값입니다(몇 번 전환하여 추적을 잃을 경우). 그래서 당신이 원하는 것이 아닙니다. 일반 규칙 - 외부 드라이버의 입력 라인에 사용하지 마십시오 gpioset
. 마법이 사라질 것입니다.
답변2
나는 의 저자입니다 libgpiod
. 실행 gpiomon
하여 파일 설명자가 폴링 이벤트를 발생시키지 않는지 확인할 수 있습니까 strace
? 그렇지 않은 경우 커널이 인터럽트를 보고하지 않는 것입니다. 이는 드라이버가 잘못 작동하거나(가능성 없음) 하드웨어가 이러한 인터럽트를 생성하지 않음을 의미합니다(가능성 있음).
어떤 드라이버를 사용하고 있습니까? 마더보드가 업스트림 장치 트리를 사용합니까?
바트