Raspberry Piと電子工作

はんだ付けをしないで電子工作を学びたい。

Raspberry Pi で 赤外線リモコン(LIRC を送信)#2

LIRCの受信動作までは確認できましたが、送信処理がうまく行きません。

 

下記のような記事を見つけましたが、bullseye には hardware.conf は不要なのかもしれません。

 ※ 最新の Raspbian Stretch OSは /etc/lirc/hardware.confファイルが存在しません。

 hardware.confファイルの代わりに /etc/lirc/lirc_options.confファイルを編集します。

 

lircd.conf を作成

 

$ irrecord -n -d /dev/lirc1 lircd.conf

 

Using driver default on device /dev/lirc1

irrecord -  application for recording IR-codes for usage with lirc
Copyright (C) 1998,1999 Christoph Bartelmus(lirc@bartelmus.de)

This program will record the signals from your remote control
and create a config file for lircd.

A proper config file for lircd is maybe the most vital part of this
package, so you should invest some time to create a working config
file. Although I put a good deal of effort in this program it is often
not possible to automatically recognize all features of a remote
control. Often short-comings of the receiver hardware make it nearly
impossible. If you have problems to create a config file READ THE
DOCUMENTATION at https://sf.net/p/lirc-remotes/wiki

If there already is a remote control of the same brand available at
http://sf.net/p/lirc-remotes you might want to try using such a
remote as a template. The config files already contains all
parameters of the protocol used by remotes of a certain brand and
knowing these parameters makes the job of this program much
easier. There are also template files for the most common protocols
available. Templates can be downloaded using irdb-get(1). You use a
template file by providing the path of the file as a command line
parameter.

Please take the time to finish the file as described in
https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ an send it
to  <lirc@bartelmus.de> so it can be made available to others.

Press RETURN to continue.

 

Checking for ambient light  creating too much disturbances.
Please don't press any buttons, just wait a few seconds...

No significant noise (received 0 bytes)

 

Enter name of remote (only ascii, no spaces) :TV


Using TV.lircd.conf as output filename

Now start pressing buttons on your remote control.

It is very important that you press many different buttons randomly
and hold them down for approximately one second. Each button should
generate at least one dot but never more than ten dots of output.
Don't stop pressing buttons until two lines of dots (2x80) have
been generated.

Press RETURN now to start recording.
................................................................................
Got gap (45212 us)}

Please keep on pressing buttons like described above.
...............................................................................

Please enter the name for the next button (press <ENTER> to finish recording)
power

Now hold down button "power".

Please enter the name for the next button (press <ENTER> to finish recording)
up

Now hold down button "up".

Please enter the name for the next button (press <ENTER> to finish recording)
down

Now hold down button "down".

Please enter the name for the next button (press <ENTER> to finish recording)
ch1

Now hold down button "ch1".

Please enter the name for the next button (press <ENTER> to finish recording)
ch2

Now hold down button "ch2".

Please enter the name for the next button (press <ENTER> to finish recording)
ch3

Now hold down button "ch3".

Please enter the name for the next button (press <ENTER> to finish recording)
ch4

Now hold down button "ch4".

Please enter the name for the next button (press <ENTER> to finish recording)
ch5

Now hold down button "ch5".

Please enter the name for the next button (press <ENTER> to finish recording)
ch7

Now hold down button "ch7".

Please enter the name for the next button (press <ENTER> to finish recording)
ch8

Now hold down button "ch8".

Please enter the name for the next button (press <ENTER> to finish recording)

 

Checking for toggle bit mask.
Please press an arbitrary button repeatedly as fast as possible.
Make sure you keep pressing the SAME button and that you DON'T HOLD
the button down!.
If you can't see any dots appear, wait a bit between button presses.

Press RETURN to continue.


Cannot find any toggle mask.

Successfully written config file TV.lircd.conf

 

出来上がった TV.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.1(default) on Fri May  5 17:02:06 2023
# Command line used: -n -d /dev/lirc1 lircd.conf
# Kernel version (uname -r): 5.15.32-v7+
#
# Remote name (as of config file): TV
# 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  TV
  bits            8
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       2404   591
  one          1205   588
  zero          604   588
  post_data_bits  4
  post_data      0x0
  gap          45212
  toggle_bit_mask 0x0
  frequency    38000

      begin codes
          power                    0xA9
          up                       0x49
          down                     0xC9 0x00
          ch1                      0x01 0x00
          ch2                      0x81 0x00
          ch3                      0x41 0x00
          ch4                      0xC1 0x00
          ch5                      0x21 0x00
          ch7                      0x61 0x00
          ch8                      0xE1 0x00
      end codes

end remote