Open cihlarma opened 2 years ago
It's not a function that the kernel driver should undertake (it was the firmware under legacy and vc4-fkms-v3d). libcec should be able to do that for you though - IIRC Kodi makes use of it in that way. I can't recall if you need to setup udev rules or not.
Where in the userspace should this be implemented then? Should this be done by the graphical environment, or perhaps by a script run as a service by systemd at boot?
I'd recommend cec-ctl rather than libcec (which is largely unmaintained).
Odd thing about cec-ctl there are times if does not seem to work. For example, I have a Vizio TV that just seems to refuse to work with cec-ctl but works fine with libcec, i.e. cec-client. Makes no sense but true.
I'd recommend cec-ctl rather than libcec (which is largely unmaintained).
Thank you for that tip. I tried, but unfortunately I didn't get cec-ctl working either. It seems to have similar types of problems that I have in cec-client now.
I'm new here, and it's possible that I just haven't realized some basic things that I should know. Also I may have posted this to a wrong place - please notice me if so. Anyway I have searched the forums a lot and tested everything quite patiently.
I have been reading these discussions here and in Raspberry Pi forum to get a solution to a problem with libcec with Full KMS. It really seems to me like that, when I switch from kms to fake kms (fkms) in /boot/config.txt, cec-client works with absolutely no errors, just like it's supposed according to the manual. I have understood that probably libcec isn't just working well with Full KMS, but what about cec-ctl?
When Full kms is enabled, cec-client first seems to communicate with the TV: It wakes up with 'on 0' and switches the active source from the TV cable broadcast to the Raspberry Pi with 'as'. But when I switch the TV with its own remote control to another HDMI or to any other source, CEC seems mess up. After that the communication with the TV fails, and will not recover to the original.
My LG television uses CEC version 1.3a, so it might be also a compatibility problem with the versions. But it still works with the Fake KMS, so there's still something different in CEC functionality between the Fake and the Full KMS. And 1.3a isn't really so old, is it? :) I'd like to test this with a TV that supports CEC 2.0 later. My goal is to get this working with new and old televisions, so trying TV with the CEC 2.0 support wouldn't be the solution, but just a part of the troubleshooting.
Cec-client with Full KMS:
When switching the TV to another HDMI from the TV itself, cec-client immediately prints out this: 'DEBUG: [ 48301] changing physical address to FFFF DEBUG: [ 48301] SetDevicePhysicalAddress - not setting invalid physical address ffff'
'scan' command shows that the TV's power status has changed from 'on' to 'unknown', and it also shows up in the cec output: TV (0): power status changed from 'on' to 'unknown'
After that I try to switch the Raspberry Pi to the active source with 'as', cec-client starts flooding these messages eternally: DEBUG: [ 340915] TransmitImageViewOn - 'image view on' already sent NOTICE: [ 340915] << Recorder 1 (1) -> broadcast (F): active source (1000) TRAFFIC: [ 340915] << 1f:82:10:00 ERROR: [ 340915] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64 TRAFFIC: [ 340915] << 1f:82:10:00 ERROR: [ 340915] CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64 DEBUG: [ 340915] failed to make 'Recorder 1' the active source. will retry later DEBUG: [ 341915] TransmitImageViewOn - 'image view on' already sent
After that has happened, the game is over: I can switch the TV manually to the Raspberry Pi's HDMI input, so that cec-client calms down. I can also still switch the tv on with 'on 0'. But the problem is that, 'as' command is not working anymore.
Cec-ctl with Full KMS
I found your reply that cec-ctl is not using libcec, which is probably in the center of this problem, so of course I gave it an opportunity: sudo cec-ctl -d/dev/cec0 --playback -S --cec-version-1.4 Shows the topology 'almost' correctly, and shows that the TV is on. I have also tested the same with cec 2.0, but there was no change. This is the only point in the outcome that shows something incorrect: CEC Version : Tx, OK, Rx, Timeout Physical Address : Tx, OK, Rx, Timeout
sudo cec-ctl -d/dev/cec0 --to 0 --image-view-on --cec-version-1.4 This wakes the TV up, at least on the second try.
sudo cec-ctl -d/dev/cec0 --to 0 --active-source phys-addr=1.0.0.0 --cec-version-1.4 This doesn't do anything. Also there's two things wrong in the outprint: 1) Physical Address : f.f.f.f 2) Logical Address : Not Allocated
Here's some information on my Raspberry Pi 3 Model B:
$ uname -a Linux rpi3 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
$ cat /etc/rpi-issue Raspberry Pi reference 2023-12-05 Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 446f3e34c8ceb33dfe7bd38578f1cd6b6afe19da, stage2
$ vcgencmd version Mar 17 2023 10:52:42 Copyright (c) 2012 Broadcom version 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean) (release) (start)
I'd be grateful for any help.
I might be tempted to add:
vc4.force_hotplug=1
(assuming you are using first hdmi port - HDMI_A_0) to cmdline.txt (on same line).
Reboot and see if anything is different.
But this is just a guess.
I might be tempted to add:
vc4.force_hotplug=1
(assuming you are using first hdmi port - HDMI_A_0) to cmdline.txt (on same line). Reboot and see if anything is different.But this is just a guess.
Thank you so much! That was the solution.
Cec-client is now working properly and switches the source rapidly by the command to the Raspberry Pi from any other source.
For some reason, cec-ctl is not working, but that's not a problem anymore. I'll go with cec-client or libcec-python.
Describe the bug
With
dtoverlay=vc4-fkms-v3d
my CEC-capable TV automatically turns on and changes to the correct input source when the Raspberry Pi is turned on. Withdtoverlay=vc4-kms-v3d
this does not happen.Steps to reproduce the behaviour
2022-09-22-raspios-bullseye-armhf
)dtoverlay=vc4-kms-v3d
inconfig.txt
todtoverlay=vc4-fkms-v3d
Device (s)
Raspberry Pi 4 Mod. B
System
Logs
Full boot dmesg output
``` [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083] [ 0.000000] Linux version 5.15.76-v8+ (dom@buildbot) (aarch64-linux-gnu-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1597 SMP PREEMPT Fri Nov 4 12:16:41 GMT 2022 [ 0.000000] random: crng init done [ 0.000000] Machine model: Raspberry Pi 4 Model B Rev 1.2 [ 0.000000] efi: UEFI not found. [ 0.000000] Reserved memory: created CMA memory pool at 0x000000001ac00000, size 320 MiB [ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000000000000-0x000000003fffffff] [ 0.000000] DMA32 [mem 0x0000000040000000-0x00000000fbffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000000000-0x000000002fffffff] [ 0.000000] node 0: [mem 0x0000000040000000-0x00000000fbffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000000fbffffff] [ 0.000000] On node 0, zone DMA32: 16384 pages in unavailable ranges [ 0.000000] percpu: Embedded 28 pages/cpu s77336 r8192 d29160 u114688 [ 0.000000] pcpu-alloc: s77336 r8192 d29160 u114688 alloc=28*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Detected PIPT I-cache on CPU0 [ 0.000000] CPU features: detected: Spectre-v2 [ 0.000000] CPU features: detected: Spectre-v3a [ 0.000000] CPU features: detected: Spectre-v4 [ 0.000000] CPU features: detected: Spectre-BHB [ 0.000000] CPU features: kernel page table isolation forced ON by KASLR [ 0.000000] CPU features: detected: Kernel page table isolation (KPTI) [ 0.000000] CPU features: detected: ARM erratum 1742098 [ 0.000000] CPU features: detected: ARM errata 1165522, 1319367, or 1530923 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 951552 [ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:1920x1080M@60 smsc95xx.macaddr=DC:A6:32:7D:A2:9B vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=PARTUUID=82b0393a-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles [ 0.000000] Unknown kernel command line parameters "splash", will be passed to user space. [ 0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear) [ 0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] software IO TLB: mapped [mem 0x0000000016c00000-0x000000001ac00000] (64MB) [ 0.000000] Memory: 3374040K/3866624K available (11520K kernel code, 1956K rwdata, 4148K rodata, 3840K init, 975K bss, 164904K reserved, 327680K cma-reserved) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 [ 0.000000] ftrace: allocating 38059 entries in 149 pages [ 0.000000] ftrace: allocated 149 pages with 4 groups [ 0.000000] trace event string verifier disabled [ 0.000000] rcu: Preemptible hierarchical RCU implementation. [ 0.000000] rcu: RCU event tracing is enabled. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4. [ 0.000000] Trampoline variant of Tasks RCU enabled. [ 0.000000] Rude variant of Tasks RCU enabled. [ 0.000000] Tracing variant of Tasks RCU enabled. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4 [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 [ 0.000000] Root IRQ handler: gic_handle_irq [ 0.000000] GIC: Using split EOI/Deactivate mode [ 0.000000] irq_brcmstb_l2: registered L2 intc (/soc/interrupt-controller@7ef00100, parent irq: 10) [ 0.000000] arch_timer: cp15 timer(s) running at 54.00MHz (phys). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns [ 0.000000] sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns [ 0.000344] Console: colour dummy device 80x25 [ 0.000396] printk: console [tty1] enabled [ 0.000458] Calibrating delay loop (skipped), value calculated using timer frequency.. 108.00 BogoMIPS (lpj=216000) [ 0.000484] pid_max: default: 32768 minimum: 301 [ 0.000628] LSM: Security Framework initializing [ 0.000860] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear) [ 0.000930] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear) [ 0.002228] cgroup: Disabling memory control group subsystem [ 0.005129] rcu: Hierarchical SRCU implementation. [ 0.006282] EFI services will not be available. [ 0.006818] smp: Bringing up secondary CPUs ... [ 0.007933] Detected PIPT I-cache on CPU1 [ 0.008020] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 0.009228] Detected PIPT I-cache on CPU2 [ 0.009280] CPU2: Booted secondary processor 0x0000000002 [0x410fd083] [ 0.010448] Detected PIPT I-cache on CPU3 [ 0.010497] CPU3: Booted secondary processor 0x0000000003 [0x410fd083] [ 0.010649] smp: Brought up 1 node, 4 CPUs [ 0.010672] SMP: Total of 4 processors activated. [ 0.010684] CPU features: detected: 32-bit EL0 Support [ 0.010695] CPU features: detected: 32-bit EL1 Support [ 0.010707] CPU features: detected: CRC32 instructions [ 0.043579] CPU: All CPU(s) started at EL2 [ 0.043658] alternatives: patching kernel code [ 0.045336] devtmpfs: initialized [ 0.056453] Enabled cp15_barrier support [ 0.056506] Enabled setend support [ 0.056535] KASLR enabled [ 0.056739] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.056775] futex hash table entries: 1024 (order: 4, 65536 bytes, linear) [ 0.066068] pinctrl core: initialized pinctrl subsystem [ 0.066899] DMI not present or invalid. [ 0.067599] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 0.071443] DMA: preallocated 1024 KiB GFP_KERNEL pool for atomic allocations [ 0.071748] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations [ 0.072703] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations [ 0.072806] audit: initializing netlink subsys (disabled) [ 0.073102] audit: type=2000 audit(0.072:1): state=initialized audit_enabled=0 res=1 [ 0.073668] thermal_sys: Registered thermal governor 'step_wise' [ 0.073977] cpuidle: using governor menu [ 0.074326] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers. [ 0.074529] ASID allocator initialised with 32768 entries [ 0.074703] Serial: AMBA PL011 UART driver [ 0.087955] bcm2835-mbox fe00b880.mailbox: mailbox enabled [ 0.112420] raspberrypi-firmware soc:firmware: Attached to firmware from 2022-10-26T11:09:05, variant start [ 0.116432] raspberrypi-firmware soc:firmware: Firmware hash is c72ad6b26ff40c91ef776b847436094ee63fabee [ 0.167407] bcm2835-dma fe007000.dma: DMA legacy API manager, dmachans=0x1 [ 0.171646] vgaarb: loaded [ 0.172065] SCSI subsystem initialized [ 0.172287] usbcore: registered new interface driver usbfs [ 0.172340] usbcore: registered new interface driver hub [ 0.172417] usbcore: registered new device driver usb [ 0.172885] usb_phy_generic phy: supply vcc not found, using dummy regulator [ 0.173085] usb_phy_generic phy: dummy supplies not allowed for exclusive requests [ 0.173391] pps_core: LinuxPPS API ver. 1 registered [ 0.173404] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo GiomettiAdditional context
config.txt
``` # For more options and information see # http://rpf.io/configtxt # Some settings may impact device functionality. See link above for details # uncomment if you get no picture on HDMI for a default "safe" mode #hdmi_safe=1 # uncomment the following to adjust overscan. Use positive numbers if console # goes off screen, and negative if there is too much border #overscan_left=16 #overscan_right=16 #overscan_top=16 #overscan_bottom=16 # uncomment to force a console size. By default it will be display's size minus # overscan. #framebuffer_width=1280 #framebuffer_height=720 # uncomment if hdmi display is not detected and composite is being output #hdmi_force_hotplug=1 # uncomment to force a specific HDMI mode (this will force VGA) #hdmi_group=1 #hdmi_mode=1 # uncomment to force a HDMI mode rather than DVI. This can make audio work in # DMT (computer monitor) modes #hdmi_drive=2 # uncomment to increase signal to HDMI, if you have interference, blanking, or # no display #config_hdmi_boost=4 # uncomment for composite PAL #sdtv_mode=2 #uncomment to overclock the arm. 700 MHz is the default. #arm_freq=800 # Uncomment some or all of these to enable the optional hardware interfaces #dtparam=i2c_arm=on #dtparam=i2s=on #dtparam=spi=on # Uncomment this to enable infrared communication. #dtoverlay=gpio-ir,gpio_pin=17 #dtoverlay=gpio-ir-tx,gpio_pin=18 # Additional overlays and parameters are documented /boot/overlays/README # Enable audio (loads snd_bcm2835) dtparam=audio=on # Automatically load overlays for detected cameras camera_auto_detect=1 # Automatically load overlays for detected DSI displays display_auto_detect=1 # Enable DRM VC4 V3D driver dtoverlay=vc4-kms-v3d max_framebuffers=2 # Disable compensation for displays with overscan disable_overscan=1 [cm4] # Enable host mode on the 2711 built-in XHCI USB controller. # This line should be removed if the legacy DWC2 controller is required # (e.g. for USB device mode) or if USB support is not required. otg_mode=1 [all] [pi4] # Run as fast as firmware / board allows arm_boost=1 [all] gpu_mem=256 [all] dtoverlay=gpio-fan,gpiopin=14,temp=75000 [pi4] arm_64bit=1 hdmi_enable_4kp60=1 ```Related: documentation/#2699