aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mandriva.org>2010-01-03 12:11:12 +0000
committerAnssi Hannula <anssi@mandriva.org>2010-01-03 12:11:12 +0000
commitd0c2f736167e9e4f5fde49ce16b89dfa22185d7a (patch)
treeb9664b0e8e64adfad6658ea313fc98d40a8e5a32
parent75dc2ecd455b85e78aaa77212cb33eeb7ffb74bc (diff)
downloadmonitor-edid-d0c2f736167e9e4f5fde49ce16b89dfa22185d7a.tar
monitor-edid-d0c2f736167e9e4f5fde49ce16b89dfa22185d7a.tar.gz
monitor-edid-d0c2f736167e9e4f5fde49ce16b89dfa22185d7a.tar.bz2
monitor-edid-d0c2f736167e9e4f5fde49ce16b89dfa22185d7a.tar.xz
monitor-edid-d0c2f736167e9e4f5fde49ce16b89dfa22185d7a.zip
Fix exit status logic introduced in previous commits.
-rw-r--r--NEWS5
-rwxr-xr-xmonitor-edid8
-rw-r--r--monitor-get-edid-using-vbe.c11
3 files changed, 15 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index e777147..c05bd7b 100644
--- a/NEWS
+++ b/NEWS
@@ -8,11 +8,12 @@
o retrieve up to 4 EDID extension blocks
o add --skip-vbe-check for skipping call for VBE info; useful if
calling the program multiple times for different ports
- o on failure, return exit status 2 if no successful VBE calls were made
+ o on failure, return exit status 2 if successful VBE calls were made
o never retry in console mode if the card reports that the port does
not support DDC (usually this means that the port has no display
devices connected)
- o add basic 15 sec timeout, with --no-timeout for disabling it
+ o add basic 15 sec timeout (exit status 3), with --no-timeout for
+ disabling it
- monitor-parse-edid:
o print EDID version and the number of EDID extension blocks
diff --git a/monitor-edid b/monitor-edid
index 54d41a4..3daca53 100755
--- a/monitor-edid
+++ b/monitor-edid
@@ -92,13 +92,15 @@ sub get_edids {
foreach my $port ($min_port .. $max_port) {
warn "probing EDID using VBE (port $port)\n" if $opt{verbose};
my $edid = `$cmd --port $port $skip_vbe`;
- if ($? >> 8 == 2) {
+ my $status = $? >> 8;
+ if ($status == 1) {
warn "VBE info call failed, skipping all ports\n" if $opt{verbose};
last;
}
- $skip_vbe = "--skip-vbe-check"; # VBE call ok, skip that for other ports
- is_edid_possibly_valid($edid) or next;
+ # skip VBE check for other ports if it was OK
+ $skip_vbe = "--skip-vbe-check" if $status == 0 || $status == 2;
+ is_edid_possibly_valid($edid) or next;
next if grep { $_->[1] eq $edid } @l;
push @l, [ "vbe$port" => $edid ];
last if $b_get_first;
diff --git a/monitor-get-edid-using-vbe.c b/monitor-get-edid-using-vbe.c
index f922a6b..3f8ab1c 100644
--- a/monitor-get-edid-using-vbe.c
+++ b/monitor-get-edid-using-vbe.c
@@ -17,7 +17,7 @@ int verbose = 0;
static void timeout_handler(int signal)
{
fprintf(stderr, "ERROR: timeout during EDID probe\n");
- exit(1);
+ exit(3);
}
int main(int argc, char **argv)
@@ -78,8 +78,11 @@ int main(int argc, char **argv)
return 0;
}
- /* returns 1 when VBE call was ok but not EDID call;
- * calling program can then speedup call on other ports with --skip-vbe-check;
- * also, calling program knows no ports work if the VBE call failed */
+ /* returns 1 on error before any successful calls; no ports work;
+ * calling program may skip other ports
+ * returns 2 on other errors; a different port may still work (call to VBE was ok);
+ * calling program may speedup call on other ports with --skip-vbe-check
+ * returns 3 on timeout
+ */
return -size;
}