Pulse-Eight / libcec

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

LibCEC hangs when a device is powered on. #63

Closed UEckhardt closed 9 years ago

UEckhardt commented 9 years ago

Currently i am developing a plugin for vdr (http://www.uli-eckhardt.de/vdr/cec.en.shtml) and encountered a problem when the TV is powered on and off. I could also reproduce this problem via cec-client.

The TV is powered off (really no power) and I start cec-client:

vdr:/tmp # cec-client 
No device type given. Using 'recording device'                                                              
CEC Parser created - libCEC version 2.2.0                                                                              
no serial port given. trying autodetect:                                                                                  
 path:     /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3    
 com port: /dev/ttyACM0                                                                                              
opening a connection to the CEC adapter...
DEBUG:   [              27]     unregistering all CEC clients
DEBUG:   [              27]     Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [              28]     connection opened, clearing any previous input and waiting for active transmissions to end before starting
DEBUG:   [              29]     communication thread started
DEBUG:   [              40]     turning controlled mode on
NOTICE:  [              63]     connection opened
DEBUG:   [              64]     processor thread started
DEBUG:   [              64]     << Broadcast (F) -> TV (0): POLL
TRAFFIC: [              64]     << f0
DEBUG:   [              64]     setting the line timeout to 3
DEBUG:   [             101]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             101]     << f0
DEBUG:   [             132]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             133]     >> POLL not sent
DEBUG:   [             133]     TV (0): device status changed into 'not present'
NOTICE:  [             133]     registering new CEC client - v2.2.0
DEBUG:   [             133]     detecting logical address for type 'recording device'
DEBUG:   [             133]     trying logical address 'Recorder 1'
DEBUG:   [             133]     << Recorder 1 (1) -> Recorder 1 (1): POLL
TRAFFIC: [             133]     << 11
DEBUG:   [             171]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             171]     << 11
DEBUG:   [             204]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             204]     >> POLL not sent
DEBUG:   [             205]     using logical address 'Recorder 1'
DEBUG:   [             205]     Recorder 1 (1): device status changed into 'handled by libCEC'
DEBUG:   [             205]     Recorder 1 (1): power status changed from 'unknown' to 'on'
DEBUG:   [             205]     Recorder 1 (1): vendor = Pulse Eight (001582)
DEBUG:   [             205]     Recorder 1 (1): CEC version 1.4
DEBUG:   [             205]     AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
DEBUG:   [             205]     setting ackmask to  2
DEBUG:   [             210]     Recorder 1 (1): osd name set to 'CECTester'
DEBUG:   [             210]     Recorder 1 (1): menu language set to 'eng'
DEBUG:   [             210]     GetPhysicalAddress - trying to get the physical address via ADL
DEBUG:   [             210]     GetPhysicalAddress - ADL returned physical address 0000
DEBUG:   [             210]     GetPhysicalAddress - trying to get the physical address via nvidia driver
DEBUG:   [             210]     GetPhysicalAddress - nvidia driver returned physical address 0000
DEBUG:   [             210]     GetPhysicalAddress - trying to get the physical address from the OS
DEBUG:   [             211]     GetPhysicalAddress - OS returned physical address 0000
DEBUG:   [             211]     SetDevicePhysicalAddress - not setting invalid physical address 0000
NOTICE:  [             211]     setting HDMI port to 1 on device TV (0)
DEBUG:   [             211]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [             211]     << 10
DEBUG:   [             242]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             242]     << 10
DEBUG:   [             275]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             275]     >> POLL not sent
DEBUG:   [             275]     Recorder 1 (1): physical address changed from ffff to 1000
DEBUG:   [             275]     << Recorder 1 (1) -> broadcast (F): physical adddress 1000
TRAFFIC: [             275]     << 1f:84:10:00:01
DEBUG:   [             413]     using persisted autonomous mode setting: 'enabled'
DEBUG:   [             418]     using persisted CEC version setting: '1.4'
DEBUG:   [             424]     using persisted logical address setting: 'Recorder 1'
DEBUG:   [             429]     using persisted device type setting: 'recording device'
DEBUG:   [             434]     using persisted logical address mask setting: '206'
DEBUG:   [             451]     using persisted device name setting: 'CECTester'
DEBUG:   [             456]     using persisted physical address setting: '1000'
NOTICE:  [             457]     CEC client registered: libCEC version = 2.2.0, client version = 2.2.0, firmware version = 4, firmware build date: Thu Dec  6 11:15:20 2012 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, host: x86_64-suse-linux-gnu, features: 'P8 USB' 'P8 USB detect' 'EXYNOS'
DEBUG:   [             457]     << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
DEBUG:   [             457]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [             457]     << 10
DEBUG:   [             489]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             489]     << 10
DEBUG:   [             521]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             521]     >> POLL not sent
DEBUG:   [             521]     not sending command 'set osd name': destination device 'TV' marked as not present
DEBUG:   [             521]     << requesting power status of 'TV' (0)
DEBUG:   [             521]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [             521]     << 10
DEBUG:   [             560]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             560]     << 10
DEBUG:   [             593]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             593]     >> POLL not sent
DEBUG:   [             593]     not sending command 'give device power status': destination device 'TV' marked as not present

When I do a scan the result is the expected one:

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

currently active source: unknown (-1)

Next I power on the TV:

TRAFFIC: [          140835]     >> 0f:a0:00:80:45:20:00:01
DEBUG:   [          140835]     >> TV (0) -> Broadcast (F): vendor command with id (A0)
TRAFFIC: [          141000]     >> 0f:80:00:00:20:00
DEBUG:   [          141000]     >> TV (0) -> Broadcast (F): routing change (80)
DEBUG:   [          141000]     TV (0): power status changed from 'unknown' to 'on'
DEBUG:   [          141000]     device TV (0) status changed to present after command routing change
TRAFFIC: [          141606]     >> 0f:86:20:00
DEBUG:   [          141607]     >> TV (0) -> Broadcast (F): set stream path (86)
DEBUG:   [          141607]     >> TV (0) sets stream path to physical address 2000
TRAFFIC: [          141649]     >> 01
DEBUG:   [          141649]     << POLL: TV (0) -> Recorder 1 (1)
TRAFFIC: [          141699]     >> 02
DEBUG:   [          141699]     << POLL: TV (0) -> Recorder 2 (2)
TRAFFIC: [          141743]     >> 02
DEBUG:   [          141743]     << POLL: TV (0) -> Recorder 2 (2)
TRAFFIC: [          141793]     >> 03
DEBUG:   [          141793]     << POLL: TV (0) -> Tuner 1 (3)
TRAFFIC: [          141836]     >> 03
DEBUG:   [          141837]     << POLL: TV (0) -> Tuner 1 (3)
...
DEBUG:   [          144761]     << POLL: TV (0) -> Free use (e)
TRAFFIC: [          144811]     >> 0e
DEBUG:   [          144811]     << POLL: TV (0) -> Free use (e)
TRAFFIC: [          144882]     >> 01:83
DEBUG:   [          144882]     >> TV (0) -> Recorder 1 (1): give physical address (83)
DEBUG:   [          144883]     << Recorder 1 (1) -> broadcast (F): physical adddress 1000
TRAFFIC: [          144883]     << 1f:84:10:00:01
TRAFFIC: [          145085]     >> 01:8c
DEBUG:   [          145085]     >> TV (0) -> Recorder 1 (1): give device vendor id (8C)
DEBUG:   [          145085]     << Recorder 1 (1) -> TV (0): vendor id Pulse Eight (1582)
TRAFFIC: [          145085]     << 1f:87:00:15:82
TRAFFIC: [          145406]     >> 01:a0:00:80:45:06:05
DEBUG:   [          145406]     >> TV (0) -> Recorder 1 (1): vendor command with id (A0)
DEBUG:   [          145406]     sending abort with opcode a0 and reason 'invalid operand' to TV
DEBUG:   [          145406]     << transmitting abort message
TRAFFIC: [          145406]     << 10:00:a0:03 >

