/[gentoo-src]/Xorgautoconfig/Xorgautoconfig.c
Gentoo

Diff of /Xorgautoconfig/Xorgautoconfig.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.2
28#include <sys/syscall.h> 28#include <sys/syscall.h>
29#include <sys/mman.h> 29#include <sys/mman.h>
30#include <netinet/in.h> 30#include <netinet/in.h>
31#include <linux/fb.h> 31#include <linux/fb.h>
32#include <byteswap.h> 32#include <byteswap.h>
33#include <dirent.h>
33 34
34#include "ddcprobe/common.h" 35#include "ddcprobe/common.h"
35#include "ddcprobe/vesamode.h" 36#include "ddcprobe/vesamode.h"
36#include "Xorgtext.h" 37#include "Xorgtext.h"
37 38
212 213
213 214
214 /*** BEGIN xorg.conf ***/ 215 /*** BEGIN xorg.conf ***/
215 fprintf(f, "%s", header); 216 fprintf(f, "%s", header);
216 217
217 /* fontpath */ 218 /* Set fontpaths */
219 DIR *fontdir = opendir(FONTPATH);
220 DIR *testdir;
221 char path[256];
222 struct dirent *fontpath;
223
224 /* Add x fontserver note */
225 fprintf(f, "%s", fontpath_xfs);
226 if(fontdir != NULL) {
227 while ((fontpath = readdir (fontdir))) {
228 if((fontpath->d_name)[0] != '.') {
229 /* Only add directories */
230 strcpy(path, FONTPATH);
231 strcat(path, fontpath->d_name);
232 strcat(path, "/");
233 testdir = opendir(path);
234 if(testdir != NULL) {
235 fprintf(f, "\tFontPath\t\"%s\"\n",
236 path);
237 if(!strncmp(fontpath->d_name,"75dpi",5) ||
238 !strncmp(fontpath->d_name,"100dpi",6)){
239 fprintf(f, "\tFontPath\t\"%s:unscaled\"\n",
240 path);
241 }
242 closedir(testdir);
243 }
244 }
245 }
246 closedir(fontdir);
247 }
248 else {
218 fprintf(f, "%s", fontpath_gentoo); 249 fprintf(f, "%s", fontpath_gentoo);
250 }
251 fprintf(f, "EndSection\n\n");
219 252
220 /* modules section */ 253 /* modules section */
221 fprintf(f, "%s", modules_section); 254 fprintf(f, "%s", modules_section);
222 255
223 /* extensions section */ 256 /* extensions section */
298 331
299 /* See if we know where the card is, if not... */ 332 /* See if we know where the card is, if not... */
300 if (nv) { 333 if (nv) {
301 if (!strncmp(macid, "PowerMac4,2", 11) || !strncmp(macid, "PowerMac4,5", 11)) 334 if (!strncmp(macid, "PowerMac4,2", 11) || !strncmp(macid, "PowerMac4,5", 11))
302 fprintf(f, " Option \"FlatPanel\"\n"); 335 fprintf(f, " Option \"FlatPanel\"\n");
336 fprintf(f, "%s", driver_nv);
303 fprintf(f, " Driver \"nv\"\n"); 337 fprintf(f, " Driver\t\t\"nv\"\n");
304 } else if((fbdev) || (bus == 0 && dev == 0 && func == 0)) { 338 } else if((fbdev) || (bus == 0 && dev == 0 && func == 0)) {
305 if (!fbdev) { 339 if (!fbdev) {
306 fprintf(f, " # We couldn't determine the BusID of your "); 340 fprintf(f, " # We couldn't determine the BusID of your ");
307 fprintf(f, "video card. So we will use\n# the fbdev driver\n"); 341 fprintf(f, "video card. So we will use\n# the fbdev driver\n");
308 } 342 }
309 fprintf(f, " #Option \"ShadowFB\" \"true\"\n"); 343 fprintf(f, " #Option \"ShadowFB\" \"true\"\n");
310 fprintf(f, " #Option \"fbdev\" \"%s\"\n", name); 344 fprintf(f, " #Option \"fbdev\" \"%s\"\n", name);
311 fprintf(f, " Driver \"fbdev\"\n"); 345 fprintf(f, " Driver\t\t\"fbdev\"\n");
312 fprintf(f, " #BusID \"0:0:0\"\n"); 346 fprintf(f, " #BusID \"0:0:0\"\n");
313 depth = 15; 347 depth = 15;
314 } else { 348 } else {
315 /* Try and guess what video card is behind /dev/fb0 */ 349 /* Try and guess what video card is behind /dev/fb0 */
316 switch(fix.accel) { 350 switch(fix.accel) {
318 case 6: 352 case 6:
319 case 8: 353 case 8:
320 case 9: 354 case 9:
321 case 10: 355 case 10:
322 fprintf(f, "%s", driver_on_opts); 356 fprintf(f, "%s", driver_on_opts);
323 fprintf(f, " Driver \"ati\"\n"); 357 fprintf(f, " Driver\t\t\"ati\"\n");
324 break; 358 break;
325 /* IMS Twin Turbo */ 359 /* IMS Twin Turbo */
326 case 14: 360 case 14:
327 fprintf(f, "%s", driver_off_opts); 361 fprintf(f, "%s", driver_off_opts);
328 fprintf(f, " Driver \"imstt\"\n"); 362 fprintf(f, " Driver\t\t\"imstt\"\n");
329 break; 363 break;
330 /* Matrox Family */ 364 /* Matrox Family */
331 case 16: 365 case 16:
332 case 17: 366 case 17:
333 case 18: 367 case 18:
334 case 20: 368 case 20:
335 case 21: 369 case 21:
336 case 26: 370 case 26:
337 fprintf(f, "%s", driver_off_opts); 371 fprintf(f, "%s", driver_off_opts);
338 fprintf(f, " Driver \"mga\"\n"); 372 fprintf(f, " Driver\t\t\"mga\"\n");
339 break; 373 break;
340 /* Chips&Technology 6555x */ 374 /* Chips&Technology 6555x */
341 /* Apparently this is broken... 375 /* Apparently this is broken...
342 case 30: 376 case 30:
343 fprintf(f, "%s", driver_off_opts); 377 fprintf(f, "%s", driver_off_opts);
344 fprintf(f, " Driver \"chips\"\n"); 378 fprintf(f, " Driver\t\t\"chips\"\n");
345 break; 379 break;
346 */ 380 */
347 /* VooDoo 3 / Banshee */ 381 /* VooDoo 3 / Banshee */
348 case 31: 382 case 31:
349 fprintf(f, "%s", driver_off_opts); 383 fprintf(f, "%s", driver_off_opts);
350 fprintf(f, " Driver \"tdfx\"\n"); 384 fprintf(f, " Driver\t\t\"tdfx\"\n");
351 break; 385 break;
352 /* ATI Rage 128 Family */ 386 /* ATI Rage 128 Family */
353 case 32: 387 case 32:
354 fprintf(f, "%s", driver_on_opts); 388 fprintf(f, "%s", driver_r128);
355 fprintf(f, " Driver \"r128\"\n"); 389 fprintf(f, " Driver\t\t\"r128\"\n");
356 break; 390 break;
357 /* ATI Radeon */ 391 /* ATI Radeon */
358 case 38: 392 case 38:
359 fprintf(f, "%s", driver_on_opts); 393 fprintf(f, "%s", driver_radeon);
360 fprintf(f, " Driver \"radeon\"\n"); 394 fprintf(f, " Driver\t\t\"radeon\"\n");
361 break; 395 break;
362 default: 396 default:
397 /* FIXME still broken? */
363 /* radeon seems to be broken on VE (aka 7000) */ 398 /* radeon seems to be broken on VE (aka 7000) */
364 if ((!strncmp(fix.id, "ATI Radeon", 10)) && 399 if ((!strncmp(fix.id, "ATI Radeon", 10)) &&
365 (strncmp(fix.id, "ATI Radeon VE", 13))) { 400 (strncmp(fix.id, "ATI Radeon VE", 13))) {
366 fprintf(f, "%s", driver_on_opts); 401 fprintf(f, "%s", driver_radeon);
367 fprintf(f, " Driver \"radeon\"\n"); 402 fprintf(f, " Driver\t\t\"radeon\"\n");
368 } else if (!strncmp(fix.id, "Rage128", 7)) { 403 } else if (!strncmp(fix.id, "Rage128", 7)) {
369 fprintf(f, "%s", driver_on_opts); 404 fprintf(f, "%s", driver_r128);
370 fprintf(f, " Driver \"r128\"\n"); 405 fprintf(f, " Driver\t\t\"r128\"\n");
371 } else if (!strncmp(fix.id, "Rage Mobility M3", 16)) { 406 } else if (!strncmp(fix.id, "Rage Mobility M3", 16)) {
372 fprintf(f, "%s", driver_on_opts); 407 fprintf(f, "%s", driver_r128);
373 fprintf(f, " Driver \"r128\"\n"); 408 fprintf(f, " Driver\t\t\"r128\"\n");
374 } else { 409 } else {
375 fprintf(f, " #Option \"ShadowFB\""); 410 fprintf(f, " #Option \"ShadowFB\"");
376 fprintf(f, " \"true\"\n"); 411 fprintf(f, " \"true\"\n");
377 fprintf(f, " Driver \"fbdev\"\n"); 412 fprintf(f, " Driver\t\t\"fbdev\"\n");
378 depth = 15; 413 depth = 15;
379 } 414 }
380 break; 415 break;
381 } 416 }
382 fprintf(f, " BusID \"PCI:%d:%d:%d\"\n", bus, dev, func); 417 fprintf(f, " BusID \"PCI:%d:%d:%d\"\n", bus, dev, func);
415 fprintf(f, " EndSubSection\n"); 450 fprintf(f, " EndSubSection\n");
416 } 451 }
417 452
418 fprintf(f, "EndSection\n"); 453 fprintf(f, "EndSection\n");
419 fprintf(f, "%s", dri_section); 454 fprintf(f, "%s", dri_section);
420 /*** END XF86Config ***/ 455 /*** END Xorg.conf ***/
421 456
422 fclose(f); 457 fclose(f);
423 458
424 fprintf(stdout, "Wrote /etc/X11/xorg.conf\n"); 459 fprintf(stdout, "Wrote /etc/X11/xorg.conf\n");
460 fprintf(stdout, "Please check the configuration file for additional options\n");
425 461
426 return 0; 462 return 0;
427} 463}

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.20