summaryrefslogtreecommitdiffstats
path: root/ddcprobe
diff options
context:
space:
mode:
authornalin <nalin>1999-07-22 05:30:35 +0000
committernalin <nalin>1999-07-22 05:30:35 +0000
commit03b7b2a9d7c40c58ebbdbe139825e46956cb08a0 (patch)
tree550c3a6b4131bd49612ef02ca8e2dc5c80651635 /ddcprobe
parente237c8d5f548d3f09442c8b1b91f156d18cb0fdd (diff)
downloadanaconda-03b7b2a9d7c40c58ebbdbe139825e46956cb08a0.tar.gz
anaconda-03b7b2a9d7c40c58ebbdbe139825e46956cb08a0.tar.xz
anaconda-03b7b2a9d7c40c58ebbdbe139825e46956cb08a0.zip
guess refresh rates if the monitor doesn't provide one
Diffstat (limited to 'ddcprobe')
-rw-r--r--ddcprobe/ddcxinfo.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/ddcprobe/ddcxinfo.c b/ddcprobe/ddcxinfo.c
index 84ad710cb..5468c5690 100644
--- a/ddcprobe/ddcxinfo.c
+++ b/ddcprobe/ddcxinfo.c
@@ -6,7 +6,7 @@
int main(int argc, char **argv)
{
int i, j;
- unsigned char hmin, hmax, vmin, vmax;
+ unsigned char hmin = -1, hmax = -1, vmin = -1, vmax = -1;
if(argc < 2) {
char *p = argv[0];
if(strchr(p, '/')) {
@@ -17,32 +17,51 @@ int main(int argc, char **argv)
exit(1);
}
for(i = 1; i < argc; i++) {
- if(strcmp(argv[i], "-hsync") == 0) {
+ if((strcmp(argv[i], "-hsync") == 0) ||
+ (strcmp(argv[i], "-vsync") == 0)) {
vbe_get_edid_ranges(&hmin, &hmax, &vmin, &vmax);
- if(hmin || hmax) {
- printf("%d-%d\n", hmin, hmax);
- } else {
- return 1;
+ if(!hmin && !hmax && !vmin && !vmax) {
+ struct vbe_modeline* modelines;
+ modelines = vbe_get_edid_modelines();
+ for(j = 0;
+ modelines && (modelines[j].refresh != 0);
+ j++) {
+ if(hmin == 0) hmin = modelines[j].hfreq;
+ /* guess */
+ if(modelines[j].hfreq)
+ hmin = (hmin < modelines[j].hfreq) ?
+ hmin : modelines[j].hfreq;
+ if(modelines[j].hfreq)
+ hmax = (hmax > modelines[j].hfreq) ?
+ hmax : modelines[j].hfreq;
+ if(vmin == 0) vmin = modelines[j].vfreq;
+ if(modelines[j].vfreq)
+ vmin = (vmin < modelines[j].vfreq) ?
+ vmin : modelines[j].vfreq;
+ if(modelines[j].vfreq)
+ vmax = (vmax > modelines[j].vfreq) ?
+ vmax : modelines[j].vfreq;
+ }
}
}
+ if(strcmp(argv[i], "-hsync") == 0) {
+ printf("%d-%d\n", hmin, hmax);
+ }
if(strcmp(argv[i], "-vsync") == 0) {
- vbe_get_edid_ranges(&hmin, &hmax, &vmin, &vmax);
- if(vmin || vmax) {
- printf("%d-%d\n", vmin, vmax);
- } else {
- return 1;
- }
+ printf("%d-%d\n", vmin, vmax);
}
if(strcmp(argv[i], "-modelines") == 0) {
struct vbe_modeline* modelines;
modelines = vbe_get_edid_modelines();
for(j=0; modelines && (modelines[j].refresh != 0); j++){
if(modelines[j].modeline) {
- printf("# %dx%d, %1.1fHz%s\n%s\n",
+ printf("# %dx%d, %1.1f%sHz; hfreq=%f, vfreq=%f\n%s\n",
modelines[j].width,
modelines[j].height,
modelines[j].refresh,
modelines[j].interlaced?"i":"",
+ modelines[j].hfreq,
+ modelines[j].vfreq,
modelines[j].modeline);
}
}