Now I enter a scan command:

scan
requesting CEC bus information ...
DEBUG:   [          216303]     << requesting active source
TRAFFIC: [          216303]     << 1f:85
DEBUG:   [          217361]     expected response not received (82: active source)
TRAFFIC: [          217361]     << 1f:85
DEBUG:   [          218422]     expected response not received (82: active source)
DEBUG:   [          218422]     << requesting vendor ID of 'TV' (0)
TRAFFIC: [          218422]     << 10:8c
TRAFFIC: [          218622]     >> 0f:87:00:80:45
DEBUG:   [          218622]     >> TV (0) -> Broadcast (F): device vendor id (87)
DEBUG:   [          218622]     TV (0): vendor = Panasonic (008045)
DEBUG:   [          218622]     << Recorder 1 (1) -> Broadcast (F): vendor id Pulse Eight (1582)
TRAFFIC: [          218622]     << 1f:87:00:15:82
DEBUG:   [          218754]     expected response received (87: device vendor id)
DEBUG:   [          218754]     replacing the command handler for device 'TV' (0)
DEBUG:   [          218754]     Recorder 1 (1): vendor = Panasonic (008045)
DEBUG:   [          218754]     replacing the command handler for device 'Recorder 1' (1)
NOTICE:  [          218754]     changing device type 'recording device' into 'playback device'
NOTICE:  [          218754]     unregistering client: libCEC version = 2.2.0, client version = 2.2.0, firmware version = 4, firmware build date: Thu Dec  6 11:15:20 2012 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, host: x86_64-suse-linux-gnu, features: 'P8 USB' 'P8 USB detect' 'EXYNOS'
DEBUG:   [          218754]     Recorder 1 (1): power status changed from 'on' to 'unknown'
DEBUG:   [          218754]     Recorder 1 (1): vendor = Unknown (000000)
DEBUG:   [          218754]     Recorder 1 (1): CEC version unknown
DEBUG:   [          218754]     Recorder 1 (1): osd name set to 'Recorder 1'
DEBUG:   [          218754]     Recorder 1 (1): device status changed into 'unknown'
DEBUG:   [          218754]     setting ackmask to  0
DEBUG:   [          218759]     turning controlled mode off
DEBUG:   [          218764]     turning controlled mode on >

