Cec-client does not work on Nightly 9.8 / RPI 4B

  • It looks the cec-client in lates nightly 9.8's is compiled without RPi feature so it does not work anymore on RPi 4B.

    Please find the details below.


    Hardware: RPI 4B / 1 GB

    LG TV


    LE version:

    LibreELEC (community): nightly-20201024-636e32e (RPi4.arm)


    (LibreELEC-RPi4.arm-9.80-nightly-20201024-636e32e.tar)


    Upgraded from official 9.2.5 where the HDMI CEC was partially working, some comamnds did not work (maybe the TV issue), some working commands sometimes failed with Segmentation fault error


    On 9.2.5:


    LibreELEC (official): 9.2.5 (RPi4.arm)

    LibreELEC:~ # echo 'scan' | cec-client -s -d 1

    opening a connection to the CEC adapter...

    requesting CEC bus information ...

    CEC bus information

    ===================

    device #0: TV

    address: 0.0.0.0

    active source: no

    vendor: LG

    osd string: TV

    CEC version: 1.3a

    power status: on

    language: eng



    device #1: Recorder 1

    address: 1.0.0.0

    active source: no

    vendor: LG

    osd string: CECTester

    CEC version: 1.3a

    power status: on

    language: eng





    on 9.80:


    LibreELEC (community): nightly-20201024-636e32e (RPi4.arm)


    RPi feature is missing...


    LibreELEC:~/downloads # cec-client -l

    libCEC version: 4.0.7, compiled on 2020-10-24 09:04:10 by [email protected] on Linux 4.19.0-8-amd64 (x86_64), features: P8_USB, DRM, P8_detect, Linux

    Found devices: 1


    device: 1

    com port: Linux

    vendor id: 0000

    product id: 0000

    firmware version: 0

    type: Linux





    LibreELEC:~/downloads # echo 'scan' | cec-client -s -d 1

    opening a connection to the CEC adapter...

    ERROR: [ 60] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 60] could not open a connection (try 1)

    ERROR: [ 1060] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 1060] could not open a connection (try 2)

    ERROR: [ 2060] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 2060] could not open a connection (try 3)

    ERROR: [ 3060] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 3060] could not open a connection (try 4)

    ERROR: [ 4061] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 4061] could not open a connection (try 5)

    ERROR: [ 5061] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 5061] could not open a connection (try 6)

    ERROR: [ 6061] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 6062] could not open a connection (try 7)

    ERROR: [ 7062] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 7062] could not open a connection (try 8)

    ERROR: [ 8062] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 8062] could not open a connection (try 9)

    ERROR: [ 9063] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16

    ERROR: [ 9063] could not open a connection (try 10)

    unable to open the device on port Linux

    ERROR: [ 10063] could not start CEC communications





    On RaspberryPI OS 5.4.51-v7l+:


    cec-client works


    [email protected]:~/Downloads $ cec-client -l

    libCEC version: 4.0.4, compiled on Linux-4.15.0-48-generic ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC

    Found devices: 1


    device: 1

    com port: RPI

    vendor id: 2708

    product id: 1001

    firmware version: 1

    type: Raspberry Pi

  • LibreELEC master is using the linux kernel CEC framework instead of the old RPi firmware CEC support. Don't try to use libcec with RPi libs in parallel to that, this will interfere really badly.


    The error 16 you saw is caused by kodi running in the background and using the CEC adapter. If you stop kodi ("systemctl stop kodi") you can use cec-client as usual.


    so long,


    Hias

  • Thanks a lot for explanation, you are absolutely right.

    So that means if I wish to keep the Kodi running, I am now a bit limited regarding to CEC commands which can be sent to TV.

    It looks there are only 3 CEC built-in commands in Kodi: CECActivateSource, CECStandby and CECToggleState ( List of built-in functions - Official Kodi Wiki )


    I have tested all, kodi-send -a "CECActivateSource" worked fine, remaining commands did not work but I suppose it's due my old TV which is not fully compatible with all CEC commands.

    Thanks again for your quick reply.

  • LibreELEC also includes cec-ctl from the v4l-utils package, you could give that a try.


    I'm not really familiar with it (CEC with libcec/kodi works just fine here with my LG TV so I only did some very basic tests to check if cec-ctl works) but as that tool is written specifically for the linux kernel CEC framework there's some chance it might work better than cec-client/libcec.


    so long,


    Hias

  • Thanks for the hint, Hias, I can confirm cec-ctl works and can be used at the same time with Kodi, in my case at least for TV status monitoring and power on (all other commands, unfortunately including standby and power-off, are ignored by my 10 years old TV).


    Some examples, if someone else is interested:


    Show topology:

    LibreELEC:~ # cec-ctl -S

    Driver Info:

    Driver Name : vc4_hdmi

    Adapter Name : vc4

    Capabilities : 0x0000010e

    Logical Addresses

    Transmit

    Passthrough

    Connector Info

    Driver version : 5.9.0

    Available Logical Addresses: 1

    DRM Connector Info : card 0, connector 32

    Physical Address : 1.0.0.0

    Logical Address Mask : 0x0002

    CEC Version : 1.4

    Vendor ID : 0x001582 (Pulse-Eight)

    OSD Name : ''

    Logical Addresses : 1 (Allow Fallback to Unregistered)


    Logical Address : 1 (Recording Device 1)

    Primary Device Type : Record

    Logical Address Type : Record


    System Information for device 0 (TV) from device 1 (Recording Device 1):

    CEC Version : Tx, OK, Rx, Timeout

    Physical Address : Tx, OK, Rx, Timeout

    Vendor ID : 0x00e091 (LG)

    OSD Name : Tx, OK, Rx, Timeout

    Menu Language : kor

    Power Status : On


    Topology:


    1.0.0.0: Recording Device 1


    Power on:

    LibreELEC:~ # cec-ctl --user-control-pressed ui-cmd=power-on-function --to 0

    Driver Info:

    Driver Name : vc4_hdmi

    Adapter Name : vc4

    Capabilities : 0x0000010e

    Logical Addresses

    Transmit

    Passthrough

    Connector Info

    Driver version : 5.9.0

    Available Logical Addresses: 1

    DRM Connector Info : card 0, connector 32

    Physical Address : 1.0.0.0

    Logical Address Mask : 0x0002

    CEC Version : 1.4

    Vendor ID : 0x001582 (Pulse-Eight)

    OSD Name : ''

    Logical Addresses : 1 (Allow Fallback to Unregistered)


    Logical Address : 1 (Recording Device 1)

    Primary Device Type : Record

    Logical Address Type : Record



    Transmit from Recording Device 1 to TV (1 to 0):

    USER_CONTROL_PRESSED (0x44):

    ui-cmd: power-on-function (0x6d)

    Sequence: 178 Tx Timestamp: 654.417s



    Monitor CEC traffic:

    LibreELEC:~ # cec-ctl -m

    Driver Info:

    Driver Name : vc4_hdmi

    Adapter Name : vc4

    Capabilities : 0x0000010e

    Logical Addresses

    Transmit

    Passthrough

    Connector Info

    Driver version : 5.9.0

    Available Logical Addresses: 1

    DRM Connector Info : card 0, connector 32

    Physical Address : 1.0.0.0

    Logical Address Mask : 0x0002

    CEC Version : 1.4

    Vendor ID : 0x001582 (Pulse-Eight)

    OSD Name : ''

    Logical Addresses : 1 (Allow Fallback to Unregistered)


    Logical Address : 1 (Recording Device 1)

    Primary Device Type : Record

    Logical Address Type : Record




    Initial Event: State Change: PA: 1.0.0.0, LA mask: 0x0002, Conn Info: yes

    Received from TV to all (0 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Transmitted by Recording Device 1 to all (1 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Received from TV to all (0 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Transmitted by Recording Device 1 to all (1 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Received from TV to all (0 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Transmitted by Recording Device 1 to all (1 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Received from TV to all (0 to 15): STANDBY (0x36)

    Received from TV to all (0 to 15): STANDBY (0x36)

    Received from TV to all (0 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Transmitted by Recording Device 1 to all (1 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Received from TV to Recording Device 1 (0 to 1): GIVE_DEVICE_VENDOR_ID (0x8c)

    Transmitted by Recording Device 1 to all (1 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Received from TV to Recording Device 1 (0 to 1): VENDOR_COMMAND (0x89):

    vendor-specific-data: 0x01

    Transmitted by Recording Device 1 to TV (1 to 0): VENDOR_COMMAND (0x89):

    vendor-specific-data: 0x02 0x05

    Received from TV to Recording Device 1 (0 to 1): GIVE_DEVICE_POWER_STATUS (0x8f)

    Transmitted by Recording Device 1 to TV (1 to 0): REPORT_POWER_STATUS (0x90):

    pwr-state: to-on (0x02)

    Received from TV to Recording Device 1 (0 to 1): GIVE_PHYSICAL_ADDR (0x83)

    Transmitted by Recording Device 1 to all (1 to 15): REPORT_PHYSICAL_ADDR (0x84):

    phys-addr: 1.0.0.0

    prim-devtype: record (0x01)

    Received from TV to all (0 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

    Transmitted by Recording Device 1 to all (1 to 15): DEVICE_VENDOR_ID (0x87):

    vendor-id: 57489 (0x0000e091)

  • I see that you have got cec-ctl running on your RPI.


    On the generic nightly matrix image it is not there. Is there a reason for that? It would be good to have cec-ctl available on the Intel NUC.


    I was reading this reference. I have some issues with the way that my CEC environment behaves, and being able to pass though commands to the CEC devices would probably give me a good workaround.


    CEC-HDMI - UDOO X86 II Docs