diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-01-08 18:14:54 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-01-08 18:14:54 +0000 |
commit | 74a5be42e7044ea7393204e174436d4764fd0b6a (patch) | |
tree | f0c129a1f55c86c1026c2cc3deff5882fea9ab5f | |
parent | 957050b286bc1784110a881c93b0fe7e24e7dc18 (diff) | |
download | monitor-edid-74a5be42e7044ea7393204e174436d4764fd0b6a.tar monitor-edid-74a5be42e7044ea7393204e174436d4764fd0b6a.tar.gz monitor-edid-74a5be42e7044ea7393204e174436d4764fd0b6a.tar.bz2 monitor-edid-74a5be42e7044ea7393204e174436d4764fd0b6a.tar.xz monitor-edid-74a5be42e7044ea7393204e174436d4764fd0b6a.zip |
- monitor-get-edid:
o minimal support for getting EDID from different DDC port
(experimental, need testing before using it in monitor-edid)
this is inspired from SuSE's hwinfo. note:
- we may need to not redo vbe_check_vbe_info() for each vbe_get_edid_info() if
we want to get many ports. It would need a little re-architecturing
(since returning list in C is not great fun)
- hwinfo is probing ports 0,1 by default,
(hwinfo says: some BIOSes crash when you try more)
and 0,1,2 on Dell and nvidia-based laptops
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | get-edid.h | 2 | ||||
-rw-r--r-- | monitor-get-edid-using-vbe.c | 8 | ||||
-rw-r--r-- | vbe.c | 17 |
4 files changed, 19 insertions, 14 deletions
@@ -1,2 +1,4 @@ -- monitor-get-edid: skip /proc/acpi/video/**/EDID files which can't be valid - (#34417) +- monitor-get-edid: + o skip /proc/acpi/video/**/EDID files which can't be valid (#34417) + o minimal support for getting EDID from different DDC port + (experimental, need testing before using it in monitor-edid) @@ -1,4 +1,4 @@ int verbose; struct hd_data_struct; -int get_edid(struct hd_data_struct *hd_data, char *edid); +int get_edid(struct hd_data_struct *hd_data, char *edid, int port); diff --git a/monitor-get-edid-using-vbe.c b/monitor-get-edid-using-vbe.c index 1b5a470..822820a 100644 --- a/monitor-get-edid-using-vbe.c +++ b/monitor-get-edid-using-vbe.c @@ -18,6 +18,7 @@ int main(int argc, char **argv) { char edid[256]; int try_in_console = 0; + int port = 0; int i; /* Hardware Data defaults */ @@ -32,18 +33,19 @@ int main(int argc, char **argv) for (i = 1; i < argc; i++) { const char *arg = argv[i]; if (strcmp(arg, "-v") == 0) verbose = 1; + else if (strcmp(arg, "--port") == 0 && i+1 < argc) port = atoi(argv[++i]); else if (strcmp(arg, "--try-in-console") == 0) try_in_console = 1; else if (strcmp(arg, "--map-bios-vram") == 0) hd_data.flags.biosvram = 1; else if (strcmp(arg, "--check-bios-crc") == 0) hd_data.flags.nobioscrc = 0; else if (strcmp(arg, "--use-cpuemu") == 0) hd_data.flags.cpuemu = 1; else if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) { - printf("usage: monitor-get-edid [-v]\n"); + printf("usage: monitor-get-edid [-v] [--port <0-3>]\n"); exit(1); } } - int size = get_edid(&hd_data, edid); + int size = get_edid(&hd_data, edid, port); if (!size && try_in_console) { int non_X_console = 1; @@ -56,7 +58,7 @@ int main(int argc, char **argv) ioctl(fd, VT_ACTIVATE, non_X_console) == 0 && ioctl(fd, VT_WAITACTIVE, non_X_console) == 0) { /* retrying */ - size = get_edid(&hd_data, edid); + size = get_edid(&hd_data, edid, port); /* restore */ ioctl(fd, VT_ACTIVATE, current.v_active) == 0 && @@ -136,7 +136,7 @@ static int vbe_check_vbe_info(hd_data_t *hd_data) } /* Get EDID info. */ -int vbe_get_edid_info(hd_data_t *hd_data, char *edid) +int vbe_get_edid_info(hd_data_t *hd_data, char *edid, int port) { int i; int ax, bx, cx; @@ -144,7 +144,7 @@ int vbe_get_edid_info(hd_data_t *hd_data, char *edid) /* Setup registers for the interrupt call */ ax = 0x4f15; bx = 1; - cx = 0; + cx = port; /* Get EDID block */ i = CallInt10(&ax, &bx, &cx, edid, 256, hd_data->flags.cpuemu) & 0xffff; @@ -211,7 +211,7 @@ static int vbe_check_vbe_info__old(void) return 1; } -static int vbe_get_edid_info__old(char *edid) +static int vbe_get_edid_info__old(char *edid, int port) { int i; unsigned char *mem; @@ -236,6 +236,7 @@ static int vbe_get_edid_info__old(char *edid) memset(®s, 0, sizeof(regs)); regs.eax = 0x4f15; regs.ebx = 0x0001; + regs.ecx = port; regs.es = ((u_int32_t)mem) >> 4; regs.edi = ((u_int32_t)mem) & 0x0f; @@ -261,7 +262,7 @@ static int vbe_get_edid_info__old(char *edid) return 1; } -int get_edid__old(char *edid) +int get_edid__old(char *edid, int port) { int ok; /* try with older lrmi interface, we can assume a failure for @@ -269,12 +270,12 @@ int get_edid__old(char *edid) log_err("Retrying with old LRMI interface\n"); ok = (box_is_xbox() || vbe_check_vbe_info__old()) && - vbe_get_edid_info__old(edid); + vbe_get_edid_info__old(edid, port); return ok; } #endif -int get_edid(hd_data_t *hd_data, char *edid) +int get_edid(hd_data_t *hd_data, char *edid, int port) { int ok = 0; @@ -286,14 +287,14 @@ int get_edid(hd_data_t *hd_data, char *edid) if (!box_is_xbox()) { if (InitInt10(hd_data) == 0) { ok = vbe_check_vbe_info(hd_data) - && vbe_get_edid_info(hd_data, edid); + && vbe_get_edid_info(hd_data, edid, port); FreeInt10(); } } #ifdef LRMI if (!ok) - ok = get_edid__old(edid); + ok = get_edid__old(edid, port); #endif return ok ? 128 : 0; |