-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfb2modeline.c
More file actions
63 lines (58 loc) · 1.68 KB
/
fb2modeline.c
File metadata and controls
63 lines (58 loc) · 1.68 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* fb2modeline.c - change fbmode timings to modeline in xorg.conf
*
* Copyright (C) 2013 Liaods <dongsheng.liao@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include <stdio.h>
int main(int argc, char **argv)
{
int x, y, rate, pclk, l, r, u, d, hs, vs;
int i=0;
float clock;
int dst[8];
if ( argc != 11 )
{
printf("Usage: %s x y rate timings\n", argv[i]);
printf("timings are: pclk left right up down hs vs\n");
return -1;
}
x=atoi(argv[++i]);
y=atoi(argv[++i]);
rate=atoi(argv[++i]);
pclk = atoi(argv[++i]);
l=atoi(argv[++i]);
r=atoi(argv[++i]);
u=atoi(argv[++i]);
d=atoi(argv[++i]);
hs=atoi(argv[++i]);
vs=atoi(argv[++i]);
clock = 1000000*1.0/pclk;
dst[0] = x;
dst[1] = r + x;
dst[2] = dst[1] + hs;
dst[3] = dst[2] + l;
dst[4] = y;
dst[5] = d + y;
dst[6] = dst[5] + vs;
dst[7] = dst[6] + u;
printf("Modeline \"%dx%d-%d\" %.2f", x, y, rate, clock);
for(i=0; i<8; ++i)
printf(" %d", dst[i]);
/* TODO, should we care about this? */
printf(" -HSync +Vsync\n");
return 0;
}