| … | |
… | |
| 38 | #include "ddcprobe/common.h" |
38 | #include "ddcprobe/common.h" |
| 39 | #include "ddcprobe/vesamode.h" |
39 | #include "ddcprobe/vesamode.h" |
| 40 | #include "Xorgtext.h" |
40 | #include "Xorgtext.h" |
| 41 | |
41 | |
| 42 | extern int bus, dev, func; |
42 | extern int bus, dev, func; |
| 43 | extern void findVideoDevice(pciaddr_t); |
43 | extern void findVideoDevice(void); |
| 44 | extern void help(); |
44 | extern void help(); |
| 45 | extern void usage(); |
45 | extern void usage(); |
| 46 | extern char * macMachineType(void); |
46 | extern char * macMachineType(void); |
| 47 | |
47 | |
| 48 | struct monitor_sync |
48 | struct monitor_sync |
| … | |
… | |
| 54 | }; |
54 | }; |
| 55 | |
55 | |
| 56 | int main(int argc, char **argv) { |
56 | int main(int argc, char **argv) { |
| 57 | FILE * f; |
57 | FILE * f; |
| 58 | int i, depth, fd; |
58 | int i, depth, fd; |
| 59 | int rc = 0, offb = 0, fbdepth = 0, fbdev = 0, nv = 0; |
59 | int rc = 0, offb = 0, fbdepth = 0, fbdev = 0, nv = 0, forcebus = 0; |
| 60 | unsigned int xsstart, xsend, xtotal = 0; |
60 | unsigned int xsstart, xsend, xtotal = 0; |
| 61 | unsigned int ysstart, ysend, ytotal = 0; |
61 | unsigned int ysstart, ysend, ytotal = 0; |
| 62 | double drate, vrate, hrate; |
62 | double drate, vrate, hrate; |
| 63 | unsigned int htotal, vtotal; |
63 | unsigned int htotal, vtotal; |
| 64 | char manufacturer[4]; |
64 | char manufacturer[4]; |
| … | |
… | |
| 74 | char *eisaid; |
74 | char *eisaid; |
| 75 | char keyboard_layout[32]; |
75 | char keyboard_layout[32]; |
| 76 | memset(keyboard_layout, 0, 32); |
76 | memset(keyboard_layout, 0, 32); |
| 77 | |
77 | |
| 78 | DIR *testdir; /* Test if path is a directory */ |
78 | DIR *testdir; /* Test if path is a directory */ |
|
|
79 | char *busid_input; /* BusID input test */ |
| 79 | char path[256]; /* Font Path */ |
80 | char path[256]; /* Font Path */ |
| 80 | char videobuf[MAX_VIDEO_LEN]; /* Video Card Device section */ |
81 | char videobuf[MAX_VIDEO_LEN]; /* Video Card Device section */ |
| 81 | int videolen = MAX_VIDEO_LEN - 1; /* How many chars we have left */ |
82 | int videolen = MAX_VIDEO_LEN - 1; /* How many chars we have left */ |
| 82 | char dri = FALSE; /* DRI on or off */ |
83 | char dri = FALSE; /* DRI on or off */ |
| 83 | char dump = FALSE; /* Dump debugging info? */ |
84 | char dump = FALSE; /* Dump debugging info? */ |
| … | |
… | |
| 119 | } |
120 | } |
| 120 | |
121 | |
| 121 | if (argc > 1) { |
122 | if (argc > 1) { |
| 122 | int args; |
123 | int args; |
| 123 | for(args = 1; args<argc; args++) { |
124 | for(args = 1; args<argc; args++) { |
| 124 | if (!strcmp(argv[args], "--fbdepth")) |
125 | if (!strncmp(argv[args], "--fbdepth",9)) |
| 125 | fbdepth = 1; |
126 | fbdepth = 1; |
| 126 | else if (!strcmp(argv[args], "--fbdev")) |
127 | else if (!strncmp(argv[args], "--fbdev",7)) |
| 127 | fbdev = 1; |
128 | fbdev = 1; |
| 128 | else if (!strcmp(argv[args], "--dump")) |
129 | else if (!strncmp(argv[args], "--dump",6)) |
| 129 | dump = TRUE; |
130 | dump = TRUE; |
| 130 | else if (!strcmp(argv[args], "--safe")) |
131 | else if (!strncmp(argv[args], "--safe",6)) |
| 131 | fbdev = fbdepth = 1; |
132 | fbdev = fbdepth = 1; |
| 132 | else if (!strcmp(argv[args], "--quiet")) |
133 | else if (!strncmp(argv[args], "--quiet",7)) |
| 133 | quiet = TRUE; |
134 | quiet = TRUE; |
| 134 | else if (!strncmp(argv[args], "--keymap=", 9)) { |
135 | else if (!strncmp(argv[args], "--keymap=", 9)) { |
| 135 | strncpy(keyboard_layout, argv[args] + 9 , 29); |
136 | strncpy(keyboard_layout, argv[args] + 9 , 29); |
| 136 | strcat(keyboard_layout, "\"\n"); |
137 | strcat(keyboard_layout, "\"\n"); |
| 137 | } |
138 | } |
|
|
139 | else if (!strncmp(argv[args], "--force-bus=",12)) { |
|
|
140 | /* Bus */ |
|
|
141 | busid_input = strtok(argv[args] + 12, ":"); |
|
|
142 | if(busid_input != NULL) |
|
|
143 | bus = atoi(busid_input); |
|
|
144 | /* Dev */ |
|
|
145 | busid_input = strtok(NULL, ":"); |
|
|
146 | if(busid_input != NULL) |
|
|
147 | bus = atoi(busid_input); |
|
|
148 | /* Func */ |
|
|
149 | busid_input = strtok(NULL, ":"); |
|
|
150 | if(busid_input != NULL) |
|
|
151 | func = atoi(busid_input); |
|
|
152 | forcebus = TRUE; |
|
|
153 | } |
| 138 | else if (!strcmp(argv[args], "--version")) { |
154 | else if (!strncmp(argv[args], "--version",9)) { |
| 139 | printf("Xorgautoconfig v" XAC_VER "\n"); |
155 | printf("Xorgautoconfig v" XAC_VER "\n"); |
| 140 | exit(0); |
156 | exit(0); |
| 141 | } |
157 | } |
| 142 | else if (!strcmp(argv[args], "--list-keymaps")) { |
158 | else if (!strcmp(argv[args], "--list-keymaps")) { |
| 143 | printf("%s", keymap_list); |
159 | printf("%s", keymap_list); |
| … | |
… | |
| 232 | if (!strncmp(fix.id, "OFfb", 4)) |
248 | if (!strncmp(fix.id, "OFfb", 4)) |
| 233 | offb = 1; |
249 | offb = 1; |
| 234 | } |
250 | } |
| 235 | |
251 | |
| 236 | /* For BusID */ |
252 | /* For BusID */ |
| 237 | findVideoDevice(fix.smem_start); |
253 | if(forcebus == 0) |
|
|
254 | findVideoDevice(); |
| 238 | |
255 | |
| 239 | /* Work out the card specifics to figure out if we need DRI, etc. */ |
256 | /* Work out the card specifics to figure out if we need DRI, etc. */ |
| 240 | depth = 16; |
257 | depth = 16; |
| 241 | memset(videobuf, 0, MAX_VIDEO_LEN); |
258 | memset(videobuf, 0, MAX_VIDEO_LEN); |
| 242 | if (nv) { |
259 | if (nv) { |