Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

xrandr Not Finding HDMI-1 Without Display Being Set #8

Open
john3300 opened this issue Apr 24, 2023 · 5 comments
Open

xrandr Not Finding HDMI-1 Without Display Being Set #8

john3300 opened this issue Apr 24, 2023 · 5 comments

Comments

@john3300
Copy link

I was just testing your module and was having trouble with thexrandr commands not having any effect. I added some additional logging to the exec() command to capture stderr and found this for both turning the display on and off:

[ERROR] stderr: warning: output HDMI-1 not found; ignoring

After a bit of playing around I was able to get it to work by changing the exec() lines in node_helper.js from:
exec("xrandr --output " ...
to:
exec("DISPLAY=:0 xrandr --output " ...

With this change in place, both on and off are working. I don't know why my system needs that to work, but I thought I would share it with you in case this is something you haven't seen before. Maybe something to add to your implementation? I can submit a PR with the change if you would like.

Here's my system information if you're interested:

pi@magicmirror:~/MagicMirror $ lsb_release -r
Release:	11
pi@magicmirror:~/MagicMirror $ uname -a
Linux magicmirror 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux
pi@magicmirror:~/MagicMirror $ cat /proc/cpuinfo | grep Model
Model		: Raspberry Pi 3 Model B Plus Rev 1.3

And here's my config.js entry:

{
    module: "MMM-PIR-Sensor-Lite",
    position: "bottom_left",
    config: {
        sensorPin: 4,
        rotation: "right",
        deactivateDelay: 1 * 60 * 1000,
    }
}
@grenagit
Copy link
Owner

Strange, everything works fine for me (same config)...
What is the result of xrandr --listmonitors?

@john3300
Copy link
Author

pi@magicmirror:~ $ xrandr --listmonitors
Can't open display 
pi@magicmirror:~ $ DISPLAY=:0 xrandr --listmonitors
Monitors: 0

@umbynos
Copy link

umbynos commented Oct 13, 2023

Same problem here with this setup:

umberto@magicmirror:~ $ lsb_release -r
No LSB modules are available.
Release:	12
umberto@magicmirror:~ $ uname -a
Linux magicmirror 6.1.0-rpi4-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64 GNU/Linux
umberto@magicmirror:~ $ cat /proc/cpuinfo | grep Model
Model		: Raspberry Pi 3 Model B Rev 1.2

and this config:

               {
                        module: "MMM-PIR-Sensor-Lite",
                        position: "top_right",
                        config: {
                                sensorPin: 4, // GPIO pin
                                commandType: "xrandr",
                                hdmiPort: "HDMI-1",
                                rotation: "left",
                                deactivateDelay: 10 * 60 * 1000, //10 mins
                        }
                },

@gonzonia
Copy link

I found that I needed to set the display when I was connected over SSH. If I ran the commands directly from the machine it worked. I don't know if that helps you, but it might point you in the right direction for finding a solution.

@ehrenberg
Copy link

I found that I needed to set the display when I was connected over SSH. If I ran the commands directly from the machine it worked. I don't know if that helps you, but it might point you in the right direction for finding a solution.

And how to set the Display? Can you give more Informations please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants