I jumped from 3.0.1 libCEC to 4.0.4, so I tested, if its better. And I found, that (long term present) bug still appears when using CEC.
Configuration:
TV (0000) <–> AVR (2000)[Hdmi 2 on TV] <–> C2 (2100)[HDMI 1 on AVR].
When AVR switched off, it passthroughs HDMI signal from C2.
Default configuration, TV set ON, AVR OFF, source HDMI2.
When C2 is started, Its detected correctly as Playback device 1 (logical adress 4), get physicall adress 2100, CEC works.
11:36:57.495 T:3809579888 DEBUG: CecLogMessage - Playback 1 (4): device status changed into 'handled by libCEC'
11:36:57.495 T:3809579888 DEBUG: CecLogMessage - Playback 1 (4): power status changed from 'unknown' to 'on'
11:36:57.495 T:3809579888 DEBUG: CecLogMessage - Playback 1 (4): vendor = Pulse Eight (001582)
11:36:57.495 T:3809579888 DEBUG: CecLogMessage - Playback 1 (4): CEC version 1.4
11:36:57.495 T:3809579888 DEBUG: CecLogMessage - AllocateLogicalAddresses - device '0', type 'playback device', LA '4'
11:36:57.495 T:3809579888 DEBUG: CecLogMessage - Playback 1 (4): physical address changed from ffff to 2100
11:36:57.496 T:3809579888 DEBUG: CecLogMessage - Playback 1 (4): osd name set to 'Kodi'
11:36:57.496 T:3809579888 DEBUG: CecLogMessage - Playback 1 (4): menu language set to 'eng'
11:36:57.496 T:3809579888 DEBUG: CecLogMessage - physical address unchanged (2100)
But, when I switched TV to source TV, and then I switched back to HDMI2, CEC is lost. Logs shows, that routes go to 2000 instead of 2100.
11:40:10.041 T:3809579888 DEBUG: CecLogMessage - >> 0f:82:00:00
11:40:10.042 T:3809579888 DEBUG: CecLogMessage - making TV (0) the active source
11:40:10.043 T:3809579888 DEBUG: CecLogMessage - marking Playback 1 (4) as inactive source
11:40:10.043 T:3809579888 DEBUG: CecLogMessage - >> source deactivated: Playback 1 (4)
11:40:10.044 T:3809579888 DEBUG: CecLogMessage - >> TV (0) -> Broadcast (F): active source (82)
11:40:15.799 T:3809579888 DEBUG: CecLogMessage - >> 0f:80:00:00:20:00
11:40:15.799 T:3809579888 DEBUG: CecLogMessage - >> TV (0) -> Broadcast (F): routing change (80)
11:40:16.405 T:3809579888 DEBUG: CecLogMessage - >> 0f:86:20:00
11:40:16.405 T:3809579888 DEBUG: CecLogMessage - >> TV (0) sets stream path to physical address 2000
11:40:16.405 T:3809579888 DEBUG: CecLogMessage - >> TV (0) -> Broadcast (F): set stream path (86)
libcec on jeOS cant be setuped by logical adresses, no problem, we can setup physicall ones. The trouble is, that even I setuped this option to 2100
<setting id="physical_address" value="2100" />
it doesnt help. When I switched on TV from Playback device 1 to TV (ie other source than C2), and then back, I lost my CEC in case AVR is on the way (I dont expect this issue with direct connection TV-C2).
I tried also choose AVR and hdmi port 1 on Peripherals, doesnt help either.
I am suspecting this is problem within jeOS, because I noticed, even when user change psychical adress (and its written to CEC peripherals config file cec_CEC_Adapter.xml
first), after reboot, in jeOS OSD Peripherals is again default psychical adress value shown (greyed 0).
P.S.: Turn off and on TV doesnt cause this problem, if source is remained to HDMI2. The actual switching sources on TV seems to trigger this. Setting playback device as inactive source is correct, but there is some bug when set it again to active, in this particular configuration.