summaryrefslogtreecommitdiffstats
path: root/ddcprobe/ddcxinfo.c
blob: 0a384a8c09d3cd64e301c2e51a263448640278c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
#include <stdlib.h>
#include "vbe.h"

int main(int argc, char **argv)
{
	int i, j;
	unsigned char hmin, hmax, vmin, vmax;
	if(argc < 2) {
		fprintf(stderr, "usage: %s [-hsync] [-vsync] [-modelines]\n",
			argv[0]);
		exit(1);
	}
	for(i = 1; i < argc; i++) {
		if(strcmp(argv[i], "-hsync") == 0) {
			vbe_get_edid_ranges(&hmin, &hmax, &vmin, &vmax);
			printf("%d-%d\n", hmin, hmax);
		}
		if(strcmp(argv[i], "-vsync") == 0) {
			vbe_get_edid_ranges(&hmin, &hmax, &vmin, &vmax);
			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\n%s\n",
					       modelines[j].width,
					       modelines[j].height,
					       modelines[j].refresh,
					       modelines[j].modeline);
					free(modelines[j].modeline);
				}
			}
			if(modelines) {
				free(modelines);
			}
		}
	}
	return 0;
}