Pulse-Eight / libcec

USB CEC Adapter communication Library http://libcec.pulse-eight.com/
Other
707 stars 284 forks source link

cec-client only works if Pi is the only device connected to TV #548

Open gabaloliveira opened 3 years ago

gabaloliveira commented 3 years ago

Hardware

Software

pi@RaspberryPi:~ $ cec-client -l
libCEC version: 6.0.2, git revision: libcec-6.0.2+1-76551ea, compiled on 2020-12-10 15:08:36 by pi@RaspberryPi on Linux 5.4.79+ (armv6l), features: P8_USB, DRM, P8_detect, randr, RPi

Bug Description

cec-client works just fine if the Raspberry Pi is the only HDMI device connected to the TV. However, it stops working instantly after plugging in any HDMI device, and any command after that returns a "timeout" debug message.

All cec-client commands (power on, power off, change HDMI input, etc...) works with any HDMI cable I've tested so far, as long as the Pi is the only connected device.

Starting cec-client having only connected the Raspberry Pi (brand new HDMI cable):

pi@RaspberryPi:~ $ cec-client
No device type given. Using 'recording device'
CEC Parser created - libCEC version 6.0.2
no serial port given. trying autodetect:
 path:     Raspberry Pi
 com port: RPI

opening a connection to the CEC adapter...
DEBUG:   [             402]     Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [             414]     logical address changed to Free use (e)
DEBUG:   [             419]     Open - vc_cec initialised
NOTICE:  [             422]     connection opened
DEBUG:   [             429]     << Broadcast (F) -> TV (0): POLL
DEBUG:   [             429]     initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [             429]     << e0
DEBUG:   [             428]     processor thread started
DEBUG:   [             462]     >> POLL sent
DEBUG:   [             470]     TV (0): device status changed into 'present'
DEBUG:   [             475]     << requesting vendor ID of 'TV' (0)
TRAFFIC: [             478]     << e0:8c
TRAFFIC: [             670]     >> 0f:87:00:00:f0
DEBUG:   [             670]     TV (0): vendor = Samsung (0000f0)
DEBUG:   [             675]     >> TV (0) -> Broadcast (F): device vendor id (87)
DEBUG:   [             681]     expected response received (87: device vendor id)
DEBUG:   [             681]     replacing the command handler for device 'TV' (0)
DEBUG:   [             682]     registering new CEC client - v6.0.2
DEBUG:   [             682]     SetClientVersion - using client version '6.0.2'
NOTICE:  [             682]     setting HDMI port to 1 on device TV (0)
DEBUG:   [             683]     SetConfiguration: double tap timeout = 200ms, repeat rate = 0ms, release delay = 500ms
DEBUG:   [             683]     detecting logical address for type 'recording device'
DEBUG:   [             683]     trying logical address 'Recorder 1'
DEBUG:   [             683]     << Recorder 1 (1) -> Recorder 1 (1): POLL
TRAFFIC: [             683]     << 11
TRAFFIC: [             967]     << 11
DEBUG:   [            1238]     >> POLL not sent
DEBUG:   [            1238]     using logical address 'Recorder 1'
DEBUG:   [            1239]     Recorder 1 (1): device status changed into 'handled by libCEC'
DEBUG:   [            1239]     Recorder 1 (1): power status changed from 'unknown' to 'on'
DEBUG:   [            1239]     Recorder 1 (1): vendor = Pulse Eight (001582)
DEBUG:   [            1239]     Recorder 1 (1): CEC version 1.4
DEBUG:   [            1239]     AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
DEBUG:   [            1241]     logical address changed to Recorder 1 (1)
DEBUG:   [            1249]     Recorder 1 (1): osd name set to 'CECTester'
DEBUG:   [            1249]     Recorder 1 (1): menu language set to 'eng'
DEBUG:   [            1253]     GetPhysicalAddress - physical address = 4000
DEBUG:   [            1253]     using auto-detected physical address 4000
DEBUG:   [            1254]     Recorder 1 (1): physical address changed from ffff to 4000
DEBUG:   [            1254]     << Recorder 1 (1) -> broadcast (F): physical address 4000
TRAFFIC: [            1254]     << 1f:84:40:00:01
NOTICE:  [            1406]     CEC client registered: libCEC version = 6.0.2, client version = 6.0.2, firmware version = 1, logical address(es) = Recorder 1 (1) , physical address: 4.0.0.0, git revision: libcec-6.0.2+1-76551ea, compiled on 2020-12-10 15:08:36 by pi@RaspberryPi on Linux 5.4.79+ (armv6l), features: P8_USB, DRM, P8_detect, randr, RPi
DEBUG:   [            1406]     << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
TRAFFIC: [            1406]     << 10:47:43:45:43:54:65:73:74:65:72
DEBUG:   [            1707]     << requesting power status of 'TV' (0)
TRAFFIC: [            1708]     << 10:8f
waiting for input
TRAFFIC: [            1850]     >> 01:90:00
DEBUG:   [            1850]     TV (0): power status changed from 'unknown' to 'on'
DEBUG:   [            1851]     expected response received (90: report power status)
DEBUG:   [            1860]     >> TV (0) -> Recorder 1 (1): report power status (90)
scan
requesting CEC bus information ...
DEBUG:   [            8504]     << Recorder 1 (1) -> Recorder 2 (2): POLL
TRAFFIC: [            8507]     << 12
TRAFFIC: [            8601]     << 12
DEBUG:   [            8694]     >> POLL not sent
DEBUG:   [            8697]     Recorder 2 (2): device status changed into 'not present'
DEBUG:   [            8700]     << Recorder 1 (1) -> Tuner 1 (3): POLL
TRAFFIC: [            8707]     << 13
TRAFFIC: [            8801]     << 13
DEBUG:   [            8896]     >> POLL not sent
DEBUG:   [            8900]     Tuner 1 (3): device status changed into 'not present'
DEBUG:   [            8903]     << Recorder 1 (1) -> Playback 1 (4): POLL
TRAFFIC: [            8905]     << 14
TRAFFIC: [            8998]     << 14
DEBUG:   [            9093]     >> POLL not sent
DEBUG:   [            9096]     Playback 1 (4): device status changed into 'not present'
DEBUG:   [            9098]     << Recorder 1 (1) -> Audio (5): POLL
TRAFFIC: [            9101]     << 15
TRAFFIC: [            9194]     << 15
DEBUG:   [            9287]     >> POLL not sent
DEBUG:   [            9290]     Audio (5): device status changed into 'not present'
DEBUG:   [            9293]     << Recorder 1 (1) -> Tuner 2 (6): POLL
TRAFFIC: [            9295]     << 16
TRAFFIC: [            9389]     << 16
DEBUG:   [            9483]     >> POLL not sent
DEBUG:   [            9488]     Tuner 2 (6): device status changed into 'not present'
DEBUG:   [            9490]     << Recorder 1 (1) -> Tuner 3 (7): POLL
TRAFFIC: [            9493]     << 17
TRAFFIC: [            9586]     << 17
DEBUG:   [            9681]     >> POLL not sent
DEBUG:   [            9685]     Tuner 3 (7): device status changed into 'not present'
DEBUG:   [            9688]     << Recorder 1 (1) -> Playback 2 (8): POLL
TRAFFIC: [            9692]     << 18
TRAFFIC: [            9784]     << 18
DEBUG:   [            9879]     >> POLL not sent
DEBUG:   [            9885]     Playback 2 (8): device status changed into 'not present'
DEBUG:   [            9888]     << Recorder 1 (1) -> Recorder 3 (9): POLL
TRAFFIC: [            9893]     << 19
TRAFFIC: [            9990]     << 19
DEBUG:   [           10086]     >> POLL not sent
DEBUG:   [           10093]     Recorder 3 (9): device status changed into 'not present'
DEBUG:   [           10096]     << Recorder 1 (1) -> Tuner 4 (A): POLL
TRAFFIC: [           10100]     << 1a
TRAFFIC: [           10194]     << 1a
DEBUG:   [           10289]     >> POLL not sent
DEBUG:   [           10294]     Tuner 4 (A): device status changed into 'not present'
DEBUG:   [           10299]     << Recorder 1 (1) -> Playback 3 (B): POLL
TRAFFIC: [           10301]     << 1b
TRAFFIC: [           10396]     << 1b
DEBUG:   [           10493]     >> POLL not sent
DEBUG:   [           10495]     Playback 3 (B): device status changed into 'not present'
DEBUG:   [           10500]     << Recorder 1 (1) -> Reserved 1 (C): POLL
TRAFFIC: [           10503]     << 1c
TRAFFIC: [           10597]     << 1c
DEBUG:   [           10693]     >> POLL not sent
DEBUG:   [           10697]     Reserved 1 (C): device status changed into 'not present'
DEBUG:   [           10700]     << Recorder 1 (1) -> Reserved 2 (D): POLL
TRAFFIC: [           10702]     << 1d
TRAFFIC: [           10799]     << 1d
DEBUG:   [           10893]     >> POLL not sent
DEBUG:   [           10896]     Reserved 2 (D): device status changed into 'not present'
DEBUG:   [           10899]     << Recorder 1 (1) -> Free use (E): POLL
TRAFFIC: [           10901]     << 1e
TRAFFIC: [           10995]     << 1e
DEBUG:   [           11090]     >> POLL not sent
DEBUG:   [           11094]     Free use (E): device status changed into 'not present'
DEBUG:   [           11098]     << requesting active source
TRAFFIC: [           11101]     << 1f:85
TRAFFIC: [           11268]     >> 0f:82:00:00
DEBUG:   [           11268]     making TV (0) the active source
DEBUG:   [           11274]     >> TV (0) -> Broadcast (F): active source (82)
DEBUG:   [           11277]     expected response received (82: active source)
DEBUG:   [           11278]     << requesting CEC version of 'TV' (0)
TRAFFIC: [           11278]     << 10:9f
TRAFFIC: [           11435]     >> 01:9e:05
DEBUG:   [           11435]     TV (0): CEC version 1.4
DEBUG:   [           11435]     expected response received (9E: cec version)
DEBUG:   [           11436]     << requesting menu language of 'TV' (0)
TRAFFIC: [           11436]     << 10:91
DEBUG:   [           11441]     >> TV (0) -> Recorder 1 (1): cec version (9E)
CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: yes
vendor:        Samsung
osd string:    TV
CEC version:   1.4
power status:  on
language:      por

