Pulse-Eight / libcec

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

cec-client fails to swtich HDMI inputs on raspbian #597

Open B0GDAN opened 2 years ago

B0GDAN commented 2 years ago

It appears that the cec-client has a serious bug on Raspbian GNU/Linux 11 (bullseye)

echo 'tx 4F:82:10:00' | cec-client -s -d 1 opening a connection to the CEC adapter... ERROR: [ 4266] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=22

Worked flawlessly on the previous version of raspbian. Any ideas, workarounds?

Thanks Bogdan

B0GDAN commented 2 years ago

echo "tx 4F:82:10:00" | cec-client -s opening a connection to the CEC adapter... DEBUG: [ 87] Broadcast (F): osd name set to 'Broadcast' DEBUG: [ 87] CLinuxCECAdapterCommunication::Open - m_path=/dev/cec0 m_fd=4 bStartListening=1 DEBUG: [ 87] CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_G_PHYS_ADDR - addr=2000 DEBUG: [ 87] CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=0000 num_log_addrs=0 DEBUG: [ 88] CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=8000 num_log_addrs=1 NOTICE: [ 88] connection opened DEBUG: [ 88] CLinuxCECAdapterCommunication::Process - CEC_DQEVENT - CEC_EVENT_STATE_CHANGE - log_addr_mask=8000 phys_addr=2000 DEBUG: [ 88] processor thread started DEBUG: [ 88] << Broadcast (F) -> TV (0): POLL TRAFFIC: [ 88] << f0 DEBUG: [ 394] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=1 addr=f0 opcode=ffffffff DEBUG: [ 395] >> POLL sent DEBUG: [ 395] TV (0): device status changed into 'present' DEBUG: [ 395] << requesting vendor ID of 'TV' (0) TRAFFIC: [ 395] << f0:8c DEBUG: [ 462] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=2 addr=f0 opcode=8c DEBUG: [ 1462] expected response not received (87: device vendor id) TRAFFIC: [ 1462] << f0:8c DEBUG: [ 1515] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=2 addr=f0 opcode=8c DEBUG: [ 2516] expected response not received (87: device vendor id) DEBUG: [ 2516] registering new CEC client - v6.0.2 DEBUG: [ 2516] SetClientVersion - using client version '6.0.2' NOTICE: [ 2516] setting HDMI port to 1 on device TV (0) DEBUG: [ 2517] SetConfiguration: double tap timeout = 200ms, repeat rate = 0ms, release delay = 500ms DEBUG: [ 2517] detecting logical address for type 'recording device' DEBUG: [ 2517] trying logical address 'Recorder 1' DEBUG: [ 2517] << Recorder 1 (1) -> Recorder 1 (1): POLL TRAFFIC: [ 2517] << 11 DEBUG: [ 2579] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=24 len=1 addr=11 opcode=ffffffff TRAFFIC: [ 2580] << 11 DEBUG: [ 2651] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=24 len=1 addr=11 opcode=ffffffff DEBUG: [ 2651] >> POLL not sent DEBUG: [ 2651] using logical address 'Recorder 1' DEBUG: [ 2651] Recorder 1 (1): device status changed into 'handled by libCEC' DEBUG: [ 2651] Recorder 1 (1): power status changed from 'unknown' to 'on' DEBUG: [ 2652] Recorder 1 (1): vendor = Pulse Eight (001582) DEBUG: [ 2652] Recorder 1 (1): CEC version 1.4 DEBUG: [ 2652] AllocateLogicalAddresses - device '0', type 'recording device', LA '1' DEBUG: [ 2652] CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=0000 num_log_addrs=0 DEBUG: [ 2652] CLinuxCECAdapterCommunication::Process - CEC_DQEVENT - CEC_EVENT_STATE_CHANGE - log_addr_mask=0000 phys_addr=2000 DEBUG: [ 2794] CLinuxCECAdapterCommunication::Process - CEC_DQEVENT - CEC_EVENT_STATE_CHANGE - log_addr_mask=0002 phys_addr=2000 DEBUG: [ 2794] changing physical address to 2000 DEBUG: [ 2794] Recorder 1 (1): physical address changed from ffff to 2000 DEBUG: [ 2794] CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=0002 num_log_addrs=1 DEBUG: [ 2795] Recorder 1 (1): osd name set to 'CECTester' DEBUG: [ 2795] Recorder 1 (1): menu language set to 'eng' DEBUG: [ 2795] using provided physical address 2000 NOTICE: [ 2795] CEC client registered: libCEC version = 6.0.2, client version = 6.0.2, firmware version = 0, logical address(es) = Recorder 1 (1) , physical address: 2.0.0.0, compiled on Linux-5.10.63-v8+ ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, Linux, AOCEC DEBUG: [ 2795] << Recorder 1 (1) -> TV (0): OSD name 'CECTester' TRAFFIC: [ 2795] << 10:47:43:45:43:54:65:73:74:65:72 DEBUG: [ 3351] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=11 addr=10 opcode=47 DEBUG: [ 3351] << requesting power status of 'TV' (0) TRAFFIC: [ 3351] << 10:8f DEBUG: [ 3418] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=2 addr=10 opcode=8f DEBUG: [ 3502] CLinuxCECAdapterCommunication::Process - ioctl CEC_RECEIVE - rx_status=01 len=2 addr=01 opcode=8f TRAFFIC: [ 3502] >> 01:8f DEBUG: [ 3502] << Recorder 1 (1) -> TV (0): on TRAFFIC: [ 3502] << 10:90:00 DEBUG: [ 3502] >> TV (0) -> Recorder 1 (1): give device power status (8F) DEBUG: [ 3589] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=3 addr=10 opcode=90 DEBUG: [ 3662] CLinuxCECAdapterCommunication::Process - ioctl CEC_RECEIVE - rx_status=01 len=2 addr=01 opcode=46 TRAFFIC: [ 3662] >> 01:46 DEBUG: [ 3662] << Recorder 1 (1) -> TV (0): OSD name 'CECTester' TRAFFIC: [ 3662] << 10:47:43:45:43:54:65:73:74:65:72 DEBUG: [ 3663] >> TV (0) -> Recorder 1 (1): give osd name (46) DEBUG: [ 3941] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=11 addr=10 opcode=47 DEBUG: [ 4042] CLinuxCECAdapterCommunication::Process - ioctl CEC_RECEIVE - rx_status=01 len=3 addr=01 opcode=90 TRAFFIC: [ 4042] >> 01:90:00 DEBUG: [ 4042] TV (0): power status changed from 'unknown' to 'on' DEBUG: [ 4042] expected response received (90: report power status) DEBUG: [ 4042] >> TV (0) -> Recorder 1 (1): report power status (90) TRAFFIC: [ 4042] << 4f:82:10:00 ERROR: [ 4042] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=22 DEBUG: [ 4042] unregistering all CEC clients NOTICE: [ 4042] unregistering client: libCEC version = 6.0.2, client version = 6.0.2, firmware version = 0, logical address(es) = Recorder 1 (1) , physical address: 2.0.0.0, compiled on Linux-5.10.63-v8+ ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, Linux, AOCEC DEBUG: [ 4042] Recorder 1 (1): power status changed from 'on' to 'unknown' DEBUG: [ 4042] Recorder 1 (1): vendor = Unknown (000000) DEBUG: [ 4042] Recorder 1 (1): CEC version unknown DEBUG: [ 4042] Recorder 1 (1): osd name set to 'Recorder 1' DEBUG: [ 4042] Recorder 1 (1): device status changed into 'unknown' DEBUG: [ 4042] CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=0000 num_log_addrs=0 DEBUG: [ 4042] CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=0000 num_log_addrs=0 DEBUG: [ 4042] unregistering all CEC clients DEBUG: [ 4042] CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=0000 num_log_addrs=0 DEBUG: [ 4047] CLinuxCECAdapterCommunication::Process - CEC_DQEVENT - CEC_EVENT_STATE_CHANGE - log_addr_mask=0000 phys_addr=2000 DEBUG: [ 5053] CLinuxCECAdapterCommunication::Process - stopped - m_path=/dev/cec0 m_fd=4 DEBUG: [ 5053] CLinuxCECAdapterCommunication::Close - m_path=/dev/cec0 m_fd=4

