Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
HDMI-CECのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
HDMI-CEC
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:ディスプレイ制御]] [[en:HDMI-CEC]] [[pl:HDMI-CEC]] [[Wikipedia:Consumer Electronics Control|High-Definition Multimedia Interface - Consumer Electronics Control]] (HDMI-CEC) は、HDMI 接続内の追加の低速(50 B/s)バスであり、HDMI デバイスの「ネットワーク」が互いに通信するために使用できます。これにより、HDMI デバイスはお互いにオンまたはオフにすることを通知したり、テレビが入力を切り替えたり、リモコンのボタンが押されたりするなどの操作が可能になります。PC セットアップでは、通常、HTPC(ホームシアターPC)セットアップで遭遇します。 様々な理由から、ほとんどの PC GPU は CEC のハードウェアサポートを持っていません。ビデオゲームコンソールやセットトップボックスは通常、CEC ピンを駆動するために外部チップセットを含める必要があります。Raspberry Pi で見られる VideoCore GPU のようにネイティブ CEC サポートを持つデバイスもありますが、ほとんどのハードウェア構成では追加のハードウェアが必要です。 == Features == The main purpose of CEC is to grant a television insight and control over the state of the devices plugged into it. As such, it is split into a dozen of "features" that each target specific use cases, and which devices can opt to support or not based on their role as initiator/follower, their capabilities, as well as user configuration. The standardized features are: ;One Touch Play: Lets a device signal that it wishes to immediately become the active source, which can automatically turn on the TV ;Routing Control: Allows the TV to control HDMI switches and lets devices check what source is currently active ;Remote Control Passthrough: Lets devices send remote control signals to each other, usually from the TV to the active source ;Deck Control: To control a movie/music player and query its playback status ;Standby/System Standby: Lets a device request that another specific device be turned off, or broadcast that all devices on the system should now turn off. ;Power Status: Lets devices be probed to see if they are in standby mode or turned on, or if they are in the process of turning on. ;System Audio Control: Grants control of an AV receiver connected over the TV's Audio Return Channel, allowing the volume to be changed and the receiver to be turned on or off. ;Tuner Control: Lets any device step through the list of TV channels known to a tuner device and query information on the active channel, like the channel number for analog TV or DVB/ATSC/ARIB transport stream information for digital TV ;One Touch Record: Enables a recorder to query what channel the TV is currently showing so that said recorder can tune to the same channel and begin recording, or know that it should record itself or a downstream device if it already is the currently active HDMI source ;Timer Programming: Allows a TV to configure a timer on a recorder to start recording a given source at a specific time ;OSD display: Allows a device to print a message on the TV, between 1 and 13 ASCII characters long ;Dynamic Auto Lipsync: Allows a TV to broadcast changes in presentation latency to the the audio sink, which a source that has its own speakers (like a PC) can use for latency compensation with the image {{Tip|Not listed: Device Menu Control (deprecated in CEC 2.0), OSD name transfer (handled by cec-ctl), System information, Vendor-specific command (no standardized messages), Audio Rate Control (TV-AV only), Audio Return Channel Control (TV-AV only)}} For a device like a PC, the most useful one among these is going to be '''Remote Control Passthrough'''. '''System Standby''' may be useful for HTPCs, but would be of questionable use on more general-purpose machines, which are not usually expected to go to sleep when the screen turns off. '''Routing Control''' could be used to wake up the system when the the TV attempts to display that input, provided the connected PC has a way to listen to CEC traffic while suspended. '''System Audio Control''' would be convenient for some HDMI sound outputs, but does not currently work as a mean of volume control with either [[PipeWire]] or [[PulseAudio]]. == Hardware setup == The Linux [[Kernel]] already has a built-in subsystem to automatically respond to queries and handle CEC events, but the hardware may need to be configured first in order to work. === Native CEC === Native CEC is [https://docs.kernel.org/admin-guide/media/cec.html#supported-hardware-in-mainline mostly encountered] in ARM devices. In x86 world the easiest option is [[#Tunneling over DisplayPort|tunneling over DisplayPort]], otherwise only some [[Chrome OS devices|Chrome OS]] devices and [https://www.seco.com SECO] [https://www.udoo.org UDOO] single-board computers offer CEC. === Tunneling over DisplayPort === This works with [[i915]], [[nouveau]] and [[AMDGPU|amdgpu]] drivers. The DisplayPort 1.3 standard (introduced in 2014) allows DisplayPort-to-HDMI adapters to use the auxiliary channel to forward CEC signals both ways. This is the sort of feature that adapters do not usually support unless mentioned, and is not commonly found, but it can counter-intuitively be cheaper and easier to use CEC tunneling over DisplayPort than a USB-CEC adapter. The kernel documentation page for the CEC submodule has [https://docs.kernel.org/admin-guide/media/cec.html#displayport-to-hdmi-adapters-with-working-cec a list of adapters] which have been confirmed to work. === CEC adapter === {{Note|If you are looking to use HDMI-CEC with [[Kodi]], know that it has [[Kodi#HDMI-CEC|built-in support for both Pulse-Eight and Raspberry Pi modes of CEC control]] and is incompatible with the following configuration.}} ==== PulseEight USB adapter ==== The [https://www.pulse-eight.com/p/104/usb-hdmi-cec-adapter PulseEight USB-CEC adapter] works by passively extending all the pins of the HDMI connector on from the "PC side" connector to the "TV side" connector, save for the CEC pin, which is intercepted. The data going through that pin is instead exposed over a USB serial interface to let a PC control and monitor CEC traffic. The [[Serial input device to kernel input|serial device]] needs to have its line discipline (a flag to signal to the kernel that a TTY is of a specific known type and requires a driver to work) configured manually before the kernel takes over and acknowledges it as a CEC adapter. This cannot be done automatically [https://lwn.net/Articles/700489/ due to limitations around serial device APIs], so it is currently best achieved with a [[udev rule]] paired with a [[systemd|systemd unit]] (as udev rules cannot launch long-running or forking processes) to run {{ic|inputattach --pulse8-cec ...}} when the device is plugged. This serial interface appears as device node {{ic|/dev/ttyACM''X''}}, and the ''inputattach'' utility is needed to set the line discipline and let the kernel drivers take over to create the {{ic|/dev/cec''X''}} device that will be needed later. This requires the {{Pkg|linuxconsole}} package. {{Note|Do not modify {{ic|@$devnode}} in the following rule, it is a udev string substitution.}} {{hc|/etc/udev/rules.d/pulse8-cec-autoattach.rules|2= SUBSYSTEM=="tty" ACTION=="add" ATTRS{manufacturer}=="Pulse-Eight" ATTRS{product}=="CEC Adapter" TAG+="systemd" ENV{SYSTEMD_WANTS}="pulse8-cec-attach@$devnode.service" }} {{hc|/etc/systemd/system/pulse8-cec-attach@.service|2= [Unit] # Should be called as "pulse8-cec-attach@-dev-ttyACM0.service" or similar Description=Configure USB Pulse-Eight serial device at %I ConditionPathExists=%I [Service] Type=forking # inputattach is built without systemd daemon support by default, so systemd will have to guess the PID. # https://sourceforge.net/p/linuxconsole/code/ci/a3366c0d5f82485e6aae7b005ec7a2d9a93bf458/tree/utils/inputattach.c#l1233 ExecStart=/usr/bin/inputattach --daemon --pulse8-cec %I }} However, USB device connections [https://docs.kernel.org/driver-api/usb/persist.html are usually reset when the system wakes up from sleep] ([https://docs.kernel.org/driver-api/usb/power-management.html a step known as reset-resume]) , meaning the serial connection will be lost if the computer is ever suspended, on top of serial connections usually hanging up on resume anyway. This means the above rule has to be triggered again somehow. Unfortunately, the {{ic|cdc_acm}} driver in charge of the {{ic|ttyACM*}} object that the above rule reacts to does not raise any uevent about the connection being reset and the line discipline being lost, and the rule cannot be hooked on the USB device directly. Instead, the most reliable way to get the used rule above to trigger again at the right time is to delete and recreate the {{ic|ttyACM*}} object [https://docs.kernel.org/admin-guide/abi-stable.html#abi-sys-bus-usb-devices-bconfigurationvalue by forcing the USB device to be reconfigured] when it resets. In order to react to this and ensure the the connection is reopened, udev can keep track of when the USB device is reset and enumerated, as evidenced by the {{ic|DEVNUM}} property being zeroed and later restored, and touching the {{ic|bConfigurationValue}} sysfs attribute. {{hc|/etc/udev/rules.d/pulse8-cec-autoattach.rules|2= SUBSYSTEM=="tty" ACTION=="add" ATTRS{manufacturer}=="Pulse-Eight" ATTRS{product}=="CEC Adapter" TAG+="systemd" ENV{SYSTEMD_WANTS}="pulse8-cec-attach@$devnode.service" # Force device to be reconfigured when reset after suspend, otherwise the ttyACM link is lost but udev will not notice. # A usb_dev_uevent with DEVNUM=000 is a sign that the device is being reset before enumeration. # Re-configuring causes ttyACM to be removed and re-added instead. SUBSYSTEM=="usb" ACTION=="change" ATTR{manufacturer}=="Pulse-Eight" ATTR{product}=="CEC Adapter" ENV{DEVNUM}=="000" ATTR{bConfigurationValue}=="1" ATTR{bConfigurationValue}="1" }} This essentially acts as if the USB adapter had been unplugged and re-plugged immediately upon coming out of sleep, ensuring the {{ic|1=SUBSYSTEM=="tty" ACTION=="add"}} rule from before gets to run again. This ensures that the systemd service will be restarted as soon as the device is back to a usable state. == Software setup == === CEC subsystem configuration === Now that the CEC subsystem has something to bind on and that {{ic|/dev/cec0}} has been created, it is now possible to configure the PC so other CEC devices know about it. When using the command-line, CEC devices are normally controlled via {{ic|cec-ctl}}, which is part of {{Pkg|v4l-utils}}. One thing to be aware of is that the CEC pin alone does not have enough information on its own to send a valid CEC message. A CEC adapter that only monitors pin 13 (CEC) cannot know its "physical address" (its position in terms of port numbers in the "tree" of HDMI devices, such as {{ic|3.1.0.0}}), which it needs to be aware of in order to complete the logical address allocation procedure. Without a logical address, a device can only receive and send broadcast messages. The physical address is communicated over pin 16 (DDC/EDID), so configuring the CEC subsystem includes specifying which display output port is supposed to be associated with with that CEC object, in order for the physical address to be extracted from the display's EDID. One way to find the name of the active connectors is to use {{ic|xrandr --query}} (which also works on Wayland): {{hc|$ xrandr --query | Screen 0: minimum 16 x 16, current 3840 x 2160, maximum 32767 x 32767 DP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 600mm x 340mm 3840x2160 59.98*+ 2048x1536 59.95 ... HDMI-A-1 connected 3840x2160+0+0 (normal left inverted right x axis y axis) 1440mm x 810mm 3840x2160 59.98*+ 2048x1536 59.95 ... }} Once the correct port has been identified (for example {{ic|HDMI-A-1}}), then the sysfs port name can be found by using {{ic|ls -1d /sys/class/drm/card*-HDMI-A-1}} (such as {{ic|card1-HDMI-A-1}}). In this case, the corresponding display's EDID data would be kept at {{ic|/sys/class/drm/card1-HDMI-A-1/edid}}. The physical address can be previewed like this: {{hc|$ edid-decode --physical-address /sys/class/drm/card1-DP-3/edid|2= 4.0.0.0 }} Given how CEC configuration must be performed every time the {{ic|cec}} device node is re-created, this is best handled with another udev rule that fires when the {{ic|cec}} object appears. {{Note|Be sure to replace {{ic|card1-HDMI-A-1}} in the following rule by your connector name.}} {{hc|/etc/udev/rules.d/cec-configure-autostart.rules|2= SUBSYSTEM=="cec" KERNEL=="cec0" ACTION=="add" TAG+="systemd" ENV{SYSTEMD_WANTS}="cec0-configure@card1-HDMI-A-1.service" }} {{hc|/etc/systemd/system/cec0-configure@.service|2= [Unit] # Should be called as "cec0-configure@card1-HDMI-A-1.service" or similar Description=Configure CEC adapter cec0 assuming it runs on output %i AssertPathExists=/sys/class/drm/%i/edid BindsTo=dev-cec0.device [Service] Type=exec # --phys-addr-from-edid-poll checks EDID every tenth of a second # https://git.linuxtv.org/v4l-utils.git/tree/utils/cec-ctl/cec-ctl.cpp?id=0a195181d771090f3c99d4a6ddb8151352509061#n1977 # Use `Type=oneshot` if using `--phys-addr-from-edid` instead ExecStart=/usr/bin/cec-ctl --device=0 "--osd-name=%H" --playback "--phys-addr-from-edid-poll=/sys/class/drm/%i/edid" }} There are three device classes that an HDMI source can try to advertise itself as, which are "Recording device" (3 max), "Tuner" (4 max) and "Playback device" (3 max). This is important because HDMI devices do not use their physical address when communicating with each other over CEC, but a 4 bit "logical address", which identify devices as "Tuner #3" or "Playback Device #1", with a finite number of each. If address allocation fails because too many devices of one type are present, it may be assigned the "Backup" (2 max) role instead. These roles are intended to relate to the [[#Features|CEC features]] mentioned earlier, namely: * "Tuner" is supposed to support "Tuner Control" * "Recording device" is the only type that can use One Touch Record, as TVs are supposed to ignore related messages coming from other addresses * "Playback device" is for general purpose video sources. Computers, like video game consoles, are considered "Playback devices". The above {{ic|cec0-configure@.service}} unit uses {{ic|--playback}} to configure a Playback device. It is, however, generally OK to set the device class to Tuner ({{ic|--tuner}}) or Recorder ({{ic|--record}}), whether because there are no more unused playback addresses, or simply to have the PC stand out in the list on TVs that visually set apart each device class in their input menus. === Input-handling daemons === * {{AUR|cecdaemon-git}} * {{AUR|libcec-daemon-git}} === Userspace tools === User access to {{ic|/dev/cec*}} devices can be granted by enrolling users into the {{ic|video}} [[user group]]. The basic tool for controlling CEC devices is {{ic|cec-ctl}} from {{Pkg|v4l-utils}}. A similar one is {{ic|cec-client}} from {{Pkg|libcec}}, for which there are also Python bindings available in {{AUR|python-cec}}. == See also == * [https://docs.kernel.org/admin-guide/media/cec.html Kernel documentation for the CEC subsystem] * [https://elinux.org/CEC_(Consumer_Electronics_Control)_over_HDMI CEC (Consumer Electronics Control) over HDMI], in Embedded Linux Wiki (eLinux.org) * [https://www.youtube.com/watch?v=Q6S2FabX2WA HDMI CEC: What? Why? How?], by Hans Verkuil, who wrote most of the CEC subsystem * [https://www.cec-o-matic.com/ CEC-O-Matic], which allows to create raw CEC messages and gives an overview of what makes up a valid CEC frame
このページで使用されているテンプレート:
テンプレート:AUR
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
テンプレート:Tip
(
ソースを閲覧
)
HDMI-CEC
に戻る。
検索
検索
HDMI-CECのソースを表示
話題を追加