Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
B0GDAN opened this issue Mar 6, 2022 · 17 comments
Open

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

B0GDAN opened this issue Mar 6, 2022 · 17 comments

Comments

@B0GDAN
Copy link

B0GDAN commented Mar 6, 2022

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
Copy link
Author

B0GDAN commented Mar 6, 2022

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
Copy link
Contributor

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
Copy link
Author

B0GDAN commented Mar 16, 2022

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
Copy link
Author

B0GDAN commented Apr 7, 2022

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
Copy link

Anyone know WHY this is happening?

@popcornmix
Copy link
Contributor

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
Copy link

darton commented Nov 21, 2022

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
Copy link

So a fix or code update is still pending?

@jdgorman58
Copy link

jdgorman58 commented Mar 20, 2023

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
Copy link

Jibun-no-Kage commented Mar 20, 2023

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
Copy link

iwl commented Feb 17, 2024

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

@milux
Copy link

milux commented Nov 18, 2024

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

This can have serious performance impact even when it works.

Our Pi stopped booting its UI after this change!

For us, the issue lied with the command itself.
We realized the mistake after a long hour of frustrating debugging attempts when we executed echo 'scan' | cec-client -s -d 1 and saw that Recorder 1 (Pulse Eight CECTester) had changed its address from 2.0.0.0 to 1.0.0.0.
Turned out that the "source address" contained in the command at byte 1 had to be changed due to the upgrade:

echo 'tx 2F:82:10:00' | cec-client -s -d 1 output (not working):

opening a connection to the CEC adapter...
ERROR:   [            2062]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=22

echo 'tx 1F:82:10:00' | cec-client -s -d 1 output (working!):

opening a connection to the CEC adapter...

So, it might be as easy as trying a slightly different address...

Copy link

This issue has now been marked as stale because there hasn't been any activity for 90 days. Please test if this issue is still relevant when using the latest version of libCEC and remove the stale label or add a comment to reset the stale state.

@github-actions github-actions bot added stale Automatically closed stale issues and pull requests and removed stale Automatically closed stale issues and pull requests labels Feb 26, 2025
@opdenkamp
Copy link
Contributor

stop posting the exact same comment in every ticket @Jibun-no-Kage. removing your comments here.

@pka4916 you have subscribed yourself to updates from this repository and a bot just closed a lot of old tickets in here. if you don't want to receive those emails, then you have to unsubscribe.

@Pulse-Eight Pulse-Eight deleted a comment from Jibun-no-Kage Feb 27, 2025
@Pulse-Eight Pulse-Eight deleted a comment from Jibun-no-Kage Feb 27, 2025
@Pulse-Eight Pulse-Eight deleted a comment from pka4916 Feb 27, 2025
@pka4916
Copy link

pka4916 commented Feb 27, 2025 via email

@opdenkamp
Copy link
Contributor

@pka4916 if you're getting those emails, then you're watching this repository. check the button watch/unwatch on https://github.com/Pulse-Eight/libcec to control this. I suspect that you've clicked watch when you starred this repos. I can't control this for you, you have to change this yourself to get rid of this email spam.

@opdenkamp
Copy link
Contributor

Is this still an issue when using libCEC 7.0.0?

@opdenkamp opdenkamp marked this as a duplicate of #653 Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants