jbree / homebridge-cec-accessory

Homebridge support for CEC devices over HDMI
MIT License
19 stars 6 forks source link

`Error: cec-client never reported ready` even though `cec-client` works on CLI fine #19

Open jvacek opened 2 years ago

jvacek commented 2 years ago

I'm in a spot where I cannot get this to run properly, even though I am perfectly able to control my TV via CEC on the command line.

This was not an issue for me in my previous setup which had the exact same everything, except for the image my Raspberry pi was running. I have switched from the RetroPi image to the Homebridge image and since doing this, I've been having issues. I have migrated using the backup/restore procedure.

I have also tried https://github.com/electroflame/homebridge-cec-tv-control just to see if the CEC works there; it works just fine.

I tried restarting homebride, running with and without a child bridge, reinstalling, clearing the caches, and so far I have nothing.

Here's the output from Homebridge logs:

[05/11/2022, 13:52:14] [homebridge-cec-accessory] This plugin slows down Homebridge. The read handler for the characteristic 'On' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[05/11/2022, 13:52:20] [homebridge-cec-accessory] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[05/11/2022, 13:52:20] [TV CEC] getOn: 224
[05/11/2022, 13:52:29] [TV CEC] Error: cec-client never reported ready
    at Timeout._onTimeout (/var/lib/homebridge/node_modules/homebridge-cec-accessory/node_modules/cec-promise/index.js:16:12)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[05/11/2022, 13:52:29] [TV CEC] Error: cec-client never reported ready
    at Timeout._onTimeout (/var/lib/homebridge/node_modules/homebridge-cec-accessory/node_modules/cec-promise/index.js:16:12)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[05/11/2022, 13:52:29] [TV CEC] Error: cec-client never reported ready
    at Timeout._onTimeout (/var/lib/homebridge/node_modules/homebridge-cec-accessory/node_modules/cec-promise/index.js:16:12)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[05/11/2022, 13:52:29] [TV CEC] Error: cec-client never reported ready
    at Timeout._onTimeout (/var/lib/homebridge/node_modules/homebridge-cec-accessory/node_modules/cec-promise/index.js:16:12)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[05/11/2022, 13:52:45] [TV CEC] getOn: 224

Sometimes it turns to this instead:

[05/11/2022, 14:41:50] [TV CEC] getOn: 224
[05/11/2022, 14:41:53] [TV CEC] Error: No REPORT_POWER_STATUS received after 3000ms
    at Timeout._onTimeout (/var/lib/homebridge/node_modules/homebridge-cec-accessory/node_modules/cec-promise/index.js:67:23)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[05/11/2022, 14:42:05] [TV CEC] getOn: 224
[05/11/2022, 14:42:08] [TV CEC] Error: No REPORT_POWER_STATUS received after 3000ms
    at Timeout._onTimeout (/var/lib/homebridge/node_modules/homebridge-cec-accessory/node_modules/cec-promise/index.js:67:23)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

Here is some info from the system:

pi@homebridge:~ $ cec-client -i
libCEC version: 6.0.2, compiled on Linux-5.10.63-v8+ ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, Linux, AOCEC
pi@homebridge:~ $ ls -lah /dev/vchiq
crw-rw---- 1 root video 240, 0 Nov  5 13:51 /dev/vchiq
pi@homebridge:~ $ groups homebridge
homebridge : homebridge dialout audio video input render bluetooth spi i2c gpio
pi@homebridge:~ $ sudo lsof /dev/vchiq
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
cec-clien 4787   pi    3u   CHR  240,0      0t0  130 /dev/vchiq

I can connect to the CEC only after killing this process: image

Here is what it looks like after killing the process in htop

pi@homebridge:~ $ echo 'scan' | cec-client -d 1
log level set to 1
No device type given. Using 'recording device'
CEC Parser created - libCEC version 6.0.2
no serial port given. trying autodetect:
 path:     /sys/devices/platform/soc/fef00700.hdmi/cec0
 com port: /dev/cec0

opening a connection to the CEC adapter...
ERROR:   [              84] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [              84] could not open a connection (try 1)
ERROR:   [            1084] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            1084] could not open a connection (try 2)
ERROR:   [            2084] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            2084] could not open a connection (try 3)
ERROR:   [            3084] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            3084] could not open a connection (try 4)
ERROR:   [            4084] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            4084] could not open a connection (try 5)
ERROR:   [            5084] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            5084] could not open a connection (try 6)
ERROR:   [            6084] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            6084] could not open a connection (try 7)
ERROR:   [            7084] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            7084] could not open a connection (try 8)
ERROR:   [            8085] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            8085] could not open a connection (try 9)
ERROR:   [            9085] CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=16
ERROR:   [            9085] could not open a connection (try 10)
unable to open the device on port /dev/cec0
ERROR:   [           10085] could not start CEC communications
pi@homebridge:~ $ sudo htop # ←-- process killed
pi@homebridge:~ $ echo 'scan' | cec-client -d 1
log level set to 1
No device type given. Using 'recording device'
CEC Parser created - libCEC version 6.0.2
no serial port given. trying autodetect:
 path:     /sys/devices/platform/soc/fef00700.hdmi/cec0
 com port: /dev/cec0

opening a connection to the CEC adapter...
waiting for input
requesting CEC bus information ...
CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: yes
vendor:        LG
osd string:    TV
CEC version:   1.3a
power status:  on
language:      eng

device #1: Recorder 1
address:       2.0.0.0
active source: no
vendor:        LG
osd string:    CECTester
CEC version:   1.3a
power status:  on
language:      eng

currently active source: TV (0)
^Csignal caught: 2 - exiting

pi@homebridge:~ $ echo 'volup 0.0.0.0' | cec-client -s -d 1
opening a connection to the CEC adapter...
volume up: 7F
jbree commented 2 years ago

I no longer use this and have no way of testing to try to help with a fix.

Sure seems like you were on the right track with the group permissions thing. Maybe your RPi migration did something funky with the user/groups?

Sorry I can't provide any help. I hope you find a way to get this up and running. I'm happy to accept a PR or hand over the repo to someone who wants to maintain it.

jbree commented 2 years ago

Maybe next steps try the upstream dependency node-cec package in a test node app and see if that works from a different user to narrow the problem.