device #1: Recorder 1
address:       4.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng

currently active source: TV (0)
TRAFFIC: [           11632]     >> 0f:32:70:6f:72
DEBUG:   [           11633]     TV (0): menu language set to 'por'
DEBUG:   [           11633]     expected response received (32: set menu language)
DEBUG:   [           11640]     >> TV (0) -> Broadcast (F): set menu language (32)

Without killing cec-client, and after plugging in a Wii U (using the boxed Nintendo HDMI cable):

[....]
currently active source: TV (0)
TRAFFIC: [           11632]     >> 0f:32:70:6f:72
DEBUG:   [           11633]     TV (0): menu language set to 'por'
DEBUG:   [           11633]     expected response received (32: set menu language)
DEBUG:   [           11640]     >> TV (0) -> Broadcast (F): set menu language (32)
######
scan
requesting CEC bus information ...
DEBUG:   [           76280]     << requesting power status of 'TV' (0)
TRAFFIC: [           76282]     << 10:8f
**DEBUG:   [           77287]     command 'give device power status' timeout**
TRAFFIC: [           77789]     << 10:8f
DEBUG:   [           77817]     TV (0): power status changed from 'on' to 'unknown'
CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: yes
vendor:        Samsung
osd string:    TV
CEC version:   1.4
power status:  unknown
language:      por

device #1: Recorder 1
address:       4.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng

currently active source: TV (0)
standby 0 # Does not work
NOTICE:  [          107744]     << putting 'TV' (0) in standby mode
TRAFFIC: [          107744]     << 10:36
TRAFFIC: [          107746]     << 10:36

Same session, after unplugging the Wii U:

[...] 
TRAFFIC: [          107744]     << 10:36
TRAFFIC: [          107746]     << 10:36
######
TRAFFIC: [          141914]     >> 01:90:00
DEBUG:   [          141914]     TV (0): power status changed from 'unknown' to 'on'
DEBUG:   [          141915]     >> TV (0) -> Recorder 1 (1): report power status (90)

standby 0 # TV powers off
NOTICE:  [          155873]     << putting 'TV' (0) in standby mode
TRAFFIC: [          155875]     << 10:36
TRAFFIC: [          156123]     >> 0f:36
DEBUG:   [          156123]     TV (0): power status changed from 'on' to 'standby'
DEBUG:   [          156129]     >> TV (0) -> Broadcast (F): standby (36)
TRAFFIC: [          156192]     >> 0f:36
on 0 # TV powers on
NOTICE:  [          159218]     << powering on 'TV' (0)
TRAFFIC: [          159219]     << 10:04
DEBUG:   [          159283]     TV (0): power status changed from 'standby' to 'in transition from standby to on'
TRAFFIC: [          166525]     >> 0f:86:30:00
DEBUG:   [          166525]     >> TV (0) sets stream path to physical address 3000
DEBUG:   [          166526]     >> TV (0) -> Broadcast (F): set stream path (86)
TRAFFIC: [          169469]     >> 0f:80:00:00:30:00
DEBUG:   [          169470]     TV (0): power status changed from 'in transition from standby to on' to 'on'
DEBUG:   [          169475]     >> TV (0) -> Broadcast (F): routing change (80)
TRAFFIC: [          169585]     >> 0f:86:30:00
DEBUG:   [          169586]     >> TV (0) sets stream path to physical address 3000
DEBUG:   [          169591]     >> TV (0) -> Broadcast (F): set stream path (86)
TRAFFIC: [          169659]     >> 01:8c
DEBUG:   [          169660]     << Recorder 1 (1) -> TV (0): vendor id Pulse Eight (1582)
TRAFFIC: [          169660]     << 1f:87:00:15:82
DEBUG:   [          169666]     >> TV (0) -> Recorder 1 (1): give device vendor id (8C)
TRAFFIC: [          169861]     >> 01:8f
DEBUG:   [          169861]     << Recorder 1 (1) -> TV (0): on
TRAFFIC: [          169862]     << 10:90:00
DEBUG:   [          169863]     >> TV (0) -> Recorder 1 (1): give device power status (8F)
TRAFFIC: [          170038]     >> 01:83
DEBUG:   [          170038]     << Recorder 1 (1) -> broadcast (F): physical address 4000
TRAFFIC: [          170038]     << 1f:84:40:00:01
DEBUG:   [          170044]     >> TV (0) -> Recorder 1 (1): give physical address (83)
TRAFFIC: [          170239]     >> 01:46
DEBUG:   [          170240]     << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
TRAFFIC: [          170240]     << 10:47:43:45:43:54:65:73:74:65:72
DEBUG:   [          170246]     >> TV (0) -> Recorder 1 (1): give osd name (46)
TRAFFIC: [          170701]     >> 01:a0:00:00:f0:23
TRAFFIC: [          170701]     << 10:a0:00:00:f0:24:00:80
DEBUG:   [          170707]     >> TV (0) -> Recorder 1 (1): vendor command with id (A0)
TRAFFIC: [          170978]     >> 01:9f
DEBUG:   [          170979]     << Recorder 1 (1) -> TV (0): cec version 1.4
TRAFFIC: [          170979]     << 10:9e:05
DEBUG:   [          170984]     >> TV (0) -> Recorder 1 (1): get cec version (9F)
TRAFFIC: [          171461]     >> 0f:80:30:00:30:00
DEBUG:   [          171467]     >> TV (0) -> Broadcast (F): routing change (80)
scan
requesting CEC bus information ...
DEBUG:   [          495684]     << requesting power status of 'TV' (0)
TRAFFIC: [          495687]     << 10:8f
DEBUG:   [          495751]     expected response received (90: report power status)
CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: yes
vendor:        Samsung
osd string:    TV
CEC version:   1.4
power status:  on
language:      por