popcornmix commented 2 years ago

Post output of: vcgencmd version uname -a

and contents of config.txt. Does it work if you change dtoverlay=vc4-kms-v3d to dtoverlay=vc4-fkms-v3d in config.txt (and reboot).

B0GDAN commented 2 years ago

pi@xx:~ $ vcgencmd version Jan 20 2022 13:56:48 Copyright (c) 2012 Broadcom version bd88f66f8952d34e4e0613a85c7a6d3da49e13e2 (clean) (release) (start) pi@xx:~ $ uname -a Linux xx 5.10.92-v7l+ #1514 SMP Mon Jan 17 17:38:03 GMT 2022 armv7l GNU/Linux

I will try your recommendation regarding dtoverlay

B0GDAN commented 2 years ago

Post output of: vcgencmd version uname -a

and contents of config.txt. Does it work if you change dtoverlay=vc4-kms-v3d to dtoverlay=vc4-fkms-v3d in config.txt (and reboot).

It works again ;) Thanks a lot!

Jibun-no-Kage commented 2 years ago

Anyone know WHY this is happening?

popcornmix commented 2 years ago

I tested and it occurs with -d 1. It didn't appear to occur with other values. e.g. -d 2. Is that the same for others?

darton commented 1 year ago

echo 'on 0.0.0.0' | cec-client -s -d 1 opening a connection to the CEC adapter... Segmentation fault

It takes quite a long time and ends with an error, but it works

dtoverlay=vc4-kms-v3d

dtoverlay=vc4-fkms-v3d max_framebuffers=2


Oct 26 2022 11:09:05 Copyright (c) 2012 Broadcom version c72ad6b26ff40c91ef776b847436094ee63fabee (clean) (release) (start) pi@raspberrypi:~ $ uname -a Linux raspberrypi 5.15.76-v8+ #1597 SMP PREEMPT Fri Nov 4 12:16:41 GMT 2022 aarch64 GNU/Linux

Jibun-no-Kage commented 1 year ago

So a fix or code update is still pending?

jdgorman58 commented 1 year ago

Post output of: vcgencmd version uname -a

and contents of config.txt. Does it work if you change dtoverlay=vc4-kms-v3d to dtoverlay=vc4-fkms-v3d in config.txt (and reboot).

Had the same issues until I found this thread. The change suggested work flawlessly.. Thank you Popcornmix!

Jibun-no-Kage commented 1 year ago

Using 'fkms' did help, I discovered that right after I asked about the status of this issue. As for the version, it was the older kernel and current Pi OS 11 at the time I asked. the OS has moved on since, but have not used CEC much lately, since I have started using IP based control on devices that support it. However, I still have a couple of TVs that are older and don't have IP control but have CEC is I can re-test. BUT... the question still STANDS... is there not going to be a fix? Using 'fkms' is NOTHING but a temporary fix, work-around, a segmentation fault SHOULD be eliminated, that is the real issue.

iwl commented 4 months ago

I still get that error: tx 1f:82:11:00 ERROR: [ 13518] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=22 other than tx commands seem to work