I get no scan result. Also no further inputs are pocessed by cec-client. I have killed cec-client with "kill-11" to force a core and get the following backtrace:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `cec-client'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f6ee410f408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.19-16.9.1.x86_64 libcec2-debuginfo-2.2.0-5.1.x86_64 libgcc_s1-debuginfo-4.8.3+r212056-2.2.4.x86_64 liblockdev1-debuginfo-1.0.3_git201003141408-27.2.1.x86_64 libstdc++6-gcc49-debuginfo-4.9.0+r211729-2.1.7.x86_64 libudev1-debuginfo-210-25.12.1.x86_64
(gdb) bt
#0  0x00007f6ee410f408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f6ee32dc78b in CEC::CCECProcessor::RegisterClient(CEC::CCECClient*) () from /usr/lib64/libcec.so.2
#2  0x00007f6ee32ed7e9 in CEC::CCECClient::ChangeDeviceType(CEC::cec_device_type, CEC::cec_device_type) () from /usr/lib64/libcec.so.2
#3  0x00007f6ee330410c in CEC::CVLCommandHandler::InitHandler() () from /usr/lib64/libcec.so.2
#4  0x00007f6ee32f420d in CEC::CCECBusDevice::ReplaceHandler(bool) () from /usr/lib64/libcec.so.2
#5  0x00007f6ee32f5746 in CEC::CCECBusDevice::RequestVendorId(CEC::cec_logical_address, bool) () from /usr/lib64/libcec.so.2
#6  0x00007f6ee32f1774 in CEC::CCECBusDevice::GetVendorId(CEC::cec_logical_address, bool) () from /usr/lib64/libcec.so.2
#7  0x00007f6ee32e7678 in CEC::CCECClient::GetDeviceVendorId(CEC::cec_logical_address) () from /usr/lib64/libcec.so.2
#8  0x0000000000409c57 in ProcessCommandSCAN (parser=parser@entry=0xb1fb60, command="scan", UNUSED_arguments="") at main.cpp:910
#9  0x000000000040b3af in ProcessConsoleCommand (parser=0xb1fb60, input="") at main.cpp:982
#10 0x0000000000402e46 in main (argc=, argv=) at main.cpp:1304

Sometimes I get a result, but without the TV. In this case I get the additonal log output:

DEBUG:   [           37170]     expected response received (87: device vendor id)
DEBUG:   [           37170]     replacing the command handler for device 'TV' (0)
DEBUG:   [           37170]     Recorder 1 (1): vendor = Panasonic (008045)
DEBUG:   [           37170]     replacing the command handler for device 'Recorder 1' (1)
NOTICE:  [           37170]     changing device type 'recording device' into 'playback device'
NOTICE:  [           37170]     unregistering client: libCEC version = 2.2.0, client version = 2.2.0, firmware version = 4, firmware build date: Thu Dec  6 11:15:20 2012 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, host: x86_64-suse-linux-gnu, features: 'P8 USB' 'P8 USB detect' 'EXYNOS'

The cec-client crashes in this case when quitting.

UEckhardt commented 9 years ago

Also valgrind showed a lot of errors after wuitting cec-client when the TV was swiched on, after cec-client was started. I have cut the log, since it seems not be possible to attach a log file

==16087== Memcheck, a memory error detector
==16087== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==16087== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==16087== Command: /usr/bin/cec-client
==16087== Parent PID: 2038
==16087== 
==16087== Thread 6:
==16087== Invalid read of size 8
==16087==    at 0x62848C7: CEC::CCECProcessor::RegisterClient(CEC::CCECClient*) (CECProcessor.cpp:824)
==16087==    by 0x6292C31: CEC::CCECClient::ChangeDeviceType(CEC::cec_device_type, CEC::cec_device_type) (CECClient.cpp:457)
==16087==    by 0x62AD6DC: CEC::CVLCommandHandler::InitHandler() (VLCommandHandler.cpp:92)
==16087==    by 0x6299675: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:240)
==16087==    by 0x628250F: CEC::CCECProcessor::ReplaceHandlers() (CECProcessor.cpp:238)
==16087==    by 0x6282726: CEC::CCECProcessor::Process() (CECProcessor.cpp:271)
==16087==    by 0x6286C02: PLATFORM::CThread::ThreadHandler(void*) (threads.h:66)
==16087==    by 0x50410A3: start_thread (in /lib64/libpthread-2.19.so)
==16087==    by 0x5B6206C: clone (in /lib64/libc-2.19.so)
==16087==  Address 0x5e292b0 is 0 bytes inside a block of size 408 free'd
==16087==    at 0x4C2A84C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16087==    by 0x62A4869: CEC::CCECTV::~CCECTV() (CECTV.h:42)
==16087==    by 0x62A125F: CEC::CCECDeviceMap::Clear() (CECDeviceMap.cpp:129)
==16087==    by 0x62A0FFC: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:84)
==16087==    by 0x62A1061: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:85)
==16087==    by 0x6281D19: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:108)
==16087==    by 0x6281E29: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:109)
==16087==    by 0x628C72C: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:66)
==16087==    by 0x628C7DF: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:67)
==16087==    by 0x628E0C5: CECDestroy (LibCEC.cpp:497)
==16087==    by 0x4029F4: UnloadLibCec(CEC::ICECAdapter*) (cecloader.h:164)
==16087==    by 0x407A41: main (main.cpp:1323)
==16087== 
==16087== Invalid read of size 4
==16087==    at 0x629919C: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:175)
==16087==    by 0x62848DE: CEC::CCECProcessor::RegisterClient(CEC::CCECClient*) (CECProcessor.cpp:824)
==16087==    by 0x6292C31: CEC::CCECClient::ChangeDeviceType(CEC::cec_device_type, CEC::cec_device_type) (CECClient.cpp:457)
==16087==    by 0x62AD6DC: CEC::CVLCommandHandler::InitHandler() (VLCommandHandler.cpp:92)
==16087==    by 0x6299675: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:240)
==16087==    by 0x628250F: CEC::CCECProcessor::ReplaceHandlers() (CECProcessor.cpp:238)
==16087==    by 0x6282726: CEC::CCECProcessor::Process() (CECProcessor.cpp:271)
==16087==    by 0x6286C02: PLATFORM::CThread::ThreadHandler(void*) (threads.h:66)
==16087==    by 0x50410A3: start_thread (in /lib64/libpthread-2.19.so)
==16087==    by 0x5B6206C: clone (in /lib64/libc-2.19.so)
==16087==  Address 0x5e292cc is 28 bytes inside a block of size 408 free'd
==16087==    at 0x4C2A84C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16087==    by 0x62A4869: CEC::CCECTV::~CCECTV() (CECTV.h:42)
==16087==    by 0x62A125F: CEC::CCECDeviceMap::Clear() (CECDeviceMap.cpp:129)
==16087==    by 0x62A0FFC: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:84)
==16087==    by 0x62A1061: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:85)
==16087==    by 0x6281D19: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:108)
==16087==    by 0x6281E29: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:109)
==16087==    by 0x628C72C: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:66)
==16087==    by 0x628C7DF: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:67)
==16087==    by 0x628E0C5: CECDestroy (LibCEC.cpp:497)
==16087==    by 0x4029F4: UnloadLibCec(CEC::ICECAdapter*) (cecloader.h:164)
==16087==    by 0x407A41: main (main.cpp:1323)
==16087== 
==16087== Invalid read of size 4
==16087==    at 0x5043244: pthread_mutex_lock (in /lib64/libpthread-2.19.so)
==16087==    by 0x62864CB: PLATFORM::CMutex::Lock() (mutex.h:90)
==16087==    by 0x62865E9: PLATFORM::CLockObject::CLockObject(PLATFORM::CMutex&, bool) (mutex.h:135)
==16087==    by 0x62991D0: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:180)
==16087==    by 0x62848DE: CEC::CCECProcessor::RegisterClient(CEC::CCECClient*) (CECProcessor.cpp:824)
==16087==    by 0x6292C31: CEC::CCECClient::ChangeDeviceType(CEC::cec_device_type, CEC::cec_device_type) (CECClient.cpp:457)
==16087==    by 0x62AD6DC: CEC::CVLCommandHandler::InitHandler() (VLCommandHandler.cpp:92)
==16087==    by 0x6299675: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:240)
==16087==    by 0x628250F: CEC::CCECProcessor::ReplaceHandlers() (CECProcessor.cpp:238)
==16087==    by 0x6282726: CEC::CCECProcessor::Process() (CECProcessor.cpp:271)
==16087==    by 0x6286C02: PLATFORM::CThread::ThreadHandler(void*) (threads.h:66)
==16087==    by 0x50410A3: start_thread (in /lib64/libpthread-2.19.so)
==16087==  Address 0x5e29358 is 168 bytes inside a block of size 408 free'd
==16087==    at 0x4C2A84C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16087==    by 0x62A4869: CEC::CCECTV::~CCECTV() (CECTV.h:42)
==16087==    by 0x62A125F: CEC::CCECDeviceMap::Clear() (CECDeviceMap.cpp:129)
==16087==    by 0x62A0FFC: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:84)
==16087==    by 0x62A1061: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:85)
==16087==    by 0x6281D19: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:108)
==16087==    by 0x6281E29: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:109)
==16087==    by 0x628C72C: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:66)
==16087==    by 0x628C7DF: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:67)
==16087==    by 0x628E0C5: CECDestroy (LibCEC.cpp:497)
==16087==    by 0x4029F4: UnloadLibCec(CEC::ICECAdapter*) (cecloader.h:164)
==16087==    by 0x407A41: main (main.cpp:1323)
==16087== 
==16087== Invalid read of size 4
==16087==    at 0x503EA03: __pthread_mutex_lock_full (in /lib64/libpthread-2.19.so)
==16087==    by 0x62864CB: PLATFORM::CMutex::Lock() (mutex.h:90)
==16087==    by 0x62865E9: PLATFORM::CLockObject::CLockObject(PLATFORM::CMutex&, bool) (mutex.h:135)
==16087==    by 0x62991D0: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:180)
==16087==    by 0x62848DE: CEC::CCECProcessor::RegisterClient(CEC::CCECClient*) (CECProcessor.cpp:824)
==16087==    by 0x6292C31: CEC::CCECClient::ChangeDeviceType(CEC::cec_device_type, CEC::cec_device_type) (CECClient.cpp:457)
==16087==    by 0x62AD6DC: CEC::CVLCommandHandler::InitHandler() (VLCommandHandler.cpp:92)
==16087==    by 0x6299675: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:240)
==16087==    by 0x628250F: CEC::CCECProcessor::ReplaceHandlers() (CECProcessor.cpp:238)
==16087==    by 0x6282726: CEC::CCECProcessor::Process() (CECProcessor.cpp:271)
==16087==    by 0x6286C02: PLATFORM::CThread::ThreadHandler(void*) (threads.h:66)
==16087==    by 0x50410A3: start_thread (in /lib64/libpthread-2.19.so)
==16087==  Address 0x5e29358 is 168 bytes inside a block of size 408 free'd
==16087==    at 0x4C2A84C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16087==    by 0x62A4869: CEC::CCECTV::~CCECTV() (CECTV.h:42)
==16087==    by 0x62A125F: CEC::CCECDeviceMap::Clear() (CECDeviceMap.cpp:129)
==16087==    by 0x62A0FFC: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:84)
==16087==    by 0x62A1061: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:85)
==16087==    by 0x6281D19: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:108)
==16087==    by 0x6281E29: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:109)
==16087==    by 0x628C72C: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:66)
==16087==    by 0x628C7DF: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:67)
==16087==    by 0x628E0C5: CECDestroy (LibCEC.cpp:497)
==16087==    by 0x4029F4: UnloadLibCec(CEC::ICECAdapter*) (cecloader.h:164)
==16087==    by 0x407A41: main (main.cpp:1323)
==16087== 
==16087== Invalid read of size 4
==16087==    at 0x62864D0: PLATFORM::CMutex::Lock() (mutex.h:91)
==16087==    by 0x62865E9: PLATFORM::CLockObject::CLockObject(PLATFORM::CMutex&, bool) (mutex.h:135)
==16087==    by 0x62991D0: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:180)
==16087==    by 0x62848DE: CEC::CCECProcessor::RegisterClient(CEC::CCECClient*) (CECProcessor.cpp:824)
==16087==    by 0x6292C31: CEC::CCECClient::ChangeDeviceType(CEC::cec_device_type, CEC::cec_device_type) (CECClient.cpp:457)
==16087==    by 0x62AD6DC: CEC::CVLCommandHandler::InitHandler() (VLCommandHandler.cpp:92)
==16087==    by 0x6299675: CEC::CCECBusDevice::ReplaceHandler(bool) (CECBusDevice.cpp:240)
==16087==    by 0x628250F: CEC::CCECProcessor::ReplaceHandlers() (CECProcessor.cpp:238)
==16087==    by 0x6282726: CEC::CCECProcessor::Process() (CECProcessor.cpp:271)
==16087==    by 0x6286C02: PLATFORM::CThread::ThreadHandler(void*) (threads.h:66)
==16087==    by 0x50410A3: start_thread (in /lib64/libpthread-2.19.so)
==16087==    by 0x5B6206C: clone (in /lib64/libc-2.19.so)
==16087==  Address 0x5e29370 is 192 bytes inside a block of size 408 free'd
==16087==    at 0x4C2A84C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16087==    by 0x62A4869: CEC::CCECTV::~CCECTV() (CECTV.h:42)
==16087==    by 0x62A125F: CEC::CCECDeviceMap::Clear() (CECDeviceMap.cpp:129)
==16087==    by 0x62A0FFC: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:84)
==16087==    by 0x62A1061: CEC::CCECDeviceMap::~CCECDeviceMap() (CECDeviceMap.cpp:85)
==16087==    by 0x6281D19: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:108)
==16087==    by 0x6281E29: CEC::CCECProcessor::~CCECProcessor() (CECProcessor.cpp:109)
==16087==    by 0x628C72C: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:66)
==16087==    by 0x628C7DF: CEC::CLibCEC::~CLibCEC() (LibCEC.cpp:67)
==16087==    by 0x628E0C5: CECDestroy (LibCEC.cpp:497)
==16087==    by 0x4029F4: UnloadLibCec(CEC::ICECAdapter*) (cecloader.h:164)
==16087==    by 0x407A41: main (main.cpp:1323)
opdenkamp commented 9 years ago

interesting, haven't run into this yet. since you know how to use a debugger, could you run cec-client in gdb, reproduce the hang in the scan command after the tv started to respond, then do ctrl+c and show me the output of thread apply all bt.

it's a bit odd that your tv doesn't respond to polls at all if it's not powered up. I guess that's some deep sleep feature that's enabled in it's settings. because of that, you can't power up the TV via CEC.

UEckhardt commented 9 years ago

The TV is powered off via a remote controlled power strip. The problem occurs when I gave the remote controlled power strip the command to switch on power for the TV. So to reproduce the problem you have to remove and insert the power plug. Hoplefully this explanations is somewhat clearer, I am not a native english speaker.

I will run gdb in the evening, when I am at home and let you know the results.

UEckhardt commented 9 years ago

I tried to reproduce the hang in gdb, but got crashes instead. Also one wired thing is, that after a scan the information about the CEC adapter itselve is not displayed anymore.

The scan with the TV disconnected from power is as expected:

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

Now i connect the TV to the power:

CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: no
vendor:        Panasonic
osd string:    TV
CEC version:   unknown
power status:  unknown
language:      ???
currently active source: unknown (-1)

Now device 1 is not displayed anymore. After enter the quit command the cec-client crashes:

rogram received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef7fe700 (LWP 14335)]
0x000000000061b910 in ?? ()
Missing separate debuginfos, use: zypper install libX11-6-debuginfo-1.6.2-5.1.2.x86_64 libXau6-debuginfo-1.0.8-5.1.2.x86_64 libXext6-debuginfo-1.3.3-2.1.2.x86_64 libXrandr2-debuginfo-1.4.2-4.1.2.x86_64 libXrender1-debuginfo-0.9.8-4.1.2.x86_64 libgcc_s1-debuginfo-4.8.3+r212056-2.2.4.x86_64 libstdc++6-gcc49-debuginfo-4.9.0+r211729-2.1.7.x86_64 libudev1-debuginfo-210-25.12.1.x86_64 libxcb1-debuginfo-1.11-2.1.2.x86_64
(gdb) thread apply all bt
Thread 6 (Thread 0x7fffef7fe700 (LWP 14335)):
#0  0x000000000061b910 in ?? ()
#1  0x00007ffff6b9194d in CEC::CCECProcessor::RegisterClient (this=0x616930, client=client@entry=0x61ac60)
    at CECProcessor.cpp:823
#2  0x00007ffff6ba345d in CEC::CCECClient::ChangeDeviceType (this=0x61ac60, from=, to=)
    at CECClient.cpp:457
#3  0x00007ffff6bba694 in CEC::CVLCommandHandler::InitHandler (this=0x7fffe8000c60) at implementations/VLCommandHandler.cpp:92
#4  0x00007ffff6baa1cd in CEC::CCECBusDevice::ReplaceHandler (this=0x616ce0, bActivateSource=)
    at devices/CECBusDevice.cpp:240
#5  0x00007ffff6b8e117 in CEC::CCECProcessor::ReplaceHandlers (this=this@entry=0x616930) at CECProcessor.cpp:237
#6  0x00007ffff6b9348e in CEC::CCECProcessor::Process (this=0x616930) at CECProcessor.cpp:270
#7  0x00007ffff6b950d3 in PLATFORM::CThread::ThreadHandler (_thread=0x616930) at platform/threads/threads.h:66
#8  0x00007ffff79c30a4 in start_thread () from /lib64/libpthread.so.0
#9  0x00007ffff6ed206d in clone () from /lib64/libc.so.6
Thread 1 (Thread 0x7ffff7fca740 (LWP 14327)):
#0  0x00007ffff79c705f in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007ffff6b94a87 in Wait (mutex=..., this=0x616940) at platform/threads/../posix/os-threads.h:111
#2  Wait (iTimeoutMs=, mutex=..., this=0x616940) at platform/threads/../posix/os-threads.h:117
#3  Wait (iTimeout=0, param=0x61693a, callback=0x7ffff6b94d40 ::_PredicateCallbackDefault(void*)>, 
    mutex=..., this=0x616940) at platform/threads/mutex.h:274
#4  Wait (iTimeout=0, predicate=@0x61693a: false, mutex=..., this=0x616940) at platform/threads/mutex.h:282
#5  StopThread (iWaitMs=0, this=0x616930) at platform/threads/threads.h:125
#6  ~CThread (this=0x616930, __in_chrg=) at platform/threads/threads.h:49
#7  CEC::CCECProcessor::~CCECProcessor (this=0x616930, __in_chrg=) at CECProcessor.cpp:103
#8  0x00007ffff6b94cc9 in CEC::CCECProcessor::~CCECProcessor (this=0x616930, __in_chrg=)
    at CECProcessor.cpp:109
#9  0x00007ffff6b9958f in CEC::CLibCEC::~CLibCEC (this=0x6168c0, __in_chrg=) at LibCEC.cpp:66
#10 0x00007ffff6b99679 in CEC::CLibCEC::~CLibCEC (this=0x6168c0, __in_chrg=) at LibCEC.cpp:67
#11 0x0000000000403889 in UnloadLibCec (device=0x6168c0) at ../../include/cecloader.h:164
#12 0x0000000000402bc3 in main (argc=, argv=) at main.cpp:1323
opdenkamp commented 9 years ago

@UEckhardt I think that the commits linked in here now will fix the issue, but I need to test this still. If you want to try, see the cmake branch. As the name of the branch suggests, we switched from autotools/visual studio to cmake in there.

UEckhardt commented 9 years ago

I tried to compile the cmake branch on a OpenSUSE 13.2 (x86_64) but got error messages. I am not sure if i have compiled it correctly or if there are some packages missing: vdr:/video/src/libcec/build # cmake ../libcec

CMake Error at src/cec-client/CMakeLists.txt:21 (find_package):
  By not providing "Findplatform.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "platform",
  but CMake did not find one.
  Could not find a package configuration file provided by "platform" with any
  of the following names:
    platformConfig.cmake
    platform-config.cmake
  Add the installation prefix of "platform" to CMAKE_PREFIX_PATH or set
  "platform_DIR" to a directory containing one of the above files.  If
  "platform" provides a separate development package or SDK, be sure it has
  been installed.

I couldn't find the mentioned missing cmake files for OpenSUSE on a first quick search.

bimsarck commented 9 years ago

same compile error.(crosscompile for raspberrypi)

@UEckardt, wende die beiden patche auf den master an! Musst dazu nur die Pfade anpassen im Patch(src/libcec --> src/lib). Hab auch nen Panasonic, aber nach dem patchen, gleiches Verhalten. Nach einigen Schaltvorgängen zwischen TV und RPi funktioniert die TV FB nicht mehr. Die funktioniert erst wieder wenn ich vorher im VieraLink Menu die RPi(Player2[HDMI2]) Quelle auswähle. Im OSMC Forum gibt es nen Thread dazu --> https://discourse.osmc.tv/t/fixed-osmc-alpha-1-4-rpi-cec-issue/814 Das ist keine Lösung. Laut OSMC-Entwickler wollte opdenkamp das fixen. :-)

bimsarck

opdenkamp commented 9 years ago

the error is caused by a missing platform lib. you can find it here: https://github.com/Pulse-Eight/platform readme files haven't been updated yet to include all the new stuff (cmake, swig, python)

UEckhardt commented 9 years ago

I get a step forward, but i still can compile. I get now the following errors:

[ 88%] Swig source
[ 91%] [ 94%] Building CXX object src/cec-client/CMakeFiles/cec-client.dir/cec-client.cpp.o
Building C object src/cecc-client/CMakeFiles/cecc-client.dir/cecc-client.c.o                            
Linking C executable cecc-client
/video/src/libcec/libcec/src/libcec/libcec.i:2: Warning 124: Specifying the language name in %typemap is deprecated - use #ifdef SWIG instead.
[ 94%] Built target cecc-client
/video/src/libcec/libcec/src/libcec/libcec.i:10: Warning 450: Deprecated typemap feature ($source/$target).
/video/src/libcec/libcec/src/libcec/libcec.i:10: Warning 450: The use of $source and $target in a typemap declaration is deprecated.
For typemaps related to argument input (in,ignore,default,arginit,check), replace
$source by $input and $target by $1.   For typemaps related to return values (out,
argout,ret,except), replace $source by $1 and $target by $result.  See the file
Doc/Manual/Typemaps.html for complete details.
Linking CXX executable cec-client
[ 97%] [ 97%] Building CXX object src/libcec/CMakeFiles/_cec.dir/LibCECC.cpp.o
Swig source
[ 97%] Built target cec-client
/video/src/libcec/libcec/src/libcec/libcec.i:2: Warning 124: Specifying the language name in %typemap is deprecated - use #ifdef SWIG instead.
/video/src/libcec/libcec/src/libcec/libcec.i:10: Warning 450: Deprecated typemap feature ($source/$target).
/video/src/libcec/libcec/src/libcec/libcec.i:10: Warning 450: The use of $source and $target in a typemap declaration is deprecated.
For typemaps related to argument input (in,ignore,default,arginit,check), replace
$source by $input and $target by $1.   For typemaps related to return values (out,
argout,ret,except), replace $source by $1 and $target by $result.  See the file
Doc/Manual/Typemaps.html for complete details.
[100%] Building C object src/libcec/CMakeFiles/_cec.dir/libcecPYTHON_wrap.c.o
Linking CXX shared module _cec.so
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/libplatform.a(fstrcmp.c.o): relocation R_X86_64_PC32 against undefined symbol `strlen@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: final link failed: Bad value
collect2: Fehler: ld gab 1 als Ende-Status zurück
src/libcec/CMakeFiles/_cec.dir/build.make:120: recipe for target 'src/libcec/_cec.so.2.3.0' failed
make[2]: *** [src/libcec/_cec.so.2.3.0] Error 1
CMakeFiles/Makefile2:177: recipe for target 'src/libcec/CMakeFiles/_cec.dir/all' failed
make[1]: *** [src/libcec/CMakeFiles/_cec.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
opdenkamp commented 9 years ago

it's trying to link a static platform lib without -fPIC from the looks of it. try recompiling the platform lib, and use cmake /path/to/platform/sources -DBUILD_SHARED_LIBS=1 instead

UEckhardt commented 9 years ago

With the latest version (commit 7870cf7660) I got the same hang but on directly on the first attempt. I had my TV disconnected from power, performed a scan command, which works as expected, then connected the TV to the power and again performed a scan command which hangs.

The gdb stacktrace:

(gdb) thread apply all bt

Thread 7 (Thread 0x7f03a517f700 (LWP 3216)):
#0  0x00007f03a71be408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000000000040ba09 in PLATFORM::CConditionImpl::Wait(pthread_mutex_t&, unsigned int) ()
#2  0x000000000040ca52 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool (*)(void*), void*, unsigned int) ()
#3  0x000000000040c8e3 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool&, unsigned int) ()
#4  0x00007f03a619a21e in PLATFORM::SyncedBuffer<CEC::CCECAdapterMessageQueueEntry*>::Pop(CEC::CCECAdapterMessageQueueEntry*&, int) () from /usr/lib64/libcec.so.2.0
#5  0x00007f03a61992a7 in CEC::CCECAdapterMessageQueue::Process() () from /usr/lib64/libcec.so.2.0
#6  0x000000000040c236 in PLATFORM::CThread::ThreadHandler(void*) ()
#7  0x00007f03a71ba0a4 in start_thread () from /lib64/libpthread.so.0
#8  0x00007f03a64c506d in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7f03a497e700 (LWP 3217)):
#0  0x00007f03a71be408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000000000040ba09 in PLATFORM::CConditionImpl::Wait(pthread_mutex_t&, unsigned int) ()
#2  0x000000000040ca52 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool (*)(void*), void*, unsigned int) ()
#3  0x000000000040c8e3 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool&, unsigned int) ()
#4  0x000000000040c55d in PLATFORM::CThread::Sleep(unsigned int) ()
#5  0x00007f03a61951fa in CEC::CUSBCECAdapterCommunication::Process() () from /usr/lib64/libcec.so.2.0
#6  0x000000000040c236 in PLATFORM::CThread::ThreadHandler(void*) ()
#7  0x00007f03a71ba0a4 in start_thread () from /lib64/libpthread.so.0
#8  0x00007f03a64c506d in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7f039ffff700 (LWP 3218)):
#0  0x00007f03a71be408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000000000040ba09 in PLATFORM::CConditionImpl::Wait(pthread_mutex_t&, unsigned int) ()
#2  0x000000000040ca52 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool (*)(void*), void*, unsigned int) ()
#3  0x000000000040c8e3 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool&, unsigned int) ()
#4  0x00007f03a6196e93 in CEC::CAdapterEepromWriteThread::Process() () from /usr/lib64/libcec.so.2.0
#5  0x000000000040c236 in PLATFORM::CThread::ThreadHandler(void*) ()
---Type <return> to continue, or q <return> to quit--- 
#6  0x00007f03a71ba0a4 in start_thread () from /lib64/libpthread.so.0                                    
#7  0x00007f03a64c506d in clone () from /lib64/libc.so.6                                                   

Thread 4 (Thread 0x7f039f7fe700 (LWP 3219)):                                                                 
#0  0x00007f03a71be408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0                   
#1  0x000000000040ba09 in PLATFORM::CConditionImpl::Wait(pthread_mutex_t&, unsigned int) ()                        
#2  0x000000000040ca52 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool (*)(void*), void*, unsigned int) ()
#3  0x000000000040c8e3 in PLATFORM::CCondition<bool>::Wait(PLATFORM::CMutex&, bool&, unsigned int) ()                 
#4  0x000000000040c55d in PLATFORM::CThread::Sleep(unsigned int) ()                                                   
#5  0x00007f03a6196ce0 in CEC::CAdapterPingThread::Process() () from /usr/lib64/libcec.so.2.0                           
#6  0x000000000040c236 in PLATFORM::CThread::ThreadHandler(void*) ()                                                      
#7  0x00007f03a71ba0a4 in start_thread () from /lib64/libpthread.so.0                                                        
#8  0x00007f03a64c506d in clone () from /lib64/libc.so.6                                                                          

Thread 3 (Thread 0x7f039effd700 (LWP 3220)):                                                                                      
#0  0x00007f03a71be408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0                                         
#1  0x000000000040ba09 in PLATFORM::CConditionImpl::Wait(pthread_mutex_t&, unsigned int) ()                                          
#2  0x000000000040c9a8 in PLATFORM::CCondition<bool volatile>::Wait(PLATFORM::CMutex&, bool (*)(void*), void*, unsigned int) ()          
#3  0x000000000040c835 in PLATFORM::CCondition<bool volatile>::Wait(PLATFORM::CMutex&, bool volatile&, unsigned int) ()                   
#4  0x000000000040bf64 in PLATFORM::CEvent::Wait(unsigned int) ()                                                                            
#5  0x000000000040bff9 in PLATFORM::CEvent::Sleep(unsigned int) ()                                                                              
#6  0x00007f03a6183896 in CEC::CCECProcessor::RegisterClient(std::shared_ptr<CEC::CCECClient>) ()                                               
   from /usr/lib64/libcec.so.2.0                                                                                                                 
#7  0x00007f03a61834e6 in CEC::CCECProcessor::RegisterClient(CEC::CCECClient*) ()
   from /usr/lib64/libcec.so.2.0
#8  0x00007f03a617a166 in CEC::CCECClient::ChangeDeviceType(CEC::cec_device_type, CEC::cec_device_type)
    () from /usr/lib64/libcec.so.2.0
#9  0x00007f03a6181130 in CEC::CCECProcessor::ReplaceHandlers() () from /usr/lib64/libcec.so.2.0
#10 0x00007f03a618147d in CEC::CCECProcessor::Process() () from /usr/lib64/libcec.so.2.0
#11 0x000000000040c236 in PLATFORM::CThread::ThreadHandler(void*) ()
#12 0x00007f03a71ba0a4 in start_thread () from /lib64/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
#13 0x00007f03a64c506d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f039e7fc700 (LWP 3221)):
#0  0x00007f03a71be408 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000000000040ba09 in PLATFORM::CConditionImpl::Wait(pthread_mutex_t&, unsigned int) ()
#2  0x000000000040c9a8 in PLATFORM::CCondition<bool volatile>::Wait(PLATFORM::CMutex&, bool (*)(void*), void*, unsigned int) ()
#3  0x000000000040c835 in PLATFORM::CCondition<bool volatile>::Wait(PLATFORM::CMutex&, bool volatile&, unsigned int) ()
#4  0x000000000040bf64 in PLATFORM::CEvent::Wait(unsigned int) ()
#5  0x000000000040bff9 in PLATFORM::CEvent::Sleep(unsigned int) ()
#6  0x00007f03a618059a in CEC::CCECStandbyProtection::Process() () from /usr/lib64/libcec.so.2.0
#7  0x000000000040c236 in PLATFORM::CThread::ThreadHandler(void*) ()
#8  0x00007f03a71ba0a4 in start_thread () from /lib64/libpthread.so.0
#9  0x00007f03a64c506d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f03a77d5740 (LWP 3215)):
#0  0x00007f03a71c07bc in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x00007f03a71bc4a4 in _L_lock_952 () from /lib64/libpthread.so.0
#2  0x00007f03a71bc306 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3  0x000000000040bbbc in PLATFORM::CMutex::Lock() ()
#4  0x000000000040bcda in PLATFORM::CLockObject::CLockObject(PLATFORM::CMutex&, bool) ()
#5  0x00007f03a61817ca in CEC::CCECProcessor::GetStandardLineTimeout() () from /usr/lib64/libcec.so.2.0
#6  0x00007f03a6181d6f in CEC::CCECProcessor::Transmit(CEC::cec_command const&, bool) ()
   from /usr/lib64/libcec.so.2.0
#7  0x00007f03a61b0009 in CEC::CCECCommandHandler::Transmit(CEC::cec_command&, bool, bool) ()
   from /usr/lib64/libcec.so.2.0
#8  0x00007f03a61aeb59 in CEC::CCECCommandHandler::TransmitRequestCecVersion(CEC::cec_logical_address, CEC::cec_logical_address, bool) () from /usr/lib64/libcec.so.2.0
#9  0x00007f03a61a02ac in CEC::CCECBusDevice::RequestCecVersion(CEC::cec_logical_address, bool) ()
   from /usr/lib64/libcec.so.2.0
#10 0x00007f03a61a007a in CEC::CCECBusDevice::GetCecVersion(CEC::cec_logical_address, bool) ()
   from /usr/lib64/libcec.so.2.0
#11 0x00007f03a617ac27 in CEC::CCECClient::GetDeviceCecVersion(CEC::cec_logical_address) ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib64/libcec.so.2.0
#12 0x00007f03a618c588 in CEC::CLibCEC::GetDeviceCecVersion(CEC::cec_logical_address) ()
   from /usr/lib64/libcec.so.2.0
#13 0x00000000004092ee in ProcessCommandSCAN(CEC::ICECAdapter*, std::string const&, std::string&) ()
#14 0x0000000000409ca7 in ProcessConsoleCommand(CEC::ICECAdapter*, std::string&) ()
#15 0x000000000040af7c in main ()
(gdb) 

The cec-client showed the following output:

No device type given. Using 'recording device'
CEC Parser created - libCEC version 2.3.0
no serial port given. trying autodetect: 
 path:     /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3
 com port: /dev/ttyACM0

opening a connection to the CEC adapter...
DEBUG:   [              23]     Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [              25]     connection opened, clearing any previous input and waiting for active transmissions to end before starting
DEBUG:   [              25]     communication thread started
DEBUG:   [              37]     turning controlled mode on
NOTICE:  [              62]     connection opened
DEBUG:   [              63]     processor thread started
DEBUG:   [              63]     << Broadcast (F) -> TV (0): POLL
TRAFFIC: [              63]     << f0
DEBUG:   [              63]     setting the line timeout to 3
DEBUG:   [             103]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             104]     << f0
DEBUG:   [             137]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             138]     >> POLL not sent
DEBUG:   [             138]     TV (0): device status changed into 'not present'
NOTICE:  [             138]     registering new CEC client - v2.3.0
DEBUG:   [             138]     detecting logical address for type 'recording device'
DEBUG:   [             138]     trying logical address 'Recorder 1'
DEBUG:   [             138]     << Recorder 1 (1) -> Recorder 1 (1): POLL
TRAFFIC: [             138]     << 11
DEBUG:   [             171]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             171]     << 11
DEBUG:   [             209]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             210]     >> POLL not sent
DEBUG:   [             210]     using logical address 'Recorder 1'
DEBUG:   [             210]     Recorder 1 (1): device status changed into 'handled by libCEC'
DEBUG:   [             210]     Recorder 1 (1): power status changed from 'unknown' to 'on'
DEBUG:   [             210]     Recorder 1 (1): vendor = Pulse Eight (001582)
DEBUG:   [             210]     Recorder 1 (1): CEC version 1.4
DEBUG:   [             210]     AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
DEBUG:   [             210]     setting ackmask to  2
DEBUG:   [             215]     Recorder 1 (1): osd name set to 'CECTester'
DEBUG:   [             215]     Recorder 1 (1): menu language set to 'eng'
DEBUG:   [             215]     GetPhysicalAddress - trying to get the physical address via ADL
DEBUG:   [             215]     GetPhysicalAddress - ADL returned physical address 0000
DEBUG:   [             216]     GetPhysicalAddress - trying to get the physical address via nvidia driver
DEBUG:   [             216]     GetPhysicalAddress - nvidia driver returned physical address 0000
DEBUG:   [             216]     GetPhysicalAddress - trying to get the physical address from the OS
DEBUG:   [             265]     GetPhysicalAddress - OS returned physical address 0000
NOTICE:  [             266]     setting HDMI port to 1 on device TV (0)
DEBUG:   [             266]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [             266]     << 10
DEBUG:   [             299]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             300]     << 10
DEBUG:   [             332]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             333]     >> POLL not sent
DEBUG:   [             333]     Recorder 1 (1): physical address changed from ffff to 1000
DEBUG:   [             333]     << Recorder 1 (1) -> broadcast (F): physical adddress 1000
TRAFFIC: [             333]     << 1f:84:10:00:01
DEBUG:   [             471]     using persisted autonomous mode setting: 'enabled'
DEBUG:   [             476]     using persisted CEC version setting: '1.4'
DEBUG:   [             481]     using persisted logical address setting: 'Playback 1'
DEBUG:   [             486]     using persisted device type setting: 'playback device'
DEBUG:   [             491]     using persisted logical address mask setting: '910'
DEBUG:   [             508]     using persisted device name setting: 'CECTester'
DEBUG:   [             514]     using persisted physical address setting: '1000'
DEBUG:   [             514]     setting the device type to 1 (previous: 4)
DEBUG:   [             520]     setting the default logical address to 1 (previous: 4)
DEBUG:   [             525]     setting the logical address mask to 206 (previous: 910)
DEBUG:   [             531]     writing settings in the EEPROM
NOTICE:  [             531]     CEC client registered: libCEC version = 2.3.0, client version = 2.3.0, firmware version = 4, firmware build date: Thu Dec  6 11:15:20 2012 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-3.18.9-ue-desktop, features: P8_USB, P8_detect, randr
DEBUG:   [             531]     << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
DEBUG:   [             531]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [             531]     << 10
DEBUG:   [             580]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             580]     << 10
DEBUG:   [             613]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             614]     >> POLL not sent
DEBUG:   [             614]     not sending command 'set osd name': destination device 'TV' marked as not present
DEBUG:   [             614]     << requesting power status of 'TV' (0)
DEBUG:   [             614]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [             614]     << 10
DEBUG:   [             646]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [             647]     << 10
DEBUG:   [             680]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [             681]     >> POLL not sent
DEBUG:   [             681]     not sending command 'give device power status': destination device 'TV' marked as not present
waiting for input
scan
requesting CEC bus information 
DEBUG:   [           10554]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [           10554]     << 10
DEBUG:   [           10588]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           10588]     << 10
DEBUG:   [           10622]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           10622]     >> POLL not sent
DEBUG:   [           10622]     << Recorder 1 (1) -> Recorder 2 (2): POLL
TRAFFIC: [           10622]     << 12
DEBUG:   [           10655]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           10656]     << 12
DEBUG:   [           10688]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           10688]     >> POLL not sent
DEBUG:   [           10688]     Recorder 2 (2): device status changed into 'not present'
DEBUG:   [           10688]     << Recorder 1 (1) -> Tuner 1 (3): POLL
TRAFFIC: [           10688]     << 13
DEBUG:   [           10727]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           10727]     << 13
DEBUG:   [           10759]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           10760]     >> POLL not sent
DEBUG:   [           10760]     Tuner 1 (3): device status changed into 'not present'
DEBUG:   [           10760]     << Recorder 1 (1) -> Playback 1 (4): POLL
TRAFFIC: [           10760]     << 14
DEBUG:   [           10793]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           10793]     << 14
DEBUG:   [           10826]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           10826]     >> POLL not sent
DEBUG:   [           10826]     Playback 1 (4): device status changed into 'not present'
DEBUG:   [           10826]     << Recorder 1 (1) -> Audio (5): POLL
TRAFFIC: [           10826]     << 15
DEBUG:   [           10865]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           10865]     << 15
DEBUG:   [           10898]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           10899]     >> POLL not sent
DEBUG:   [           10899]     Audio (5): device status changed into 'not present'
DEBUG:   [           10899]     << Recorder 1 (1) -> Tuner 2 (6): POLL
TRAFFIC: [           10899]     << 16
DEBUG:   [           10931]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           10932]     << 16
DEBUG:   [           10965]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           10965]     >> POLL not sent
DEBUG:   [           10965]     Tuner 2 (6): device status changed into 'not present'
DEBUG:   [           10966]     << Recorder 1 (1) -> Tuner 3 (7): POLL
TRAFFIC: [           10966]     << 17
DEBUG:   [           11003]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11003]     << 17
DEBUG:   [           11036]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11037]     >> POLL not sent
DEBUG:   [           11037]     Tuner 3 (7): device status changed into 'not present'
DEBUG:   [           11037]     << Recorder 1 (1) -> Playback 2 (8): POLL
TRAFFIC: [           11037]     << 18
DEBUG:   [           11068]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11069]     << 18
DEBUG:   [           11107]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11107]     >> POLL not sent
DEBUG:   [           11107]     Playback 2 (8): device status changed into 'not present'
DEBUG:   [           11107]     << Recorder 1 (1) -> Recorder 3 (9): POLL
TRAFFIC: [           11107]     << 19
DEBUG:   [           11139]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11139]     << 19
DEBUG:   [           11172]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11173]     >> POLL not sent
DEBUG:   [           11173]     Recorder 3 (9): device status changed into 'not present'
DEBUG:   [           11173]     << Recorder 1 (1) -> Tuner 4 (A): POLL
TRAFFIC: [           11173]     << 1a
DEBUG:   [           11211]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11212]     << 1a
DEBUG:   [           11245]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11246]     >> POLL not sent
DEBUG:   [           11246]     Tuner 4 (A): device status changed into 'not present'
DEBUG:   [           11246]     << Recorder 1 (1) -> Playback 3 (B): POLL
TRAFFIC: [           11246]     << 1b
DEBUG:   [           11278]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11279]     << 1b
DEBUG:   [           11311]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11312]     >> POLL not sent
DEBUG:   [           11312]     Playback 3 (B): device status changed into 'not present'
DEBUG:   [           11312]     << Recorder 1 (1) -> Reserved 1 (C): POLL
TRAFFIC: [           11312]     << 1c
DEBUG:   [           11346]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11346]     << 1c
DEBUG:   [           11379]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11380]     >> POLL not sent
DEBUG:   [           11380]     Reserved 1 (C): device status changed into 'not present'
DEBUG:   [           11380]     << Recorder 1 (1) -> Reserved 2 (D): POLL
TRAFFIC: [           11380]     << 1d
DEBUG:   [           11418]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11418]     << 1d
DEBUG:   [           11451]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11452]     >> POLL not sent
DEBUG:   [           11452]     Reserved 2 (D): device status changed into 'not present'
DEBUG:   [           11452]     << Recorder 1 (1) -> Free use (E): POLL
TRAFFIC: [           11452]     << 1e
DEBUG:   [           11484]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [           11485]     << 1e
DEBUG:   [           11517]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [           11518]     >> POLL not sent
DEBUG:   [           11518]     Free use (E): device status changed into 'not present'
DEBUG:   [           11518]     << requesting active source
TRAFFIC: [           11518]     << 1f:85
DEBUG:   [           12580]     expected response not received (82: active source)
TRAFFIC: [           12580]     << 1f:85
DEBUG:   [           13637]     expected response not received (82: active source)
DEBUG:   [           13637]     << requesting active source
TRAFFIC: [           13637]     << 1f:85
DEBUG:   [           14697]     expected response not received (82: active source)
TRAFFIC: [           14697]     << 1f:85                                                                       
DEBUG:   [           15754]     expected response not received (82: active source)                                           
CEC bus information                                                                                                                   
===================                                                                                                                                 
device #1: Recorder 1
address:       1.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng

