LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-10-2009, 01:35 PM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
How To Programmatically Extract Monitor Name


I'd like to query my monitor to change my xorg.conf file on-the-fly. I have a box that I connect to two different monitors. One is a 1680x1050 monitor (DVI-D), the other is 1920x1080 HDTV (HDMI). I'd like to extract/parse the monitor name to use the correct xorg.conf.

This is with 13.0 32-bit. I'm using NVIdia 185.18.31 proprietary drivers. As this is the new X system, my xorg.conf is minimal only to support the proprietary drivers.

I looked at xorgsetup, which basically is a wrapper for 'X -configure'. I don't want to create a new xorg.conf, just extract/parse the EDID info from the monitor in a human readable manner.

Perhaps the easiest solution is to let 'X -configure' create a new xorg.conf, extract the monitor name, delete the new xorg.conf, and install the correct pre-made xorg.conf.

I admit that with the new X I might not need this information, but what the heck.

Another reason for knowing this is so I can reconfigure Xine on-the-fly to use the correct audio port (HDMI or external speakers).

Thanks again.
 
Old 09-10-2009, 01:56 PM   #2
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
A few things I found by googling:

http://john.fremlin.de/programs/linux/read-edid/ <-- Looks good.
http://wiki.mandriva.com/en/Tools/monitor-edid <-- I arrived to the previous link through here.
 
Old 09-10-2009, 02:34 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Thanks, I saw that link too, but I read somewhere that read-edid won't work with AMD 64 setups.
 
Old 09-10-2009, 02:38 PM   #4
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 288

Rep: Reputation: 155Reputation: 155
Doesn't that information (VendorName and ModelName) appear in the Monitor section of xorg.conf? If so, are you asking for a script which will extract (using eg SED, AWK, etc) and print the information?
 
Old 09-10-2009, 02:40 PM   #5
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Quote:
Originally Posted by Woodsman View Post
Thanks, I saw that link too, but I read somewhere that read-edid won't work with AMD 64 setups.
Indeed, the second link mentions that it has to go through some kind of emulation.
 
Old 09-10-2009, 02:59 PM   #6
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
If so, are you asking for a script which will extract (using eg SED, AWK, etc) and print the information?
No, I want to extract the information from the monitor so I can use the correct xorg.conf before starting X. I have two prebuilt xorg.conf files, one for each monitor. I swap the files before starting X when I move the machine. I started doing this long ago when I wanted to swap video drivers, say toggling between nv and nvidia. Was much faster and handier than always manually editing xorg.conf.
 
Old 09-10-2009, 04:23 PM   #7
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 288

Rep: Reputation: 155Reputation: 155
You might try using a program called 'ddcxinfo' but I was unable to 'make' it on Slackware 13.

The following commands will use Xorg to probe the monitor and output a line of EDID data which should uniquely identify each of your monitors (and not change over time). The outputted line contains the manufacturer, model, and serial number -- though it is encoded in hexadecimal format.

The approach is rather ugly and may not suit your purposes, but I thought I'd post it just in case.

Code:
Xorg :1 -logverbose 10 -probeonly 
sed '1,/EDID (in hex)/d' /var/log/Xorg.1.log |head -c 40
 
Old 09-10-2009, 06:49 PM   #8
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Actually, the probeonly option might suffice. Although I get different results depending upon which version of X I'm using. Regardless, the info I need from the resulting Xorg.x.log is available.

I notice there is one consistent snippet regardless of which monitor or computer I run the probe, or which version of X:

(--) NVIDIA(0): Connected display device(s) on GeForce 6150 at PCI:0:5:0:
(--) NVIDIA(0): Samsung SyncMaster (CRT-0)

or:

(--) NVIDIA(0): Connected display device(s) on GeForce 8300 at PCI:2:0:0:
(--) NVIDIA(0): Acer X193W+ (DFP-0)

The Samsung is an LCD monitor but uses the VGA adapter, hence the CRT designation. I haven't yet tested this probing with the HDTV.

From there I can use grep to return a line number for the "Connected display device..." line. For example, line 447. Then I can run 'head -448 /var/log/Xorg.1.log | tail -1' to extract line 448.

Thanks much!
 
Old 09-10-2009, 07:04 PM   #9
xflow7
Member
 
Registered: May 2004
Distribution: Slackware
Posts: 215

Rep: Reputation: 45
The EDID info is available at /proc/acpi/video/<some unchanging video adapter>/<some unchanging video port name>/EDID

I've used the "state" file in that same location to probe whether a monitor is connected or not in order to do a similar thing.

The EDID data is binary, but I'd imagine you could find an API or something to decode it and that Monitor name is in there somewhere.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to programmatically monitor a process memory usage? thanhvn Programming 14 02-20-2009 01:15 AM
Extract Monitor Modeline Xerop Fedora 1 06-07-2006 11:55 AM
how to programmatically monitor a process memory usage? thanhvn Linux - Software 1 11-15-2005 08:44 PM
programmatically wake up monitor dovkruger Programming 1 11-03-2005 04:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration