WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: hdmi output  (Read 498 times)

Offline jbbum

  • Newbie
  • *
  • Posts: 39
hdmi output
« on: May 01, 2024, 10:05:02 AM »
is there a way to monitor if raspberry 0w hdmi output is active?  (iow)Have pi 0w output only when selected as input to monitor.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11256
Re: hdmi output
« Reply #1 on: May 01, 2024, 11:31:47 AM »
Hi jbbum
It sounds like you want to be able to test if a monitor is connected
to the HDMI port.

I do that with another video port on a laptop to see if an external
monitor is connected:
Code: [Select]
if [ $(cat /sys/class/drm/card0-VGA-1/status) = "connected" ]
then
        # Copy our special xorg.conf where Xorg can find it.
        busybox cp -f xorg.conf.2monitors /etc/X11/xorg.conf
        Monitors=2
fi

I don't know if pi uses a similar layout, but start by looking for a subdirectory
with HDMI in its name under  /sys/class/drm/.

Offline jbbum

  • Newbie
  • *
  • Posts: 39
Re: hdmi output
« Reply #2 on: May 01, 2024, 01:13:05 PM »
Hi Rich,
Scenario-Raspberry pi 0w connected as input to TV. Pi is programmed with ffmpeg to access stream from esp32 webcam and output to fbdev, no X, want pi to be idle with no stream output until the pi is selected on the tv with the "input or source" button on remote, a cli is then ran to access stream from esp32 webcam.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11256
Re: hdmi output
« Reply #3 on: May 01, 2024, 02:07:41 PM »
Hi jbbum
Maybe  udev  would be of some help?
Try this:
Code: [Select]
udevadm monitorThen toggle the "input or source" button on remote and
see if any events are generated.

Offline jbbum

  • Newbie
  • *
  • Posts: 39
Re: hdmi output
« Reply #4 on: May 01, 2024, 02:30:38 PM »
Hi Rich
Got no responses.

Offline jbbum

  • Newbie
  • *
  • Posts: 39
Re: hdmi output
« Reply #5 on: May 02, 2024, 11:07:24 AM »
Found this "cec-client which is part of cec utils package on raspbian.  Checking to see if it can be loaded on piCore, and achiece desired result.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 675
Re: hdmi output
« Reply #6 on: May 02, 2024, 12:58:56 PM »
https://libcec.pulse-eight.com/

https://github.com/Pulse-Eight/libcec

Also found this text on there site:

Quote
If your TV cannot detect the Raspberry Pi's CEC, or if the the Pi can't detect the TV, try adding the following line in /boot/config.txt and reboot the Pi: hdmi_force_hotplug=1
« Last Edit: May 02, 2024, 01:02:30 PM by patrikg »

Offline jbbum

  • Newbie
  • *
  • Posts: 39
Re: hdmi output
« Reply #7 on: May 09, 2024, 10:55:21 AM »
Trying to get cec-utils over to piCore but can't get libudev.so.1 required by cec-client.  There is no libudev.tcz in 14.xv7 and the 13.x does not include libudev.so.1.  Is there a way to get updated library without using the debian version with all the unnessary dependencies?

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1089
Re: hdmi output
« Reply #8 on: May 09, 2024, 01:56:53 PM »
The extension is udev-lib.tcz


Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1089
Re: hdmi output
« Reply #9 on: May 09, 2024, 01:58:03 PM »
The extension is udev-lib.tcz

I have not invested time in cec packaging, because every application I've heard of works only about 75% of what the user needs.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11256
Re: hdmi output
« Reply #10 on: May 09, 2024, 02:27:00 PM »
Hi jbbum
... There is no libudev.tcz in 14.xv7 and the 13.x does not include libudev.so.1. ...
Tinycore/piCore only have libudev.so.0 because they run an older
version of udev. I'm not certain, but I think that later versions of
udev are somehow tied to systemd.

Offline jbbum

  • Newbie
  • *
  • Posts: 39
Re: hdmi output
« Reply #11 on: May 11, 2024, 08:13:14 AM »
Hi Rich,
You are probably correct.  Did manage to get dependencies loaded, including 'libudev1' but ran into an error with libcec.  Sorry but I didn't note the error as I gave up at that point.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14570
Re: hdmi output
« Reply #12 on: May 11, 2024, 08:40:22 AM »
It is possible to run later versions of the udev library (libudev.so.1) alongside the tinycore version, you have to be careful when compiling though.