aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--monitor-get-edid-using-vbe.c8
-rw-r--r--vbe.c19
3 files changed, 20 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index cb419ee..ac3af07 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@
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 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)
- monitor-parse-edid:
o print EDID version and the number of EDID extension blocks
diff --git a/monitor-get-edid-using-vbe.c b/monitor-get-edid-using-vbe.c
index abd9e9a..0ba76dd 100644
--- a/monitor-get-edid-using-vbe.c
+++ b/monitor-get-edid-using-vbe.c
@@ -37,7 +37,7 @@ int main(int argc, char **argv)
int size = get_edid(edid, port, skip_vbe_check);
- if (size <= 0 && try_in_console) {
+ if (size < 0 && try_in_console) {
int non_X_console = 1;
struct vt_stat current;
int fd = open("/dev/console", O_RDWR);
@@ -57,13 +57,13 @@ int main(int argc, char **argv)
close(fd);
}
- if (size > 0) {
+ if (size >= 0) {
write(1, edid, size);
return 0;
}
- /* return 1 when VBE call was ok but not EDID call;
+ /* 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 */
- return size < 0 ? 2 : 1;
+ return -size;
}
diff --git a/vbe.c b/vbe.c
index 57c9ac9..fcd9d7f 100644
--- a/vbe.c
+++ b/vbe.c
@@ -203,10 +203,10 @@ static int vbe_check_ddc_capabilities(int port)
if (!(regs.ebx & 3)) {
log_err("DDC (0x4f15:00): DDC not supported, not continuing\n", i);
- return 0;
+ return 1;
}
- return 1;
+ return 2;
}
static int vbe_get_edid_info(char *edid, int port, int block)
@@ -260,6 +260,12 @@ static int vbe_get_edid_info(char *edid, int port, int block)
return 1;
}
+/* return values:
+ * size of edid: success
+ * 0: success but no edid
+ * -1: failure, VBE info call worked
+ * -2: failure, VBE info call didn't work
+ */
int get_edid(char *edid, int port, int skip_vbe_check)
{
int i, extensions;
@@ -275,12 +281,13 @@ int get_edid(char *edid, int port, int skip_vbe_check)
return -1;
}
- ok = vbe_check_ddc_capabilities(port) &&
- vbe_get_edid_info(edid, port, 0);
-
- if (!ok)
+ ok = vbe_check_ddc_capabilities(port);
+ if (ok == 1) /* success but no DDC */
return 0;
+ if (!ok || !vbe_get_edid_info(edid, port, 0))
+ return -2;
+
extensions = ((unsigned char*)edid)[126];
if (extensions > MAX_EXTENSION_COUNT) {
log_err("EDID: Reported %d extensions, only reading %d\n",