0

I'm running Ubuntu 18.04.1 LTS Desktop.

I'm connecting to the desktop via remote SSH session.

I'm trying to get the current resolution for the currently active local session.

I found these seemingly relevant questions:

However, xdpyinfo returns the following error:

xdpyinfo:  unable to open display "".

and xrandr returns a similar error:

Can't open display

I'm assuming this is because there is no display connected to my remote SSH session. I've tried switching (su) to the same user as the local session, but the error is the same - I assume for the same reason: no display related to that SSH session.

So, I tried the suggestions from my third link above.

$ export DISPLAY=:0
$ xdpyinfo
No protocol specified
xdpyinfo:  unable to open display ":0"

and

$ xrandr --display :0
No protocol specified
Can't open display :0

How can I poll the display on the active local session for resolution (dimension) info from a remote SSH session?

  • I am not sure whether I understand your question correctly. Might these two questions, plus answers, be of help to you? - askubuntu.com/questions/1066721/… - askubuntu.com/questions/1061354/… – Joe Sep 23 '18 at 9:23
  • I don't see how either of those questions would be relevant. They both discuss headless servers. I am connecting to an Ubuntu Desktop install with a currently active local session running on a physically connected monitor. I want to poll the local session for the current resolution of the physically connected monitor. – Daniel Sep 23 '18 at 14:30
  • I thought it could be relevant as you describe that "there is no display connected to my remote SSH session." – Joe Sep 24 '18 at 15:23
  • I see, but both of your links are about completely headless servers with no physical display, and the solutions seem to revolve around connecting to a "virtual" display. I need to connect to the physically connected display to poll its current resolution. – Daniel Sep 24 '18 at 16:16
  • what are you attempting to achieve ? to launch a UI app on remote box and display locally ? – Scott Stensland Sep 26 '18 at 16:38
1

1. You can try this command

cat /sys/class/drm/*/modes

or to get more info

grep . /sys/class/drm/*/modes

To get the status of each device, type

grep . /sys/class/drm/*/status

2. Or read the monitor screen data

Extended Display Identification Data (EDID): This standard defines data formats to carry configuration information, allowing optimum use of displays.

A monitor typically supports multiple resolutions and refreshrates. Of course someone will prefer the maximum (physical) one.

To read this monitor data, try one of these solutions:

  • edid-decode

    If not installed, type

    sudo apt install edid-decode
    

    Then read the edid file

    edid-decode /sys/class/drm/card0-eDP-1/edid
    
  • read-edid

    Install with

    sudo apt install read-edid 
    

    Then read via i2c the screen monitor data and parse it

    sudo get-edid | parse-edid
    
  • Hexdump the edid data

    In case edid-tools are not installed, you can dump the edid hex-file, e.g.:

    hd /sys/class/drm/card0-eDP-1/edid
    

    To encrypt this hex file take a look at wiki or download the edid specifications.

  • This sort of works. It looks like it is giving me available resolutions for the connected device, but it doesn't give me the actual, current resolution. This probably works for my purposes as I can assume the highest available resolution is the one currently in use, but it doesn't really strictly or definitively answer my question. – Daniel Sep 22 '18 at 20:45
  • You edited your post several times since I replied. I haven't tried the 2. solution yet. – Daniel Sep 23 '18 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.