device #1: Recorder 1
address:       4.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng

currently active source: TV (0)
TRAFFIC: [          495831]     >> 01:90:00
DEBUG:   [          495834]     >> TV (0) -> Recorder 1 (1): report power status (90)

Plugging in a PS4 Pro (brand new HDMI cable):

[...]
TRAFFIC: [          495831]     >> 01:90:00
DEBUG:   [          495834]     >> TV (0) -> Recorder 1 (1): report power status (90)
######
TRAFFIC: [          558529]     >> 0f:80:30:00:20:00
DEBUG:   [          558530]     >> TV (0) -> Broadcast (F): routing change (80)
scan
requesting CEC bus information ...
DEBUG:   [          568826]     << requesting power status of 'TV' (0)
TRAFFIC: [          568830]     << 10:8f
DEBUG:   [          569834]     command 'give device power status' timeout
TRAFFIC: [          570336]     << 10:8f
DEBUG:   [          570365]     TV (0): power status changed from 'on' to 'unknown'
CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: yes
vendor:        Samsung
osd string:    TV
CEC version:   1.4
power status:  unknown
language:      por

device #1: Recorder 1
address:       4.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng

currently active source: TV (0)
standby 0 #does not work
NOTICE:  [          585472]     << putting 'TV' (0) in standby mode
TRAFFIC: [          585476]     << 10:36
TRAFFIC: [          585479]     << 10:36

I've already tried with 5+ different HDMI cables (bought 3 different cables just to be sure), power cycling the TV, unplugging the power cord for 3+ hours...

9000h commented 3 years ago

the rpi 1 has a hardware issue

From http://www.raspberrypi.org/archives/1929 -
Some users have found that connecting an unpowered Raspberry Pi to an HDMI television interferes
with the correct operation of CEC for other connected devices. This was fixed on some later revision 1.0 PCBs
by removing the ESD protection diode D14; revision 2.0 fixes this issue by connecting the top side of the diode to +5V0_HDMI.