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
またはピンの1つではないH3
ため、割り込みはサポートされていません。PA
PG
EINT
ソフトウェア(カーネルGPIOドライバまたはカーネルGPIOドライバの両方libgpiod
)がこのラインに割り込みを提供させる方法はありません。唯一のオプションは、対応するラインをポーリングするか、EINT
ピンの1つに切り替えることです。
libgpiod v2
gpioset
ちなみに、パフォーマンス最適化で行値を取得するためにインタラクティブモードを使用することを提案したコメントの1つです。このモードの作成者として、これは機能しません。gpioset
ライン出力が保存され返された値は、ラインがget
現在設定されている値です(数回切り替えてトレースを失った場合)。だからあなたが望むものではありません。一般規則 - 外部ドライバの入力ラインには使用しないでくださいgpioset
。魔法が消えるでしょう。
答え2
私はの著者ですlibgpiod
。実行gpiomon
して、ファイル記述子がポーリングイベントを発生させないことを確認できますかstrace
?それ以外の場合、カーネルは割り込みを報告しません。これは、ドライバが正しく動作しない(可能性なし)、ハードウェアがこれらの割り込みを生成しないことを意味します(可能性あり)。
どのドライバを使用していますか?マザーボードはアップストリームデバイスツリーを使用しますか?
バート