Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
LIRCのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
LIRC
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:ハードウェア]] [[Category:マルチメディア]] [[en:LIRC]] [https://lirc.org/ official website] から: :'''LIRC''' (Linux 赤外線リモコン) は、一般的に使用される多くの (すべてではない) リモコンの赤外線信号をデコードして送信するパッケージです。 {{Note|4.18 以降、カーネルは BPF を使用して一部の IR リモコンの信号をデコードできるため、LIRC が重複する場合があります。[https://lwn.net/Articles/759188/]}} この記事ではシリアル・USB 赤外線デバイスを使って [http://lirc.org/ LIRC] "Linux Infrared Remote Control" を設定・使用する方法を説明しています。 LIRC はサポートしているリモコンのキーが押されたときにプログラムにあわせて特定のコマンドに変換することができるデーモンです。ここで、「プログラムにあわせて」とは同じキーでも実行しているプログラムによって異なる動作をさせることができることを意味します。LIRC から取得されたリモコンの情報は以下のようにプログラムに流れます: # ユーザーがリモコンのボタンを押すことで IR または RF 信号が送信されます。 # Linux パソコンに接続されたレシーバーによって信号が受信されます。 # カーネル (のモジュール) によってリモコンから送信されたパルス信号が {{ic|/dev/lirc0}}, {{ic|/dev/input/eventX}}, {{ic|/dev/ttyUSBX}}, {{ic|/dev/ttyS0}} などのデバイスに変換されます。 # {{ic|/usr/bin/lircd}} は {{ic|/etc/lirc/lircd.conf.d/foo.conf}} の情報を使ってパルス信号をボタンの押下情報に変換します。 # LIRC を使用するプログラムは {{ic|~/.lircrc}} に書かれている情報に従って {{ic|/usr/bin/lircd}} のボタン押下情報をユーザーが定義した操作に解釈します。 ==インストール== {{Pkg|lirc}} パッケージを[[インストール]]してください。 == 設定 == === 受信機と送信機の設定 === {{Note|このセクションは簡単な概要です。完全なドキュメントが利用可能です [https://lirc.sourceforge.net/lirc.org/html/index.html upstream]}} 適切に実行するには、LIRC サービスの ''ドライバー'' および/または ''デバイス'' を指定する必要がある場合があります。''irrecord'' などの LIRC 依存プログラムの実行中にサービスが突然停止した場合は、[[journalctl]] 出力で次のようなメッセージを探してください。 Driver `devinput' not found or not loadable (wrong or missing -U/--plugindir?). readlink() failed for "auto": No such file or directory これらを設定ファイルに設定し、サービスを再起動します。 {{hc|/etc/lirc/lirc_options.conf|2= [lircd] driver = ''driver-name'' device = /dev/''path-to-dev'' }} ==== シリアルポート ==== {{Tip|DIY 回路図については、シリアルポート [https://www.lirc.org/receivers.html 受信機] および [https://www.lirc.org/transmitters.html 送信機] のドキュメントを参照してください。シリアルポートデバイスは、''audio_alsa'' や ''audio'' よりもはるかに信頼性が高いことに注意してください。}} 最新のカーネルには、古い ''lirc_serial'' ドライバーに代わる ''serial_ir'' モジュールがあります。マザーボードのシリアルポートに接続された DIY 受信機および送信機もサポートします。{{AUR|setserial}} をインストールして実行します: # setserial /dev/ttyS0 uart none # modprobe serial_ir ''serial_ir'' モジュールをロードすると、デバイス {{ic|/dev/lirc0}} が、カーネルによって [https://github.com/torvalds/linux/blob/master/drivers/media/rc/serial_ir.c created] になります。そうでない場合は、[[systemd/ジャーナル|ジャーナル]] で関連するエラーがないか確認してください。シリアルデバイスの LIRC 設定例: {{hc|/etc/lirc/lirc_options.conf|2= [lircd] driver = default device = auto [modinit] code = /usr/bin/setserial /dev/ttyS0 uart none code1 = /usr/sbin/modprobe serial_ir }} ==== サウンドカード ==== {{Note|サウンドカードを赤外線デバイスとして使用すると、多くの落とし穴があり、他のハードウェア設定よりも利点が得られません。}} 外部 DIY 回路が接続されたサウンドカードは、[https://www.lirc.org/ir-audio.html 受信] および IR コードを [https://web.archive.org/web/20150511192459/http://www.lirc.org:80/html/audio.html 送受信] できます。 ''audio_alsa'' [https://www.lirc.org/html/audio-alsa.html driver] は {{pkg|lirc}} に含まれていますが、受信のみをサポートしています。 {{ic|alsamixer}} でマイク入力のミュートを解除し、十分なゲインを設定します。{{pkg|audacity}} で波形とゲインを確認できます。区別できる方形パルスが存在する必要があります。平坦でも過負荷でもありません。また、良好に復調されたパルスは耳で簡単に認識できます。LIRC と {{ic|irrecord}} は ''右オーディオチャネルの正のパルス'' を読み取ることに注意してください。負のパルスは機能しません。 {{hc|/etc/lirc/lirc_options.conf|2= driver = audio_alsa device = default }} {{AUR|lirc-git}} に含まれる ''audio'' [https://web.archive.org/web/20150511192459/http://www.lirc.org:80/html/audio.html driver] が受信と送信の両方をサポートします。デフォルトの遅延が 0.02 程度であると、"Warning: Output underflow" が発生し、送信が破損する可能性があることに注意してください。受信機はそれに応答しません。0.05 などのより高い値を試してください。 サウンドカードの出力音量を上げて下さい。そうしないと、LED 信号が弱く、範囲が狭くなります。LEDフラッシュは赤外線の波長に敏感であるため、スマートフォンのカメラで検出できます。 {{hc|/etc/lirc/lirc_options.conf|2= driver = audio device = ALSA:default@48000:0.05 }} === Remote configuration === Directory {{ic|/etc/lirc/lircd.conf.d/}} contains system-wide configuration files for remotes. Each ''*.conf'' file corresponds to one device and describes its protocol, scancodes and keycodes. It allows LIRC receive and send signals for specific hardware. These files are not included in {{Pkg|lirc}} package and should be found somewhere or created by user. ==== Searching for remote configuration ==== Plenty of configuration files can be found in the [http://lirc-remotes.sourceforge.net/remotes-table.html LIRC remotes database]. Follow the url or use {{man|1|irdb-get}} to search the database. An example using {{ic|irdb-get}} to find a configuration file for a "Streamzap" remote: {{hc|$ irdb-get find stream| atiusb/atiusb.lircd.conf digital_stream/DTX9900.lircd.conf snapstream/Firefly-Mini.lircd.conf streamzap/PC_Remote.lircd.conf streamzap/streamzap.lircd.conf x10/atiusb.lircd.conf }} {{hc|$ irdb-get download streamzap/streamzap.lircd.conf| Downloaded sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/streamzap/streamzap.lircd.conf as streamzap.lircd.conf }} Once identified, copy the needed ''.conf'' to {{ic|/etc/lirc/lircd.conf.d/}} to allow the daemon to initialize support for it. # cp streamzap.lircd.conf /etc/lirc/lircd.conf.d/ ==== Creating remote configuration ==== Remote control configurations can be created using {{man|1|irrecord}}, which guides users trough the process. If using a detected remote, invoke it like so: # irrecord --device=/dev/lirc0 MyRemote The program will instruct user to begin hitting keys on the remote in an attempt to learn it, ultimately mapping out every button and its corresponding scancode. When finished, save the resulting file to {{ic|/etc/lirc/lircd.conf.d/foo.conf}} and proceed. Consider sharing configuration file with others. === Application-specific actions === {{Tip|Many application-specific lircrc files are available on the internet.}} Bind keycodes to application-specific actions by placing their respective configuration files in {{ic|~/.config/lircrc/}} which should be created manually if desired, see {{man|5|lircrc}}. This only works for LIRC-aware applications, like [[MPlayer]], [[VLC]], [[MythTV]] and {{Pkg|totem}} ([[Kodi]] also supports LIRC but does so in a non-standard way, see [[Kodi#Using a remote control]]). Define these application-specific configurations in separate files and include them in ''lircrc'', like: include "~/.config/lircrc/mplayer" include "~/.config/lircrc/mythtv" include "~/.config/lircrc/vlc" === Running as a regular user === By default, ''lircd'' runs as root. For increased stability and security, upstream recommends running it as a regular user. See Appendix 14 at [https://www.lirc.org/html/configuration-guide.html this] link. ==== User the AUR package for lirc-user-service ==== {{AUR|lirc-user-service}} is offered which does everything automatically. == リモコンのテスト == {{ic|lircd.service}} を[[起動]]してブート/シャットダウン時に実行されるように[[有効化]]してください (強く推奨)。 {{ic|/usr/bin/irw}} を使ってリモコンをテストしてください、リモコンのボタンを押した時に LIRC が受信したものを全て標準出力に流します。 例: $ irw 000000037ff07bfe 00 One mceusb 000000037ff07bfd 00 Two mceusb 000000037ff07bfd 01 Two mceusb 000000037ff07bf2 00 Home mceusb 000000037ff07bf2 01 Home mceusb このコマンドが動作しない場合 (irw が何も出力をしない): {{ic|/etc/lirc/lircd.conf.d/}} 内の config ファイルに間違いがないかよく確認してください。 ==プログラムごとの設定 == LIRC では同じキーでもプログラムごとに別々のコマンドになるように設定することができます。つまり、特定のキーを押した時に mplayer と vlc で挙動を変えられます。 まずは LIRC のコマンドを使用するプログラムを決めてください。一般的なプログラムの例: {{Pkg|mplayer}}, {{AUR|mythtv}}, {{Pkg|totem}}, {{Pkg|vlc}}, {{Pkg|kodi}}。 {{Note|Kodi は非標準的な方法で LIRC を実装しています。他のプログラムが使用する LIRC の標準ファイルではなく、特別な xml ファイルである {{ic|~/.xbmc/userdata/Lircmap.xml}} を編集する必要があります。Kodi を使用するユーザーは [[Kodi#リモートコントロールの使用]]の記事を読んでください。}} プログラム固有のマッピングを指定するファイルを作成してください: $ mkdir ~/.lirc $ touch ~/.lircrc {{ic|~/.lirc}} に各プログラムの名前が付いた設定ファイルを作成してください。例: $ ls ~/.lirc mplayer mythtv vlc {{Tip|Google で検索すれば様々なリモコン・プログラム固有のファイルが山ほど出てきます。この記事では各プログラムのキーマップについては扱いません。}} {{ic|~/.lircrc}} を編集して LIRC でコントロールするプログラムの数だけ {{ic|~/.lirc/foo}} を指定する ''include'' ステートメントを記述してください。例: {{hc|~/.lircrc| include "~/.lirc/mplayer" include "~/.lirc/mythtv" include "~/.lirc/vlc" }} ==トラブルシューティング== === リモコンがキーボードとして機能する === ==== Xorg を使用している場合 ==== Streamzap USB PC Remote など、リモコンによっては Xorg によって Human Interface Device (HID) と認識されるものがあり、物理キーボードからの入力のようにキーの一部または全てがキーストロークとして認識されます。この挙動は LIRC でデバイスを管理しようとしたときに問題になります。無効にするには、以下のファイルを作成して X を再起動してください: {{hc|/etc/X11/xorg.conf.d/90-streamzap.conf| Section "InputClass" Identifier "Ignore Streamzap IR" MatchProduct "Streamzap" MatchIsKeyboard "true" Option "Ignore" "true" EndSection}} 次のコマンドで得られる出力の {{ic|Name}} に合わせて {{ic|MatchProduct}} は適切に変更するようにしてください: $ cat /proc/bus/input/devices | grep -e IR 例えば {{ic|<nowiki>N: Name="cx88 IR (WinFast DTV2000 H rev."</nowiki>}} の場合 {{ic|WinFast}} にします。 ==== ARM デバイスで Xorg を使用していない場合 ==== {{ic|/etc/modprobed.d/streamzap.conf}} を作成して問題を起こすモジュールをブラックリストに追加してください。例えば Streamzap のリモコンの場合: install ir_sharp_decoder /bin/false install ir_xmp_decoder /bin/false install ir_rc5_decoder /bin/false install ir_nec_decoder /bin/false install ir_sony_decoder /bin/false install ir_mce_kbd_decoder /bin/false install ir_jvc_decoder /bin/false install ir_rc6_decoder /bin/false install ir_sanyo_decoder /bin/false === デフォルト設定を変更する === {{ic|irw}} で何も出力されない場合、{{ic|/etc/lirc/lirc_options.conf}} のデフォルト設定が原因である可能性があります (あるいはアップデートによって上書きされた可能性もあります)。 まず、{{ic|/dev/lirc0}} が存在するかどうか確認してください: $ mode2 --driver default --device /dev/lirc0 リモコンのボタンを押してみて何か出力されないか確認してください。出力がある場合、{{ic|/etc/lirc/lirc_options.conf}} を編集して ''driver'' と ''device'' を適当な値に変更してください。 何も出力されない場合、適切なドライバーとデバイスの組み合わせを探します。最初に lirc がデフォルトでどの組み合わせを認識しているのか確認します。{{Pkg|v4l-utils}} パッケージに含まれている {{ic|ir-keytable}} を実行して出力を確認してください。以下のように出力されます: Found /sys/class/rc/rc0/ (/dev/input/event5) with: Driver ite-cir, table rc-rc6-mce Supported protocols: unknown other lirc rc-5 jvc sony nec sanyo mce-kbd rc-6 sharp xmp Enabled protocols: lirc Extra capabilities: <access denied> 上記の場合、lirc は {{ic|/dev/input/event5}} を赤外線デバイスとして自動的に認識して、{{ic|devinput}} ドライバーが使われています。以下のコマンドを実行することで組み合わせが正しいか確認します: $ mode2 --driver devinput --device /dev/input/event5 リモコンのボタンを押してみてください。何も出力されない場合、別のドライバーとデバイスの組み合わせを試してみてください。機能する組み合わせを発見したら、{{ic|/etc/lirc/lirc_options.conf}} の ''driver'' と ''device'' を変更してください。 ==== サンプル ==== MCE RC6 互換レシーバの設定例: {{hc|/etc/lirc/lirc_options.conf|2=[lircd] nodaemon = False driver = default device = /dev/lirc0 output = /var/run/lirc/lircd pidfile = /var/run/lirc/lircd.pid plugindir = /usr/lib/lirc/plugins permission = 666 allow-simulate = No repeat-max = 600 [lircmd] uinput = False nodaemon = False }} == 参照 == * [http://lirc.sourceforge.net/lirc.org/html/index.html 開発元のドキュメント] * [http://lirc-remotes.sourceforge.net/remotes-table.html リモコンデータベース] * [http://sf.net/p/lirc プロジェクトサイト] * [http://lirc.org/html/configuration-guide.html 開発元の設定ガイド] * [http://www.mythtv.org/wiki/Category:Remote_Controls MythTV Wiki:Remotes article] * [http://lirc-remotes.sourceforge.net/remotes-table.html サポートしているハードウェアの公式リスト] * [https://github.com/graysky2/streamzap Linux Streamzap config files]
このページで使用されているテンプレート:
テンプレート:AUR
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:Man
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
テンプレート:Tip
(
ソースを閲覧
)
LIRC
に戻る。
検索
検索
LIRCのソースを表示
話題を追加