embeded/odroid

odroid c2 lircd output 성공

구차니 2021. 9. 18. 00:43

irrecord가 ubuntu 20.04 에서 안되서 일단 18.04로 시도해서 성공.

ubuntu-18.04.3-3.16-minimal-odroid-c2-20190814.img

 

다시 한번 irrecord -f 옵션으로 20.04에서 시도해봐야 할 듯.

+

20.04 에서 해봤는데 -f 옵션으로 raw 처리하니 입력은 받을 수 있는 듯.

값이 미묘하게 다르긴 하지만 되는 것 같기도 하고?

 

 

GPIO IR 회로.

[링크 : https://wiki.odroid.com/odroid-c2/application_note/gpio/lirc_gpio_blaster]

 

간단하게 IR LED를  9번과(IR LED -극) 11번(IR LED +극)에 연결하면 된다.

거리가 60cm 정도만 떨어져도 인식이 안되기 시작해서 문제지 -_-

그래서 TR을 이용해서 전원을 공급받고 GPIO로 On/Off만 해주는 건가..

[링크 : https://wiki.odroid.com/odroid-c2/hardware/expansion_connectors]

 

환경설정 파일

# cat /etc/lirc/lirc_options.conf
# These are the default options to lircd, if installed as
# /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8)
# manpages for info on the different options.
#
# Some tools including mode2 and irw uses values such as
# driver, device, plugindir and loglevel as fallback values
# in not defined elsewhere.

[lircd]
nodaemon        = False
driver          = default
device          = /dev/lirc0
output          = /var/run/lirc/lircd
pidfile         = /var/run/lirc/lircd.pid
plugindir       = /usr/lib/aarch64-linux-gnu/lirc/plugins
permission      = 666
allow-simulate  = No
repeat-max      = 600

[lircmd]
uinput          = False
nodaemon        = False

[modinit]
code = /sbin/modprobe meson-ir

[lircd-uinput]
add-release-events = True
release-timeout = 50
release-suffix = _EVUP

 

커스텀(?) 리모컨 파일 추가.

서비스 재기동 전에는 해당 디렉토리의 파일을 새로 불러들이진 않는다.

# cat /etc/lirc/lircd.conf.d/monex.lircd.conf

# Please take the time to finish this file as described in
https://sourceforge.net/p/lirc-remotes/wiki/Checklist/
# and make it available to others by sending it to
# <lirc@bartelmus.de>
#
# This config file was automatically generated
# using lirc-0.10.0(default) on Fri Sep 17 12:28:52 2021
# Command line used: -d /dev/lirc0
# Kernel version (uname -r): 3.16.72-46
#
# Remote name (as of config file): monex
# Brand of remote device, the thing you hold in your hand:
# Remote device model nr:
# Remote device info url:
# Does remote device has a bundled capture device e. g., a
#     usb dongle? :
# For bundled USB devices: usb vendor id, product id
#     and device string (use dmesg or lsusb):
# Type of device controlled
#     (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) :
# Device(s) controlled by this remote:

begin remote

  name  monex
  bits           32
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       8970  4517
  one           561  1692
  zero          561   569
  ptrail        563
  repeat       8970  2289
  gap          107503
  toggle_bit_mask 0x0
  frequency    38000

      begin codes
          key_power                0x10EFEB14 0xFFFFFFFF
          key_menu                 0x10EF3BC4 0xFFFFFFFF
          key_up                   0x10EF49B6 0xFFFFFFFF
          key_down                 0x10EF1BE4 0xFFFFFFFF
          key_left                 0x10EFE916 0xFFFFFFFF
          key_right                0x10EFF906 0xFFFFFFFF
          key_ok                   0x10EF51AE 0xFFFFFFFF
          key_exit                 0x10EF2BD4 0xFFFFFFFF
          key_mute                 0x10EFFB04 0xFFFFFFFF
      end codes

end remote

 

서비스 재기동 및 gpio ir tx 설정

irsend를 통해서 보낼대 조금 귀찮게 디바이스 설정을 해주어야 한다.

$ service lircd stop
$ modprobe lirc_dev
$ modprobe lirc_odroid gpio_out_pin=247 softcarrier=1 invert=1
$ service lircd restart
$ lircd --driver=default --device=/dev/lirc1 --output=/var/run/lirc/lirc1 --pidfile=/var/run/lirc/lirc1.pid
$ irsend SEND_ONCE monex KEY_POWER -d /var/run/lirc/lirc1

[링크 : https://wiki.odroid.com/odroid-c2/application_note/gpio/lirc_gpio_blaster/irblaster_lirc_setup_ubuntu18.04]