5

There is a Flatron E2042 in the office I work in and it's having the worst [firmware] problem I've ever seen in a display: it can't always work in full resolution.

Today is the day when it worked and I'd like to get the modeline for the correct resolution. It's not in Xorg.0.log and gtf/cvt are for calculating a modeline. AFAIU xrandr --verbose is showing all the needed numbers but rearranged and not readily available for later use in --newmode. And xvidtune -show lists only the internal display with nothing in the manual about selecting another one.

So, any other way to get the current modeline?

Update:

Script that I now use to make it work:

#!/bin/bash
modeline="flatron_e2042 108.00 1600 1624 1704 1800 900 901 904 1000 +hsync +vsync"
xrandr --newmode $modeline
modename="$(echo ${modeline%% *})"
xrandr --addmode VGA1 $modename
xrandr --output VGA1 --mode $modename
int_ua
  • 8,892

4 Answers4

4

Try with xvidtune:

xvidtune -show
forgi007
  • 41
  • 1
3

parse-edid is obsolete. Just use xrandr, it has all the information.

You can reformat xrandr output to a modeline using e.g. a Perl script like this

#!/usr/bin/perl

use strict; use warnings;

my ($dp, $width, $height, $opts, $current, $clock, $sync, $hpart, $vpart, $refresh); my $preferred = ""; sub flush() { print " Option "PreferredMode" "$preferred"\n" if ($preferred); print "EndSection\n" if ($dp); $preferred = ""; $dp = ""; }

open(my $F, "xrandr --verbose |") or die $!;

while(<$F>) { chomp; if (/^(\S+) (\S+)/) { flush(); $dp = $2 eq "connected" && $1; next unless $dp; print "Section &quot;Monitor&quot;\n"; print " Identifier &quot;$dp&quot;\n"; next; } next unless $dp; if (/^\s+(\d+)x(\d+)\s+\S\s+(\d+.?\d)\S+\s+([-+]HSync\s+[-+]VSync)\s(.)/i) { $width = $1; $height = $2; $clock = $3; $sync = lc $4; $opts = $5; $current = $opts =~ /current/; if ($opts !~ /preferred/) { flush(); next; } } if (/^\s+h: width\s+(\d+)\s+start\s+(\d+)\s+end\s+(\d+)\s+total\s+(\d+)/) { $hpart = "$1 $2 $3 $4"; } if (/^\s+v: height\s+(\d+)\s+start\s+(\d+)\s+end\s+(\d+)\s+total\s+(\d+).*?\bclock\s+(\d+)/) { $vpart = "$1 $2 $3 $4"; $refresh = $5; my $mode = "${width}x${height}_${refresh}"; print " Modeline &quot;$mode&quot; $clock $hpart $vpart $sync ($width x $height @ $refresh)\n"; if ($current) { $preferred = $mode; } } } flush(); close($F);

rustyx
  • 1,066
  • 15
  • 17
3

Not exactly the modeline, but you can download the monitor's EDID information where all supported resolutions are listed. I would use get-edid and parse-edid tools from read-edid package (http://manpages.ubuntu.com/manpages/oneiric/man1/get-edid.1.html). Then try to use the EDID information when starting X instead of asking the monitor for that information every time.

I know that nvidia driver has very good support for custom EDID file. I am not sure how it is supported in other drivers. I am sure you will figure it out.

Commands:

sudo get-edid > ~/lg_edid
parse-edid < ~/lg_edid
int_ua
  • 8,892
nobody
  • 4,412
1

The accepted answer claims that to get the current ModeLine one should use 'xvidtune' tool. Unfortunately, this program is showing the ModeLine that X server was started with but not the current one. Just try to change resolution (either using 'xrandr' or your window manager monitor controlling tool) and then run 'xvidtune -show' again and you'll see what I'm talking about. Probably, a better way to get current ModeLine is using 'xrandr' tool itself like this:

$ xrandr --verbose

For example, in my case the result is something like this (the only lines with the current ModeLine):

1920x1080 (0x251) 148.500MHz +HSync +VSync *current h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.50KHz v: height 1080 start 1084 end 1089 total 1125 clock 60.00Hz

As you can see, the current ModeLine is designated by the '*current' mark. In case of using more than one monitor, one would probably need to look for the apropriate section in xrandr's output marked with the output's name to which the monitor in question is connected (something like HDMI-0, DVI-D-0, VGA-0, etc).

folivore
  • 161