Pulse-Eight / libcec

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

Segmentation fault - raspberry 4 #577

Closed sfoglia closed 2 years ago

sfoglia commented 2 years ago

Basicaly I'm trying to debug why kodi cec support seems to not work anymore with my TV and ended here.

HW: raspberry pi 4 4GB SW: raspberry pi os

Linux PItv 5.10.52-v7l+ #1440 SMP Tue Jul 27 09:55:21 BST 2021 armv7l GNU/Linux

I've followed: libcec/README.raspberrypi.md at master · Pulse-Eight/libcec · GitHub


    sudo apt-get update
    sudo apt-get install cmake libudev-dev libxrandr-dev python3-dev swig git
    cd
    git clone https://github.com/Pulse-Eight/platform.git
    mkdir platform/build
    cd platform/build
    cmake ..
    make
    sudo make install
    cd
    git clone https://github.com/Pulse-Eight/libcec.git
    mkdir libcec/build
    cd libcec/build
    cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..
    make -j4
    sudo make install
    sudo ldconfig
    sudo reboot

Now if I start: sudo cec-client -t p result in:

== using device type 'playback 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:   [              73] Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [              73] logical address changed to Free use (e)
DEBUG:   [              73] Open - vc_cec initialised
NOTICE:  [              73] connection opened
DEBUG:   [              74] processor thread started
DEBUG:   [              74] << Broadcast (F) -> TV (0): POLL
DEBUG:   [              74] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [              74] << e0
DEBUG:   [              74] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [              74] << e0
DEBUG:   [              75] >> POLL not sent
DEBUG:   [              75] TV (0): device status changed into 'not present'
DEBUG:   [              75] registering new CEC client - v6.0.2
DEBUG:   [              75] SetClientVersion - using client version '6.0.2'
NOTICE:  [              75] setting HDMI port to 1 on device TV (0)
DEBUG:   [              75] << Broadcast (F) -> TV (0): POLL
DEBUG:   [              75] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [              75] << e0
DEBUG:   [              75] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [              75] << e0
DEBUG:   [              75] >> POLL not sent
DEBUG:   [              75] SetConfiguration: double tap timeout = 200ms, repeat rate = 0ms, release delay = 500ms
DEBUG:   [              75] detecting logical address for type 'playback device'
DEBUG:   [              77] trying logical address 'Playback 1'
DEBUG:   [              77] << Playback 1 (4) -> Playback 1 (4): POLL
TRAFFIC: [              77] << 44
TRAFFIC: [            1609] << 44
DEBUG:   [            3142] >> POLL not sent
DEBUG:   [            3143] using logical address 'Playback 1'
DEBUG:   [            3143] Playback 1 (4): device status changed into 'handled by libCEC'
DEBUG:   [            3143] Playback 1 (4): power status changed from 'unknown' to 'on'
DEBUG:   [            3143] Playback 1 (4): vendor = Pulse Eight (001582)
DEBUG:   [            3143] Playback 1 (4): CEC version 1.4
DEBUG:   [            3143] logical address changed to Broadcast (f)
DEBUG:   [            3143] AllocateLogicalAddresses - device '0', type 'playback device', LA '4'
DEBUG:   [            4676] logical Broadcast (f) address lost
NOTICE:  [            4676] logical address f was taken by another device, allocating a new address
DEBUG:   [            4676] TV (0): device status changed into 'unknown'
DEBUG:   [            4676] << Playback 1 (4) -> TV (0): POLL
TRAFFIC: [            4676] << 40
DEBUG:   [            5677] command 'feature abort' timeout
TRAFFIC: [            6177] << 40
DEBUG:   [            6209] sending command 'feature abort' failed (4)
DEBUG:   [            6209] >> POLL not sent
DEBUG:   [            6209] TV (0): device status changed into 'not present'
DEBUG:   [            6209] logical address changed to Playback 1 (4)
WARNING: [            6209] unhandled response received: opcode=0 initiator=4 destination=0 response=3
DEBUG:   [            6209] logical address changed to Broadcast (f)
DEBUG:   [            6209] logical Broadcast (f) address lost
NOTICE:  [            6209] logical address f was taken by another device, allocating a new address
DEBUG:   [            6209] detecting logical address for type 'playback device'
DEBUG:   [            6209] trying logical address 'Playback 2'
DEBUG:   [            6209] << Playback 2 (8) -> Playback 2 (8): POLL
DEBUG:   [            6209] TV (0): device status changed into 'unknown'
TRAFFIC: [            6209] << 88
WARNING: [            6210] cannot find the primary device (logical address f)
ERROR:   [            6210] failed to register the CEC client: libCEC version = 6.0.2, client version = 6.0.2, firmware version = 1, base device: TV (0), HDMI port number: 1, physical address: f.f.f.f, git revision: libcec-6.0.2+1-76551ea, compiled on 2021-08-04 15:09:11 by pi@PItv on Linux 5.10.52-v7l+ (armv7l), features: P8_USB, DRM, P8_detect, randr, RPi
DEBUG:   [            6210] << Broadcast (F) -> TV (0): OSD name 'Broadcast'
TRAFFIC: [            7741] << 88
DEBUG:   [            9275] >> POLL not sent
DEBUG:   [            9275] using logical address 'Playback 2'
DEBUG:   [            9275] << Broadcast (F) -> TV (0): POLL
DEBUG:   [            9275] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [            9275] << e0
DEBUG:   [            9275] Playback 2 (8): device status changed into 'handled by libCEC'
DEBUG:   [            9275] Playback 2 (8): power status changed from 'unknown' to 'on'
DEBUG:   [            9275] << Broadcast (F) -> TV (0): POLL
DEBUG:   [            9275] Playback 2 (8): vendor = Pulse Eight (001582)
DEBUG:   [            9275] Playback 2 (8): CEC version 1.4
DEBUG:   [            9275] AllocateLogicalAddresses - device '0', type 'playback device', LA '8'
DEBUG:   [           10276] command 'feature abort' timeout
DEBUG:   [           10776] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [           10777] << e0
DEBUG:   [           11777] command 'feature abort' timeout
DEBUG:   [           12278] >> POLL not sent
DEBUG:   [           12278] TV (0): device status changed into 'not present'
DEBUG:   [           12278] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [           12278] << e0
DEBUG:   [           12278] not sending command 'set osd name': destination device 'TV' marked as not present
DEBUG:   [           12278] << requesting power status of 'TV' (0)
DEBUG:   [           13279] command 'feature abort' timeout
DEBUG:   [           13779] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [           13779] << e0
DEBUG:   [           14779] command 'feature abort' timeout
DEBUG:   [           15280] >> POLL not sent
DEBUG:   [           15280] << Broadcast (F) -> TV (0): POLL
DEBUG:   [           15280] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [           15280] << e0
DEBUG:   [           16281] command 'feature abort' timeout
DEBUG:   [           16781] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [           16782] << e0
DEBUG:   [           17783] command 'feature abort' timeout
DEBUG:   [           18284] >> POLL not sent
DEBUG:   [           18285] not sending command 'give device power status': destination device 'TV' marked as not present
ERROR:   [           18286] failed to register a CEC client
unable to open the device on port RPI
DEBUG:   [           18288] unregistering all CEC clients
NOTICE:  [           18289] unregistering client: libCEC version = 6.0.2, client version = 6.0.2, firmware version = 1, logical address(es) = Playback 2 (8) , base device: TV (0), HDMI port number: 1, physical address: f.f.f.f, git revision: libcec-6.0.2+1-76551ea, compiled on 2021-08-04 15:09:11 by pi@PItv on Linux 5.10.52-v7l+ (armv7l), features: P8_USB, DRM, P8_detect, randr, RPi
DEBUG:   [           18290] Playback 2 (8): power status changed from 'on' to 'unknown'
DEBUG:   [           18290] Playback 2 (8): vendor = Unknown (000000)
DEBUG:   [           18291] Playback 2 (8): CEC version unknown
DEBUG:   [           18291] Playback 2 (8): device status changed into 'unknown'
Segmentation fault

