因此,我在 pi 的 gpio 引脚 23 上运行了一个红外传感器。config.txt
[all]
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel
[pi4]
max_framebuffers=2
arm_boost=1
[all]
# Enable the audio output, I2C and SPI interfaces on the GPIO header. As these
# parameters related to the base device-tree they must appear *before* any
# other dtoverlay= specification
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on
# Comment out the following line if the edges of the desktop appear outside
# the edges of your display
disable_overscan=1
# If you have issues with audio, you may try uncommenting the following line
# which forces the HDMI output into HDMI mode instead of DVI (which doesn't
# support audio output)
#hdmi_drive=2
# Enable the serial pins
enable_uart=1
# Autoload overlays for any recognized cameras or displays that are attached
# to the CSI/DSI ports. Please note this is for libcamera support, *not* for
# the legacy camera stack
camera_auto_detect=1
display_auto_detect=1
#output
#dtoverlay=gpio-ir-tx,gpio_pin=24
#input
dtoverlay=gpio-ir,gpio_pin=23
[cm4]
# Enable the USB2 outputs on the IO board (assuming your CM4 is plugged into
# such a board)
dtoverlay=dwc2,dr_mode=host
[all]
我已经lirc
安装并sudo mode2 -d /dev/lirc0
运行(输出脉冲和空间)此外,sudo ir-keytable -t -p nec
当我按下确定按钮时也会输出这个
Protocols changed to nec
Testing events. Please, press CTRL-C to abort.
667.976057: lirc protocol(nec32): scancode = 0x3085e019
667.976088: event type EV_MSC(0x04): scancode = 0x3085e019
667.976088: event type EV_SYN(0x00).
668.036053: lirc protocol(nec32): scancode = 0x3085e019 repeat
668.036083: event type EV_MSC(0x04): scancode = 0x3085e019
668.036083: event type EV_SYN(0x00).
我该怎么做才能将遥控器用作键盘?
编辑我通过 ir-keytable 查看了哪个按钮去了哪里,这里的表格注意到所有的代码都是 nec32,除非它说 necx
0x3085c035 power
0x3085d022 reverse
0x3085d021 play
0x3085d024 forward
0x3085d020 record
0x3085d023 pause
0x3085d025 slow
0x3085c036 home
0x3085c036 page up
0x3085e014 up
0x3085e016 down
0x3085e015 right
0x3085e017 left
0x3085e019 ok
0x3085f004 menu
0x3085e013 info options
0x3085c033 go back
0x3085c032 exit
0x3085d028 1
0x3085d029 2
0x3085d02a 3
0x3085d02b 4
0x3085d02c 5
0x3085d02d 6
0x3085d02e 7
protocol(necx): scancode = 0x85302f 8
0x3085c030 9
0x3085c033 enter
0x3085c031 0
0x3085e011 input digital
0x30859062 red
0x30859063 green
0x30859060 yellow
0x30859061 blue
标准信息
Linux bigs 5.15.0-1005-raspi #5-Ubuntu SMP PREEMPT Mon Apr 4 12:25:49 UTC 2022 armv7l armv7l armv7l GNU/Linux
Ubuntu:22.04 server arm64 pi 4