Registered User No edit summary |
Registered User m (→How to use CEC framework: fix board template) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
As an example, it allows the control of a recorder through TV remote control. | As an example, it allows the control of a recorder through TV remote control. | ||
The CEC protocol is defined in the HDMI specification. | The CEC protocol is defined in the HDMI specification. This article gives information about the Linux<sup>®</sup> CEC framework. | ||
== Purpose == | == Purpose == | ||
Line 37: | Line 37: | ||
===Description of the APIs=== | ===Description of the APIs=== | ||
The CEC kernel API is documented in the 'CEC kernel support' section of the Linux Kernel documentation<ref> | The CEC kernel API is documented in the 'CEC kernel support' section of the Linux Kernel documentation<ref>{{DocSource | domain=Linux kernel | path=media/kapi/cec-core.html | text=Linux CEC Kernel Support}}</ref>. | ||
The CEC Userland API is documented in the 'Consumer Electronics Control API of v4l-utils documentation<ref>[https://www.linuxtv.org/downloads/v4l-dvb-apis-new/ | The CEC Userland API is documented in the 'Consumer Electronics Control API of v4l-utils documentation<ref>[https://www.linuxtv.org/downloads/v4l-dvb-apis-new/userspace-api/cec/cec-api.html CEC Userland API]</ref>. | ||
==Configuration== | ==Configuration== | ||
Line 56: | Line 56: | ||
To register a CEC device on CEC bus, set its type and physical address: | To register a CEC device on CEC bus, set its type and physical address: | ||
{{Board$}} cec-ctl --tuner -p 1.0.0.0 | |||
<pre> | <pre> | ||
Driver Info: | Driver Info: | ||
Driver Name : stm32-cec | Driver Name : stm32-cec | ||
Line 86: | Line 86: | ||
To debug and monitor CEC messages on bus, use the following command line: | To debug and monitor CEC messages on bus, use the following command line: | ||
{{Board$}} cec-ctl -M | |||
<pre> | <pre> | ||
Driver Info: | Driver Info: | ||
Driver Name : stm32-cec | Driver Name : stm32-cec | ||
Line 120: | Line 120: | ||
Run CEC compliance to check CEC bus typology: | Run CEC compliance to check CEC bus typology: | ||
{{Board$}} cec-compliance -A | |||
<pre> | <pre> | ||
cec-compliance SHA : not available | cec-compliance SHA : not available | ||
Line 187: | Line 187: | ||
Send a string to OSD: | Send a string to OSD: | ||
{{Board$}} cec-ctl --set-osd-string=disp-ctl=0x00,osd="hello" --to tv | |||
<pre> | <pre> | ||
Driver Info: | Driver Info: | ||
Driver Name : stm32-cec | Driver Name : stm32-cec | ||
Line 224: | Line 224: | ||
Get topology: | Get topology: | ||
{{Board$}} cec-ctl -S | |||
<pre> | <pre> | ||
Driver Info: | Driver Info: | ||
Driver Name : stm32-cec | Driver Name : stm32-cec | ||
Line 268: | Line 268: | ||
Send a standby message to a tv: | Send a standby message to a tv: | ||
{{Board$}} cec-ctl --standby --to tv | |||
<pre> | <pre> | ||
Driver Info: | Driver Info: | ||
Driver Name : stm32-cec | Driver Name : stm32-cec |
Latest revision as of 17:34, 30 November 2020
CEC (Consumer Electronics Control) provides enhanced functions to control devices connected through HDMI.
As an example, it allows the control of a recorder through TV remote control.
The CEC protocol is defined in the HDMI specification. This article gives information about the Linux® CEC framework.
1. Purpose[edit source]
The purpose of this article is to introduce the CEC framework:
- General information
- Main components/stakeholders
- How to use the CEC framework
- Use cases
CEC is an HDMI feature designed to command and control devices connected through HDMI by using only one remote control. As an example, the remote control of a television set can be used to control a set-top box and a DVD player. Up to 15 devices can be controlled. CEC also allows individual CEC-enabled devices to command and control each other without user intervention.[1]
2. CEC overview[edit source]
2.1. Description of the main components[edit source]
From user space to hardware
- CEC tools (User space)
This component contains a set of useful tools to configure CEC features. It is hosted in v4l-utils [2].
- CEC core (Kernel space)
CEC core is the standard Linux kernel CEC framework. It manages the CEC protocol.
- stm32-cec (Kernel space)
This is the ST CEC Linux driver that handles the CEC hardware block.
- CEC (Hardware)
This is ST microprocessor CEC hardware block.
2.2. Description of the APIs[edit source]
The CEC kernel API is documented in the 'CEC kernel support' section of the Linux Kernel documentation[3].
The CEC Userland API is documented in the 'Consumer Electronics Control API of v4l-utils documentation[4].
3. Configuration[edit source]
By default, CEC is deactivated in ST deliveries. However, you can use Linux Menuconfig tool if a specific configuration is required: Menuconfig or how to configure kernel then select:
HDMI-CEC support [*] CEC platform devices ---> [*] STMicroelectronics STM32 HDMI-CEC driver[*] Device Drivers ---> [*] Multimedia support ---> [*]
4. How to use CEC framework[edit source]
cec-ctl and cec-compliance tools are hosted in CEC tools use space.
To register a CEC device on CEC bus, set its type and physical address:
cec-ctl --tuner -p 1.0.0.0
CEC Version : 2.0 Vendor ID : 0x000c03 (HDMI) OSD Name : 'Tuner' Logical Addresses : 1 (Allow RC Passthrough) Logical Address : 3 (Tuner 1) Primary Device Type : Tuner Logical Address Type : Tuner All Device Types : Tuner RC TV Profile : None Device Features : NoneDriver Info: Driver Name : stm32-cec Adapter Name : stm32-cec Capabilities : 0x000000ef Physical Address Logical Addresses Transmit Passthrough Monitor All Driver version : 4.19.9 Available Logical Addresses: 4 Physical Address : 1.0.0.0 Logical Address Mask : 0x0008
To debug and monitor CEC messages on bus, use the following command line:
cec-ctl -M
CEC Version : 2.0 Vendor ID : 0x000c03 (HDMI) OSD Name : 'Tuner' Logical Addresses : 1 (Allow RC Passthrough) Logical Address : 3 (Tuner 1) Primary Device Type : Tuner Logical Address Type : Tuner All Device Types : Tuner RC TV Profile : None Device Features : None Initial Event: State Change: PA: 1.0.0.0, LA mask: 0x000Driver Info: Driver Name : stm32-cec Adapter Name : stm32-cec Capabilities : 0x000000ef Physical Address Logical Addresses Transmit Passthrough Monitor All Driver version : 4.19.9 Available Logical Addresses: 4 Physical Address : 1.0.0.0 Logical Address Mask : 0x0008
Run CEC compliance to check CEC bus typology:
cec-compliance -A
SHA : not available Driver Info: Driver Name : stm32-cec Adapter Name : stm32-cec Capabilities : 0x000000ef Physical Address Logical Addresses Transmit Passthrough Monitor All Driver version : 4.19.9 Available Logical Addresses: 4 Physical Address : 1.0.0.0 Logical Address Mask : 0x0008 CEC Version : 2.0 Vendor ID : 0x000c03 Logical Addresses : 1 (Allow RC Passthrough) Logical Address : 3 Primary Device Type : Tuner Logical Address Type : Tuner All Device Types : Tuner RC TV Profile : None Device Features : None Compliance test for device /dev/cec0: The test results mean the following: OK Supported correctly by the device. OK (Not Supported) Not supported and not mandatory for the device. OK (Presumed) Presumably supported. Manually check to confirm. OK (Unexpected) Supported correctly but is not expected to be supported for this device. OK (Refused) Supported by the device, but was refused. FAIL Failed and was expected to be supported by this device. Find remote devices: Polling: OK CEC API: CEC_ADAP_G_CAPS: OK CEC_DQEVENT: OK CEC_ADAP_G/S_PHYS_ADDR: OK CEC_ADAP_G/S_LOG_ADDRS: OK CEC_TRANSMIT: OK CEC_RECEIVE: OK CEC_TRANSMIT/RECEIVE (non-blocking): OK (Presumed) CEC_G/S_MODE: OK CEC_EVENT_LOST_MSGS: OK Network topology: System Information for device 0 (TV) from device 3 (Tuner 1): CEC Version : 1.4 Physical Address : 0.0.0.0 Primary Device Type : TV Vendor ID : 0x00903e OSD Name : 'TV' Menu Language : fre Power Status : On Total: 10, Succeeded: 10, Failed: 0, Warnings: 0cec-compliance
Send a string to OSD:
cec-ctl --set-osd-string=disp-ctl=0x00,osd="hello" --to tv
CEC Version : 2.0 Vendor ID : 0x000c03 (HDMI) OSD Name : 'Tuner' Logical Addresses : 1 (Allow RC Passthrough) Logical Address : 3 (Tuner 1) Primary Device Type : Tuner Logical Address Type : Tuner All Device Types : Tuner RC TV Profile : None Device Features : None Transmit from Tuner 1 to TV (3 to 0): CEC_MSG_SET_OSD_STRING (0x64): disp-ctl: default (0x00) osd: hello Sequence: 347 Tx Timestamp: 2626.350sDriver Info: Driver Name : stm32-cec Adapter Name : stm32-cec Capabilities : 0x000000ef Physical Address Logical Addresses Transmit Passthrough Monitor All Driver version : 4.19.9 Available Logical Addresses: 4 Physical Address : 1.0.0.0 Logical Address Mask : 0x0008
Get topology:
cec-ctl -S
CEC Version : 2.0 Vendor ID : 0x000c03 (HDMI) OSD Name : 'Tuner' Logical Addresses : 1 (Allow RC Passthrough) Logical Address : 3 (Tuner 1) Primary Device Type : Tuner Logical Address Type : Tuner All Device Types : Tuner RC TV Profile : None Device Features : None System Information for device 0 (TV) from device 3 (Tuner 1): CEC Version : 1.4 Physical Address : 0.0.0.0 Primary Device Type : TV Vendor ID : 0x00903e (Philips) OSD Name : TV Menu Language : fre Power Status : On Topology: 0.0.0.0: TV 1.0.0.0: Tuner 1Driver Info: Driver Name : stm32-cec Adapter Name : stm32-cec Capabilities : 0x000000ef Physical Address Logical Addresses Transmit Passthrough Monitor All Driver version : 4.19.9 Available Logical Addresses: 4 Physical Address : 1.0.0.0 Logical Address Mask : 0x0008
Send a standby message to a tv:
cec-ctl --standby --to tv
CEC Version : 2.0 Vendor ID : 0x000c03 (HDMI) OSD Name : 'Tuner' Logical Addresses : 1 (Allow RC Passthrough) Logical Address : 3 (Tuner 1) Primary Device Type : Tuner Logical Address Type : Tuner All Device Types : Tuner RC TV Profile : None Device Features : None Transmit from Tuner 1 to TV (3 to 0): CEC_MSG_STANDBY (0x36) Sequence: 371 Tx Timestamp: 2747.236sDriver Info: Driver Name : stm32-cec Adapter Name : stm32-cec Capabilities : 0x000000ef Physical Address Logical Addresses Transmit Passthrough Monitor All Driver version : 4.19.9 Available Logical Addresses: 4 Physical Address : 1.0.0.0 Logical Address Mask : 0x0008
5. Use cases[edit source]
Appplications must be added/developped in userland to support all the use cases related to CEC (eg recorder controled by TV remote control)
.
6. Generic source code location[edit source]
7. References[edit source]