currently active source: unknown (-1)
scan
requesting CEC bus information ...
DEBUG:   [           30167]     << Recorder 1 (1) -> TV (0): POLL
TRAFFIC: [           30167]     << 10
DEBUG:   [           30199]     >> POLL sent
DEBUG:   [           30199]     TV (0): device status changed into 'present'
DEBUG:   [           30199]     << requesting active source
TRAFFIC: [           30199]     << 1f:85
TRAFFIC: [           30750]     >> 0f:a0:00:80:45:20:01:11
DEBUG:   [           30750]     >> TV (0) -> Broadcast (F): vendor command with id (A0)
DEBUG:   [           30750]     TV (0): vendor = Panasonic (008045)
TRAFFIC: [           30750]     >> process after replacing vendor handler: >> 0f:a0:00:80:45:20:01:11
DEBUG:   [           30750]     replacing the command handler for device 'TV' (0)
DEBUG:   [           30751]     Recorder 1 (1): vendor = Panasonic (008045)
NOTICE:  [           30751]     changing device type 'recording device' into 'playback device'
NOTICE:  [           30751]     unregistering client: libCEC version = 2.3.0, client version = 2.3.0, firmware version = 4, firmware build date: Thu Dec  6 11:15:20 2012 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-3.18.9-ue-desktop, features: P8_USB, P8_detect, randr
DEBUG:   [           30751]     Recorder 1 (1): power status changed from 'on' to 'unknown'
DEBUG:   [           30751]     Recorder 1 (1): vendor = Unknown (000000)
DEBUG:   [           30751]     Recorder 1 (1): CEC version unknown
DEBUG:   [           30751]     Recorder 1 (1): osd name set to 'Recorder 1'
DEBUG:   [           30751]     expected response received (82: active source)
DEBUG:   [           30751]     Recorder 1 (1): device status changed into 'unknown'
DEBUG:   [           30751]     << requesting CEC version of 'TV' (0)
DEBUG:   [           30751]     setting ackmask to  0
DEBUG:   [           30755]     turning controlled mode off
DEBUG:   [           30761]     turning controlled mode on
opdenkamp commented 9 years ago

should be solved in libCEC 3.0.0

UEckhardt commented 9 years ago

Thanks, works fine now with 3.0.0