Found out this note:

warning not compatible with Kodi 18.x. Please use libCEC 4.0.7 instead.

So I've recompiled, this version doesn't trow the Segmentation error but get stuck and from kodi still no control is available: https://github.com/Pulse-Eight/libcec/releases/tag/libcec-4.0.7


# sudo cec-client -t p
== using device type 'playback device'
CEC Parser created - libCEC version 4.0.7
no serial port given. trying autodetect: 
 path:     Raspberry Pi
 com port: RPI

opening a connection to the CEC adapter...
DEBUG:   [              73] Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [              74] Open - vc_cec initialised
DEBUG:   [              74] logical address changed to Free use (e)
NOTICE:  [              74] connection opened
DEBUG:   [              74] << Broadcast (F) -> TV (0): POLL
DEBUG:   [              74] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [              74] << e0
DEBUG:   [              74] processor thread started
DEBUG:   [            1077] command 'feature abort' timeout
DEBUG:   [            1577] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [            1577] << e0
DEBUG:   [            1610] >> POLL not sent
DEBUG:   [            1610] TV (0): device status changed into 'not present'
DEBUG:   [            1610] registering new CEC client - v4.0.7
DEBUG:   [            1610] SetClientVersion - using client version '4.0.7'
NOTICE:  [            1610] setting HDMI port to 1 on device TV (0)
DEBUG:   [            1610] << Broadcast (F) -> TV (0): POLL
DEBUG:   [            1610] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [            1610] << e0
DEBUG:   [            1611] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
TRAFFIC: [            1611] << e0
DEBUG:   [            1612] >> POLL not sent
DEBUG:   [            1612] SetConfiguration: double tap timeout = 200ms, repeat rate = 0ms, release delay = 500ms
DEBUG:   [            1612] detecting logical address for type 'playback device'
DEBUG:   [            1612] trying logical address 'Playback 1'
DEBUG:   [            1612] << Playback 1 (4) -> Playback 1 (4): POLL
TRAFFIC: [            1612] << 44
TRAFFIC: [            3144] << 44
DEBUG:   [            4678] >> POLL not sent
DEBUG:   [            4678] using logical address 'Playback 1'
DEBUG:   [            4678] Playback 1 (4): device status changed into 'handled by libCEC'
DEBUG:   [            4678] Playback 1 (4): power status changed from 'unknown' to 'on'
DEBUG:   [            4678] Playback 1 (4): vendor = Pulse Eight (001582)
DEBUG:   [            4678] Playback 1 (4): CEC version 1.4
DEBUG:   [            4678] AllocateLogicalAddresses - device '0', type 'playback device', LA '4'
DEBUG:   [            4678] logical address changed to Broadcast (f)
DEBUG:   [            6211] logical Broadcast (f) address lost
NOTICE:  [            6211] logical address f was taken by another device, allocating a new address
DEBUG:   [            6211] TV (0): device status changed into 'unknown'
DEBUG:   [            6211] << Playback 1 (4) -> TV (0): POLL
TRAFFIC: [            6211] << 40
DEBUG:   [            7211] command 'feature abort' timeout
TRAFFIC: [            7711] << 40
DEBUG:   [            7742] sending command 'feature abort' failed (4)
DEBUG:   [            7742] >> POLL not sent
DEBUG:   [            7742] TV (0): device status changed into 'not present'
DEBUG:   [            7743] logical address changed to Playback 1 (4)
DEBUG:   [            7743] Playback 1 (4): osd name set to 'CECTester'
DEBUG:   [            7743] Playback 1 (4): menu language set to 'eng'
WARNING: [            7743] unhandled response received: opcode=0 initiator=4 destination=0 response=f
DEBUG:   [            7743] logical address changed to Broadcast (f)
DEBUG:   [            7743] logical Broadcast (f) address lost
NOTICE:  [            7743] logical address f was taken by another device, allocating a new address
DEBUG:   [            7743] TV (0): device status changed into 'unknown'
DEBUG:   [            7743] GetPhysicalAddress - physical address = 1000
DEBUG:   [            7743] using auto-detected physical address 1000
DEBUG:   [            7743] << Playback 1 (4) -> TV (0): POLL
DEBUG:   [            7743] Playback 1 (4): physical address changed from ffff to 1000
DEBUG:   [            7743] << Playback 1 (4) -> broadcast (F): physical address 1000
TRAFFIC: [            7743] << 4f:84:10:00:04
TRAFFIC: [            7743] << 40
DEBUG:   [            8743] command 'feature abort' timeout
TRAFFIC: [            9243] << 40
DEBUG:   [           10244] command 'feature abort' timeout
DEBUG:   [           10744] >> POLL not sent
DEBUG:   [           10744] TV (0): device status changed into 'not present'
DEBUG:   [           10744] detecting logical address for type 'playback device'
DEBUG:   [           10744] trying logical address 'Playback 2'
DEBUG:   [           10744] << Playback 2 (8) -> Playback 2 (8): POLL
TRAFFIC: [           10744] << 88
TRAFFIC: [           12275] << 88
DEBUG:   [           13806] >> POLL not sent
DEBUG:   [           13806] using logical address 'Playback 2'
DEBUG:   [           13806] Playback 2 (8): device status changed into 'handled by libCEC'
DEBUG:   [           13806] Playback 2 (8): power status changed from 'unknown' to 'on'
DEBUG:   [           13806] Playback 2 (8): vendor = Pulse Eight (001582)
DEBUG:   [           13806] Playback 2 (8): CEC version 1.4
DEBUG:   [           13806] AllocateLogicalAddresses - device '0', type 'playback device', LA '8'
DEBUG:   [           13806] GetPhysicalAddress - physical address = 1000
DEBUG:   [           13806] Playback 2 (8): physical address changed from ffff to 1000
WARNING: [           13806] RegisterLogicalAddress - vc_cec_set_logical_address(8) returned device is busy (3)
DEBUG:   [           13806] UnregisterLogicalAddress - releasing previous logical address
popcornmix commented 2 years ago

Could be this: https://github.com/Hexxeh/rpi-firmware/issues/267 The firmware should be appear in apt imminently.

sfoglia commented 2 years ago

that's it now I've run the rpi-update and with libcec 4.0.7 is working again.

https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=288234&p=1897156&hilit=cec#p1897156

Linux PItv 5.10.52-v7l+ #1441 SMP Tue Aug 3 18:11:56 BST 2021 armv7l GNU/Linux