diff options
-rw-r--r-- | monitor-edid.spec | 7 | ||||
-rw-r--r-- | monitor-get-edid.c | 26 | ||||
-rwxr-xr-x | monitor-parse-edid | 1 | ||||
-rwxr-xr-x | monitor-probe | 2 |
4 files changed, 33 insertions, 3 deletions
diff --git a/monitor-edid.spec b/monitor-edid.spec index 5ada419..442ec0c 100644 --- a/monitor-edid.spec +++ b/monitor-edid.spec @@ -1,5 +1,5 @@ %define name monitor-edid -%define version 1.4 +%define version 1.5 %define release 1mdk Summary: Get monitor details @@ -40,6 +40,11 @@ rm -rf $RPM_BUILD_ROOT %_sbindir/* %changelog +* Mon Aug 8 2005 Pixel <pixel@mandriva.com> 1.5-1mdk +- add option --try-in-console when probing edid + since probing edid sometimes only work in console +- use this option by default in monitor-probe + * Wed Apr 6 2005 Pixel <pixel@mandrakesoft.com> 1.4-1mdk - default on old lrmi code to get ddc via int10 - fix build on vesa-cvt diff --git a/monitor-get-edid.c b/monitor-get-edid.c index 41e0e5d..5e4a549 100644 --- a/monitor-get-edid.c +++ b/monitor-get-edid.c @@ -7,6 +7,8 @@ #include <fcntl.h> #include <errno.h> #include <stdarg.h> +#include <sys/ioctl.h> +#include <sys/vt.h> #include "get-edid.h" int verbose = 0; @@ -14,17 +16,39 @@ int verbose = 0; int main(int argc, char **argv) { char edid[256]; + int try_in_console = 0; int i; for (i = 1; i < argc; i++) if (strcmp(argv[i], "-v") == 0) verbose = 1; + else if (strcmp(argv[i], "--try-in-console") == 0) try_in_console = 1; else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { printf("usage: monitor-get-edid [-v]\n"); exit(1); } - int size = get_edid(edid); + int size = 0 && get_edid(edid); + + if (!size && try_in_console) { + int non_X_console = 1; + int first_X_console = 7; + struct vt_stat current; + int fd = open("/dev/console", O_RDWR); + + if (ioctl(fd, VT_GETSTATE, ¤t) == 0 && + current.v_state >= first_X_console && + ioctl(fd, VT_ACTIVATE, non_X_console) == 0 && + ioctl(fd, VT_WAITACTIVE, non_X_console) == 0) { + /* retrying */ + size = get_edid(edid); + + /* restore */ + ioctl(fd, VT_ACTIVATE, current.v_active) == 0 && + ioctl(fd, VT_WAITACTIVE, current.v_active) == 0; + } + close(fd); + } if (size) write(1, edid, size); diff --git a/monitor-parse-edid b/monitor-parse-edid index 6aa9faa..dc8cead 100755 --- a/monitor-parse-edid +++ b/monitor-parse-edid @@ -449,6 +449,7 @@ GetOptions( 'v' => \ (my $verbose), 'perl' => \ (my $raw_perl), 'MonitorsDB' => \ (my $MonitorsDB), + 'try-in-console' => undef, ) or usage(); my $F; diff --git a/monitor-probe b/monitor-probe index dfde554..e3213b7 100755 --- a/monitor-probe +++ b/monitor-probe @@ -24,7 +24,7 @@ if [ $EUID != 0 ]; then fi [ -n "$opt_v" ] && echo "probing EDID" 1>&2 -monitor-edid $opt_v && exit 0 +monitor-edid --try-in-console $opt_v && exit 0 [ -n "$opt_v" ] && echo "probing using X" 1>&2 monitor-probe-using-X $X_driver && exit 0 |