How to get information about monitor in use? (Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

How to get information about monitor in use? (Solved)

#1 Post by LazY Puppy »

Hi.

I'm using my OS on several different machines with different types of monitors.

To get some special functions to work, I need to setup a variable (by a script) dependent on the monitor in use.

So how can I get information about the monitor in use?

Is it possible to get such information already at boot up (before the graphical X desktop appears on the screen)?

Thanks in advance.

RSH
Last edited by LazY Puppy on Mon 31 Oct 2016, 16:20, edited 1 time in total.
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#2 Post by trapster »

The info you seek may be buried in /var/log/Xorg.0.log
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#3 Post by vovchik »

@ Trapster,

You're right. Mine shows the following:

Code: Select all

cat /var/log/Xorg.0.log | grep "Monitor name"
[    45.652] (II) RADEON(0): Monitor name: HP LE2201w
Thanks and kind regards,
vovchik

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#4 Post by LazY Puppy »

vovchik wrote:@ Trapster,

You're right. Mine shows the following:

Code: Select all

cat /var/log/Xorg.0.log | grep "Monitor name"
[    45.652] (II) RADEON(0): Monitor name: HP LE2201w
Thanks and kind regards,
vovchik
Thanks to all.

I think this is going to be helpful.

:D
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#5 Post by jamesbond »

What info do you need? Monitor name? Resolution? Both you can get before Xorg starts, but resolution can *change* when you launch Xorg.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#6 Post by LazY Puppy »

jamesbond wrote:What info do you need? Monitor name? Resolution? Both you can get before Xorg starts, but resolution can *change* when you launch Xorg.
I need exactly information about where the monitor is connected to the graphics card (VGA-0 or VGA-1 or LVDS-0 (HDMI-0) or LVDS-1 (HDMI-1) etc.pp).
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

#7 Post by drunkjedi »

Hey Lazy, would xrandr do?

I don't know much about booting process or when xrandr will work but xrandr do tell how a monitor is connected and it's preferred resolution.

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#8 Post by LazY Puppy »

Yes, xrandr seems to return necessary info.

Though, examining /var/log/Xorg.0.log will do what I need, as it seems to be updated repeatedly during the session.

Again thanks to all.
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#9 Post by LazY Puppy »

Currently all the machines in use don't use the HDMI connection for the monitor, so I could limit this just to VGA only (nvidia and ati graphics cards).

So here's what I'm doing in my script to get the necessary monitor properties to change wallpaper dependent on the current desktop (viewport).

Code: Select all

# Get Data from current used Distro Configuration File
. /etc/DISTRO_SPECS
. /etc/"$DISTRO_FILE_PREFIX"_"$DISTRO_VERSION".cfg
CFGFILE="`realpath /etc/"$DISTRO_FILE_PREFIX"_"$DISTRO_VERSION".cfg`"
INFOFILE=/var/log/Xorg.0.log
MONCONNECT=""
if (grep -i 'Output VGA-1 connected' $INFOFILE >/dev/null) then
	echo "VGA-1"; MONCONNECT="VGA-1";
	elif (grep -i 'Output VGA-0 connected' $INFOFILE >/dev/null) then
	echo "VGA-0"; MONCONNECT="VGA-0";
fi
if [ "$MONCONNECT" != "" ]; then
	NEWMYXFCEWPPROPERTY="/backdrop/screen0/monitor$MONCONNECT/workspace0/last-image"
	sed -i 's|'"$MYXFCEWPPROPERTY"'|'"$NEWMYXFCEWPPROPERTY"'|' "$CFGFILE"
fi
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

Post Reply